summaryrefslogtreecommitdiff
path: root/vm_trace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 22:28:16 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 22:28:16 +0000
commit4db83403982100df21c3c6c18b1cef29dd379e6a (patch)
treefe3430360cc21c68ee978fb61d6255e789c2bce2 /vm_trace.c
parent2dc5e62545eb18feb85b1fa321f19904704cc76f (diff)
[EXPERIMENTAL: NEED DISCUSS]
* vm_trace.c: add events * :thread_begin - hook at thread beggining. * :thead_end - hook at thread ending. * :b_call - hook at block enter. * :b_return - hook at block leave. This change slow down block invocation. Please try and give us feedback until 2.0 code freeze. * include/ruby/ruby.h: ditto. * compile.c (rb_iseq_compile_node): ditto. * insns.def: ditto. * thread.c: ditto. * vm.c: ditto. * include/ruby/debug.h: add a comment. * test/ruby/test_settracefunc.rb: add a tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_trace.c')
-rw-r--r--vm_trace.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/vm_trace.c b/vm_trace.c
index 211b36e969..d94e9df8e0 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -507,6 +507,10 @@ get_event_id(rb_event_flag_t event)
C(c_call, C_CALL);
C(c_return, C_RETURN);
C(raise, RAISE);
+ C(b_call, B_CALL);
+ C(b_return, B_RETURN);
+ C(thread_begin, THREAD_BEGIN);
+ C(thread_end, THREAD_END);
#undef C
default:
return 0;
@@ -610,6 +614,10 @@ symbol2event_flag(VALUE v)
C(c_call, C_CALL);
C(c_return, C_RETURN);
C(raise, RAISE);
+ C(b_call, B_CALL);
+ C(b_return, B_RETURN);
+ C(thread_begin, THREAD_BEGIN);
+ C(thread_end, THREAD_END);
#undef C
rb_raise(rb_eArgError, "unknown event: %s", rb_id2name(SYM2ID(sym)));
}
@@ -736,7 +744,7 @@ rb_tracearg_self(rb_trace_arg_t *trace_arg)
VALUE
rb_tracearg_return_value(rb_trace_arg_t *trace_arg)
{
- if (trace_arg->event & (RUBY_EVENT_RETURN | RUBY_EVENT_C_RETURN)) {
+ if (trace_arg->event & (RUBY_EVENT_RETURN | RUBY_EVENT_C_RETURN | RUBY_EVENT_B_RETURN)) {
/* ok */
}
else {
@@ -975,7 +983,7 @@ tracepoint_new_s(int argc, VALUE *argv, VALUE self)
}
}
else {
- events = RUBY_EVENT_ALL;
+ events = RUBY_EVENT_TRACEPOINT_ALL;
}
if (!rb_block_given_p()) {