Skip to content

Instantly share code, notes, and snippets.

@pd
Created December 16, 2014 04:51
Show Gist options
  • Save pd/5b23e26dd5958bba8f02 to your computer and use it in GitHub Desktop.
Save pd/5b23e26dd5958bba8f02 to your computer and use it in GitHub Desktop.
rubinius-debugger deferred breakpoints patch
class A
def hi
'hi'
end
def many(n)
1.upto(n) do |i|
puts "hi #{i}"
end
end
end
A.new.many(3)
A.new.many(5)
rubinius-debugger(rbx-2.4.1) $ rbx -Xdebug ./dbg.rb
| Breakpoint: Rubinius::Loader#debugger at kernel/loader.rb:561 (50)
| 561: Rubinius::Debugger.start
debug> b A#many
* Unable to find class/module: A
| Would you like to defer this breakpoint to later? [y/n] y
| Deferred breakpoint created.
debug> i bp
==== Breakpoints ====
| 1: A#many - unknown location (deferred)
Error in debugger
undefined method `has_commands?' on an instance of Rubinius::Debugger::DeferredBreakPoint. (NoMethodError)
debug> cond 1 n == 5
Error in debugger
undefined method `set_condition' on an instance of Rubinius::Debugger::DeferredBreakPoint. (NoMethodError)
debug> c
| Resolved breakpoint for A#many
| Set breakpoint 2: ./dbg.rb:7 (+0)
rubinius-debugger(rbx-2.4.1) $ rbx -Xdebug -Ilib ./dbg.rb
| Breakpoint: Rubinius::Loader#debugger at kernel/loader.rb:561 (50)
| 561: Rubinius::Debugger.start
debug> b A#many
* Unable to find class/module: A
| Would you like to defer this breakpoint to later? [y/n] y
| Deferred breakpoint created.
debug> cond 1 n == 5
debug> commands 1
Type commands for breakpoint #1, one per line.
End with a line saying just 'END'.
> p n * -100
> END
debug> i bp
==== Breakpoints ====
| 1: A#many - unknown location (deferred)
| p n * -100
| stop only if n == 5
debug> c
| Resolved breakpoint for A#many
| Set breakpoint 1: ./dbg.rb:7 (+0)
hi 1
hi 2
hi 3
| Breakpoint: A#many(n) at ./dbg.rb:7 (0)
| 7: 1.upto(n) do |i|
-500
$d0 = -500
debug> i bp
==== Breakpoints ====
| 1: A#many - ./dbg.rb:7 (+0)
| p n * -100
| stop only if n == 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment