summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-20 09:48:24 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-20 09:48:24 +0000
commit553931962a8a6c73ecef770831165070479c8763 (patch)
tree08df43c91bc32fe20433b75cd0a599d2b159eac9 /vm_core.h
parentb1fa559039d9a2130975a364260fe77a086e6e8b (diff)
* vm_trace.c: add two methods:
(1) TracePoint#return_value which returns return value on the :return and :c_return event. (2) TracePoint#raised_exception which returns raised exception value on the :raise event. Eeach methods raise RuntimeError if it is called at unsupported event. Please review and give us feedback until next preview release (Dec/2012) of Ruby 2.0.0. * insns.def, vm.c, vm_eval.c, vm_insnhelper.c, eval.c, thread.c: ditto. * vm_trace.c, vm_core.h: move definition of rb_trace_arg_t from vm_trace.c to vm_core.h. Caller fills rb_trace_arg_t and pass the pointer of this variable. * test/ruby/test_settracefunc.rb: fix tests to test this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/vm_core.h b/vm_core.h
index dd9e3872e2..d2f9474d34 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -887,13 +887,30 @@ void rb_thread_lock_destroy(rb_thread_lock_t *);
} while (0)
/* tracer */
-void
-rb_threadptr_exec_event_hooks(rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass);
-
-#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \
- if (UNLIKELY(ruby_vm_event_flags & (flag))) { \
- if (((th)->event_hooks.events | (th)->vm->event_hooks.events) & (flag)) { \
- rb_threadptr_exec_event_hooks((th), (flag), (self), (id), (klass)); \
+typedef struct rb_trace_arg_struct {
+ rb_event_flag_t event;
+ rb_thread_t *th;
+ rb_control_frame_t *cfp;
+ VALUE self;
+ ID id;
+ VALUE klass;
+ VALUE data;
+} rb_trace_arg_t;
+
+void rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg);
+
+#define EXEC_EVENT_HOOK(th_, flag_, self_, id_, klass_, data_) do { \
+ if (UNLIKELY(ruby_vm_event_flags & (flag_))) { \
+ if (((th)->event_hooks.events | (th)->vm->event_hooks.events) & (flag_)) { \
+ rb_trace_arg_t trace_arg; \
+ trace_arg.event = (flag_); \
+ trace_arg.th = (th_); \
+ trace_arg.cfp = (trace_arg.th)->cfp; \
+ trace_arg.self = (self_); \
+ trace_arg.id = (id_); \
+ trace_arg.klass = (klass_); \
+ trace_arg.data = (data_); \
+ rb_threadptr_exec_event_hooks(&trace_arg); \
} \
} \
} while (0)