Use rb_debug_inspector_frame_loc_get if any#1139
Conversation
The debug gem can abort when stepping into a rescue clause:
```
$ ruby -Ilib exe/rdbg rescue-test.rb
[1, 7] in rescue-test.rb
=> 1| 1.times do
2| begin
3| raise
4| rescue
5| p 1
6| end
7| end
=>#0 <main> at rescue-test.rb:1
(rdbg) s # step command
[1, 7] in rescue-test.rb
1| 1.times do
2| begin
=> 3| raise
4| rescue
5| p 1
6| end
7| end
=>#0 block in <main> at rescue-test.rb:3
ruby#1 Integer#times at <internal:numeric>:257
# and 1 frames (use `bt' command for all frames)
(rdbg) s # step command
/home/mame/work/debug/lib/debug/thread_client.rb:85:in 'DEBUGGER__::ThreadClient#default_frame_formatter': undefined method '+' for nil (NoMethodError)
"#{colorize_blue("block")}#{args_str} in #{colorize_blue(block_loc + level)}"
^
from /home/mame/work/debug/lib/debug/thread_client.rb:755:in 'Method#call'
from /home/mame/work/debug/lib/debug/thread_client.rb:755:in 'DEBUGGER__::ThreadClient#frame_str'
from /home/mame/work/debug/lib/debug/thread_client.rb:742:in 'block in DEBUGGER__::ThreadClient#show_frames'
from <internal:numeric>:257:in 'Integer#times'
from /home/mame/work/debug/lib/debug/thread_client.rb:739:in 'DEBUGGER__::ThreadClient#show_frames'
from /home/mame/work/debug/lib/debug/thread_client.rb:304:in 'DEBUGGER__::ThreadClient#suspend'
from /home/mame/work/debug/lib/debug/thread_client.rb:358:in 'block in DEBUGGER__::ThreadClient#step_tp'
from rescue-test.rb:5:in 'block in <main>'
from <internal:numeric>:257:in 'Integer#times'
from rescue-test.rb:1:in '<main>'
rescue-test.rb:3:in 'block in <main>': unhandled exception
from <internal:numeric>:257:in 'Integer#times'
from rescue-test.rb:1:in '<main>'
```
This is caused by the design issue of the debug inspector API.
See ruby/ruby#13508
This changeset fixes the issue by using a newly-introduced debug
inspector API, namely `rb_debug_inspector_frame_loc_get`.
❌ Tests Failed✖️369 tests failed ✔️8 tests passed 23/27 test sessions failed❌ Test session #4414554 failed ❌ Test session #4414556 failed ❌ Test session #4414559 failed ❌ Test session #4414561 failed ❌ Test session #4414562 failed ❌ Test session #4414563 failed ❌ Test session #4414564 failed ❌ Test session #4414565 failed ❌ Test session #4414566 failed ❌ Test session #4414567 failed ❌ Test session #4414568 failed ❌ Test session #4414569 failed ❌ Test session #4414570 failed ❌ Test session #4414571 failed ❌ Test session #4414576 failed ❌ Test session #4414577 failed ❌ Test session #4414578 failed ❌ Test session #4414581 failed ❌ Test session #4414583 failed ❌ Test session #4414584 failed ❌ Test session #4414585 failed ❌ Test session #4414586 failed ❌ Test session #4414609 failed |
| debug_code program, remote: false do | ||
| type 'b 3' | ||
| type 'c' | ||
| assert_line_num 2 |
There was a problem hiding this comment.
Ruby spoofs the location of the C frame to the location of the caller. But rb_debug_inspector_frame_loc_get does not do this spoofing, so the location of Process#kill is not sigint-test.rb:2 but #<none>:0.
$ ruby -Ilib exe/rdbg sigint-test.rb
[1, 3] in sigint-test.rb
=> 1| trap('SIGINT'){ puts "SIGINT" }
2| Process.kill('SIGINT', Process.pid)
3| p :ok
=>#0 <main> at sigint-test.rb:1
(rdbg) c # continue command
# No sourcefile available for
=>#0 [C] Process.kill at #<none>:0
#1 <main> at sigint-test.rb:2
Stop by SIGINT
#<Proc:0x00007950068cd4b0 sigint-test.rb:1> is registered as SIGINT handler.
`sigint` command execute it.
(rdbg)
This change reflects that.
|
superseded by #1142 |
The debug gem can abort when stepping into a rescue clause:
This is caused by the design issue of the debug inspector API. See ruby/ruby#13508
This changeset fixes the issue by using a newly-introduced debug inspector API, namely
rb_debug_inspector_frame_loc_get.