From: ko1@... Date: 2015-02-23T10:06:24+00:00 Subject: [ruby-core:68244] [Ruby trunk - Feature #10844] [Feedback] TracePoint API needs an event to inform about creating/removing a new frame without calling something Issue #10844 has been updated by Koichi Sasada. Status changed from Open to Feedback Assignee set to Koichi Sasada I want to reject this proposal because: (1) ensure clause can be executed without pushing frame begin # no exception ensure puts "ensure" end The line [puts "ensure"] is called without pushing new frame. (2) performance down Inserting hook points slows down execution speed even if it is enabled. We need to be careful for that. > It is important to known about such situations to correctly implement stepping in debugger. Maybe we can provide another way. For example, line events also help with current implementation. ---------------------------------------- Feature #10844: TracePoint API needs an event to inform about creating/removing a new frame without calling something https://bugs.ruby-lang.org/issues/10844#change-51605 * Author: Oleg Sukhodolsky * Status: Feedback * Priority: Normal * Assignee: Koichi Sasada ---------------------------------------- There are some situations when Ruby VM creates a new frame even if there is no calls E.g. ensure create a new block. Here is a simple program which shows that the frame is added but no event is reported. It is important to known about such situations to correctly implement stepping in debugger. It would be nice if the api reports about such situations with something like :start_frame/:end events. What do you think? ~~~ruby def actual_stack_size(frames_to_skip=3) bt = Thread.current.backtrace_locations(frames_to_skip) bt.size end TracePoint.new do |tp| printf "%8s %s:%-2d %13s %d\n", tp.event, tp.path, tp.lineno, tp.method_id, actual_stack_size end.enable begin raise rescue 'error' end 1 ~~~ ~~~ruby c_return ruby/debugger/ruby-16236.rb:7 enable 1 line ruby/debugger/ruby-16236.rb:9 1 line ruby/debugger/ruby-16236.rb:10 1 c_call ruby/debugger/ruby-16236.rb:10 raise 1 c_return ruby/debugger/ruby-16236.rb:10 raise 1 c_call ruby/debugger/ruby-16236.rb:10 new 1 c_call ruby/debugger/ruby-16236.rb:10 initialize 2 c_return ruby/debugger/ruby-16236.rb:10 initialize 2 c_return ruby/debugger/ruby-16236.rb:10 new 1 c_call ruby/debugger/ruby-16236.rb:10 backtrace 1 c_return ruby/debugger/ruby-16236.rb:10 backtrace 1 raise ruby/debugger/ruby-16236.rb:10 1 c_call ruby/debugger/ruby-16236.rb:12 === 2 c_return ruby/debugger/ruby-16236.rb:12 === 2 line ruby/debugger/ruby-16236.rb:12 2 line ruby/debugger/ruby-16236.rb:14 1 ~~~ -- https://bugs.ruby-lang.org/