From: "jeremyevans0 (Jeremy Evans)" Date: 2022-09-16T17:58:34+00:00 Subject: [ruby-core:109921] [Ruby master Bug#19003] TracePoint behavior inconsistency in 3.2.0-preview2 Issue #19003 has been updated by jeremyevans0 (Jeremy Evans). This issue shows a case where you are adding a local tracepoint during global tracepoint processing. There are a couple approaches Ruby could take here: 1) For a local tracepoint added during global tracepoint processing, only call it for future events and not the current event. This appears to be the Ruby 3.1 behavior. 2) For a local tracepoint added during global tracepoint processing, call it for future events and the current event. This appears to be the Ruby 3.2 behavior. In both cases, a local tracepoint added during local tracepoint processing (the recursive call inside `step_over`) is not called for the current event. If it was, the code example would result in an infinite loop. Can you explain why you think this behavior change is a bug? Does Ruby specify that local tracepoints added during global tracepoint processing for an event should not apply to the current event, and only future events? ---------------------------------------- Bug #19003: TracePoint behavior inconsistency in 3.2.0-preview2 https://bugs.ruby-lang.org/issues/19003#change-99169 * Author: hurricup (Alexandr Evstigneev) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0preview2 (2022-09-09 master 35cfc9a3bb) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- This is kind of continuation of my previous report about global/local TP processing (#18730). Sample script: ```rb def foo return 1 end puts RubyVM::InstructionSequence.of(method :foo).disasm def step_over TracePoint.new(:line, :return, :b_return) do |tp| puts "Step over hits by #{tp.event} at #{tp.lineno}" step_over tp.disable end.enable(target: RubyVM::InstructionSequence.of(method :foo), target_thread: Thread.current) end TracePoint.new(:line, :return, :b_return) do |tp| if tp.lineno == 2 puts "Step into hits by #{tp.event} at #{tp.lineno}" step_over tp.disable end end.enable(target_thread: Thread.current) a = foo ``` In ruby 3.1.2 we have expected behavior. Output: ``` == disasm: # (catch: FALSE) 0000 putobject_INT2FIX_1_ ( 2)[LiCa] 0001 leave ( 3)[Re] Step into hits by line at 2 Step over hits by return at 3 ``` In ruby 3.2.0-preview2 - not so much. Output: ``` == disasm: # (catch: false) 0000 putobject_INT2FIX_1_ ( 2)[LiCa] 0001 leave ( 3)[Re] Step into hits by line at 2 Step over hits by line at 2 Step over hits by return at 3 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: