debug: `next` stops in the wrong place when blocks are called
Your environment
ruby -v: 2.7.2p137rdbg -v: 1.6.2
To Reproduce For a simple case:
- Create a file like:
def with_block
yield
end
with_block do
1
end
puts("`next` should stop here")
- Add a breakpoint in line 5
- Try to move to
next - See the debugger stop at line 6 (and then 7, and 3)
For more complex cases:
- Create a file like:
class Bar
define_method("dynamic") do
true
end
def regular; false; end
end
def foo(a, b, c); end
bar = Bar.new
foo(
bar.regular,
bar.dynamic, # `next` stops here
bar.regular
)
puts("`next` should stop here")
- Add a breakpoint in line 12 (where the call to
foois) - Try to move to
next - See the debugger stop at line 14
Expected behavior The debugger should stop at line 8 in the simple example, and 17 in the complex one
Additional context
I included non-dynamically-defined methods, to show that next only behaves incorrectly for the dynamically-defined ones (as it doesn’t stop at line 13 nor 15)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (11 by maintainers)
cc @WillHalto. Just a heads up that https://github.com/ruby/debug/pull/743 doesn’t seem to make this worse, but given that you are already there and have some context, you might find it interesting.