summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-25 13:24:17 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-25 13:24:17 +0000
commitc2693f8bd61757e32d2f92010c041a79b21d074a (patch)
tree0d41dfc32ff961b7b1a6cf0d139779069de280c9 /vm_core.h
parent0f63b60f23aea76e52a6f6fc0d073eb2defe58d8 (diff)
* vm_trace.c (rb_threadptr_exec_event_hooks_and_pop_frame):
pop a frame before JUMP_TAG() if exception occurred. This change fix bug of Ruby 1.9. [ruby-core:51128] [ruby-trunk - Bug #7624] * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use `rb_threadptr_exec_event_hooks_and_pop_frame()'. * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while exception handling. While exception hadnling, if an exception is raised in hooks, need to pop current frame and raise this raised exception by hook. * test/ruby/test_settracefunc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/vm_core.h b/vm_core.h
index 48f887c03a..8a4dd239a1 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -962,8 +962,9 @@ struct rb_trace_arg_struct {
};
void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg);
+void rb_threadptr_exec_event_hooks_and_pop_frame(struct rb_trace_arg_struct *trace_arg);
-#define EXEC_EVENT_HOOK(th_, flag_, self_, id_, klass_, data_) do { \
+#define EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, pop_p_) do { \
if (UNLIKELY(ruby_vm_event_flags & (flag_))) { \
if (((th)->event_hooks.events | (th)->vm->event_hooks.events) & (flag_)) { \
struct rb_trace_arg_struct trace_arg; \
@@ -976,11 +977,18 @@ void rb_threadptr_exec_event_hooks(struct rb_trace_arg_struct *trace_arg);
trace_arg.data = (data_); \
trace_arg.path = Qundef; \
trace_arg.klass_solved = 0; \
- rb_threadptr_exec_event_hooks(&trace_arg); \
+ if (pop_p_) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg); \
+ else rb_threadptr_exec_event_hooks(&trace_arg); \
} \
} \
} while (0)
+#define EXEC_EVENT_HOOK(th_, flag_, self_, id_, klass_, data_) \
+ EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 0)
+
+#define EXEC_EVENT_HOOK_AND_POP_FRAME(th_, flag_, self_, id_, klass_, data_) \
+ EXEC_EVENT_HOOK_ORIG(th_, flag_, self_, id_, klass_, data_, 1)
+
#if defined __GNUC__ && __GNUC__ >= 4
#pragma GCC visibility push(default)
#endif