Open 0x2c7 opened 4 years ago
Updated: after trying to debug, I found out that TracePoint API doesn't trigger return event after return from <internal:*>
. In other cases, when openning a new control frame, there is always a pair of call
and return
events from Tracepoint. However, in the case of <internal:*>
, the return event is missing. It makes Byebug fails to call RETURN_EVENT_SETUP
correctly, and leads to dc->calced_stack_size
is out-synced with the real stack size. Eventually, byebug fails to reach the next destination, and exits the program.
Update: Ruby trunk already has a fix for this issue. It is fixed in this commit: https://github.com/ruby/ruby/commit/3e02cd518fbe4d91c2aca7fbc3c5aafa387d3cb7. However, the next ruby release in trunk is now 3.0.0. I'll create a ticket in Ruby issue to ask for a backport instead.
Update:
Let's wait for Ruby 2.7.2 :smile:
Problem description
Since Ruby 2.7.0,
next
command doesn't stop in many cases, when calling some standard lib's methods.Example:
When running the above file, and type
next
, the program doesn't stop at the second method call. Instead, it continues til the end. When adding a tracepoint hook, I found out that in Ruby 2.7.0+ adds some weird events<internal:*>
, such as<internal:gc>
,<internal:pack>
, etc.The above sample code returns:
Similarly when running the test example with
GC#start
When running again with methods in the same file that don't trigger
<internal*>
events, such asSecureRandom.uuid
,next
command works perfectly. So, I suspect the new<internal:*>
event in tracepoint API breaks byebug. I'm debugging deep into C layer, but haven't found anything interesting yet.