Project

General

Profile

Actions

Bug #9964

closed

TracePoint invoke unexpected b_call events with redo

Added by ko1 (Koichi Sasada) over 10 years ago. Updated about 10 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.2
[ruby-dev:48305]

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 まで同じような問題があります。

Updated by ko1 (Koichi Sasada) over 10 years 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.

Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago

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

Updated by nagachika (Tomoyuki Chikanaga) over 10 years 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.

Updated by usa (Usaku NAKAMURA) about 10 years 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.)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0