Actions
Bug #8886
closedTracePoint API inconsistence when raise used
Bug #8886:
TracePoint API inconsistence when raise used
Description
=begin
When raise command is used, the TracePoint API triggers the following events in the following order
But what ruby actually does is
1. Push frame into the stack when calling the `raise` c method.
2. Pop frame from the stack
3. And after popping the frame, raise the exception.
As you can see, 2 and 3 are reversed and this messes up byebug and (I guess) other users of the API.
To illustrate I use a similar program as I used in (invalid) #8538
Actual output
c_return :trace
line nil
c_call :raise
c_call :new
c_call :initialize
c_return :initialize
c_return :new
c_call :backtrace
c_return :backtrace
raise nil
c_return :raise
test_bug.rb:4:in `<main>': bang (RuntimeError)
Expected output
c_return :trace
line nil
c_call :raise
c_call :new
c_call :initialize
c_return :initialize
c_return :new
c_return :raise
c_call :backtrace
c_return :backtrace
raise nil
test_bug.rb:4:in `<main>': bang (RuntimeError)
I've made a patch that solves the issue and, as a result, the problems byebug is having. Please review and excuse me if I'm not being able to properly explain myself.
Thanks a lot!
=end
Files
Actions