ruby-changes:29248
From: ko1 <ko1@a...>
Date: Fri, 14 Jun 2013 18:56:53 +0900 (JST)
Subject: [ruby-changes:29248] ko1:r41300 (trunk): * compile.c (rb_iseq_compile_node): fix location of a `trace'
ko1 2013-06-14 18:54:58 +0900 (Fri, 14 Jun 2013) New Revision: 41300 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41300 Log: * compile.c (rb_iseq_compile_node): fix location of a `trace' instruction (b_return event). [ruby-core:55305] [ruby-trunk - Bug #8489] (need a backport to 2.0.0?) * test/ruby/test_settracefunc.rb: add a test. Modified files: trunk/ChangeLog trunk/compile.c trunk/test/ruby/test_settracefunc.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41299) +++ ChangeLog (revision 41300) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jun 14 18:52:51 2013 Koichi Sasada <ko1@a...> + + * compile.c (rb_iseq_compile_node): fix location of a `trace' + instruction (b_return event). + [ruby-core:55305] [ruby-trunk - Bug #8489] + (need a backport to 2.0.0?) + + * test/ruby/test_settracefunc.rb: add a test. + Fri Jun 14 18:18:07 2013 Koichi Sasada <ko1@a...> * class.c, include/ruby/ruby.h: add write barriers for T_CLASS, Index: compile.c =================================================================== --- compile.c (revision 41299) +++ compile.c (revision 41300) @@ -482,8 +482,8 @@ rb_iseq_compile_node(VALUE self, NODE *n https://github.com/ruby/ruby/blob/trunk/compile.c#L482 ADD_LABEL(ret, start); ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_B_CALL); COMPILE(ret, "block body", node->nd_body); - ADD_TRACE(ret, nd_line(node), RUBY_EVENT_B_RETURN); ADD_LABEL(ret, end); + ADD_TRACE(ret, nd_line(node), RUBY_EVENT_B_RETURN); /* wide range catch handler must put at last */ ADD_CATCH_ENTRY(CATCH_TYPE_REDO, start, end, 0, start); Index: test/ruby/test_settracefunc.rb =================================================================== --- test/ruby/test_settracefunc.rb (revision 41299) +++ test/ruby/test_settracefunc.rb (revision 41300) @@ -953,4 +953,17 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L953 set_trace_func(nil) end end + + def test_tracepoint_b_return_with_next + n = 0 + TracePoint.new(:b_return){ + n += 1 + }.enable{ + 3.times{ + next + } # 3 times b_retun + } # 1 time b_return + + assert_equal 4, n + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/