From 9d803dfd5f1a57a6d07c27b0d95917165ba259dc Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 24 Nov 2012 04:12:30 +0000 Subject: * vm_trace.c (rb_tracepoint_attr_raised_exception): should not check value before event checking. * vm_trace.c (rb_tracepoint_attr_return_value): ditto. * test/ruby/test_settracefunc.rb: add tests for TracePoint#return_value and TracePoint#raised_exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_trace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vm_trace.c') diff --git a/vm_trace.c b/vm_trace.c index a2ede6498b..23f412e541 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -750,15 +750,15 @@ rb_tracepoint_attr_return_value(VALUE tpval) rb_tp_t *tp = tpptr(tpval); tp_attr_check_active(tp); - if (tp->trace_arg->data == Qundef) { - rb_bug("tp_attr_return_value_m: unreachable"); - } if (tp->trace_arg->event & (RUBY_EVENT_RETURN | RUBY_EVENT_C_RETURN)) { /* ok */ } else { rb_raise(rb_eRuntimeError, "not supported by this event"); } + if (tp->trace_arg->data == Qundef) { + rb_bug("tp_attr_return_value_m: unreachable"); + } return tp->trace_arg->data; } @@ -768,15 +768,15 @@ rb_tracepoint_attr_raised_exception(VALUE tpval) rb_tp_t *tp = tpptr(tpval); tp_attr_check_active(tp); - if (tp->trace_arg->data == Qundef) { - rb_bug("tp_attr_raised_exception_m: unreachable"); - } if (tp->trace_arg->event & (RUBY_EVENT_RAISE)) { /* ok */ } else { rb_raise(rb_eRuntimeError, "not supported by this event"); } + if (tp->trace_arg->data == Qundef) { + rb_bug("tp_attr_raised_exception_m: unreachable"); + } return tp->trace_arg->data; } -- cgit v1.2.3