Project

General

Profile

Bug #19003

Updated by hurricup (Alexandr Evstigneev) almost 2 years ago

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: #<ISeq:foo@/home/hurricup/Projects/ruby-debugger/jb-debase-30/test_sample.rb:1 (1,0)-(3,3)> (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: #<ISeq:foo@/home/hurricup/Projects/ruby-debugger/jb-debase-30/test_sample.rb:1 (1,0)-(3,3)> (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 
 ```

Back