Bug #9964

TracePoint invoke unexpected b_call events with redo

Added by Koichi Sasada about 1 year ago. Updated 11 months ago.

[ruby-dev:48305]
Status:Closed
Priority:Normal
Assignee:Koichi Sasada
ruby -v:ruby 2.2 Backport:2.0.0: DONE, 2.1: DONE

Description

次のようなプログラムで、無限に b_call が発生し、対応する b_return が発生しません。

1.times{
  redo
}

これは、redo で b_call イベントを発生するところまで戻ってしまうためです。
redo した時、b_call イベントを発生する trace の へ戻るように変更することで解決できます。

Index: compile.c
===================================================================
--- compile.c   (revision 46468)
+++ compile.c   (working copy)
@@ -483,8 +483,8 @@
        LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
        LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);

+       ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_B_CALL);
        ADD_LABEL(ret, start);
-       ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_B_CALL);
        COMPILE(ret, "block body", node->nd_body);
        ADD_LABEL(ret, end);
        ADD_TRACE(ret, nd_line(node), RUBY_EVENT_B_RETURN);

例によって 2.0 まで同じような問題があります。

Associated revisions

Revision 46471
Added by Koichi Sasada about 1 year ago

  • compile.c (rb_iseq_compile_node): put start label of block after trace (b_call). [Bug #9964]
  • test/ruby/test_settracefunc.rb: add a test. added assert_consistent_call_return() method check call/return consistency.

Revision 46471
Added by Koichi Sasada about 1 year ago

  • compile.c (rb_iseq_compile_node): put start label of block after trace (b_call). [Bug #9964]
  • test/ruby/test_settracefunc.rb: add a test. added assert_consistent_call_return() method check call/return consistency.

Revision 47014
Added by Tomoyuki Chikanaga 12 months ago

merge revision(s) r46471: [Backport #9964]

* compile.c (rb_iseq_compile_node): put start label of block after
  trace (b_call).
  [Bug #9964]

* test/ruby/test_settracefunc.rb: add a test.
  added assert_consistent_call_return() method check call/return
  consistency.

Revision 47340
Added by Usaku NAKAMURA 11 months ago

merge revision(s) 46471: [Backport #9964]

* compile.c (rb_iseq_compile_node): put start label of block after
  trace (b_call).
  [Bug #9964]

* test/ruby/test_settracefunc.rb: add a test.
  added assert_consistent_call_return() method check call/return
  consistency.

History

#1 Updated by Koichi Sasada about 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r46471.


  • compile.c (rb_iseq_compile_node): put start label of block after trace (b_call). [Bug #9964]
  • test/ruby/test_settracefunc.rb: add a test. added assert_consistent_call_return() method check call/return consistency.

#2 Updated by Tomoyuki Chikanaga about 1 year ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED

#3 Updated by Tomoyuki Chikanaga 12 months ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE

Backported into ruby_2_1 branch at r47014.

#4 Updated by Usaku NAKAMURA 11 months ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE

backported into ruby_2_0_0 at r47340.
(note that ruby 2.0.0 doesn't have a_call/a_return events.)

Also available in: Atom PDF