module Kernel

Public Instance Methods

binding_n(n = 0) click to toggle source

Returns a binding of n-th call frame

# File lib/ruby-debug-base.rb, line 253
def binding_n(n = 0)
  Debugger.skip do
    if RUBY_VERSION < "1.9"
      Debugger.current_context.frame_binding(n+2)
    else
      Debugger.current_context.frame_binding(n+1)
    end
  end
end
breakpoint(steps = 1) click to toggle source
Alias for: debugger
debugger(steps = 1) click to toggle source

Enters the debugger in the current thread after steps line events occur. Before entering the debugger startup script is read.

Setting steps to 0 will cause a break in the debugger subroutine and not wait for a line event to occur. You will have to go “up 1” in order to be back in your debugged program rather than the debugger. Settings steps to 0 could be useful you want to stop right after the last statement in some scope, because the next step will take you out of some scope.

# File lib/ruby-debug.rb, line 166
def debugger(steps = 1)
  Debugger.start
  Debugger.run_init_script(StringIO.new)
  if 0 == steps
    Debugger.current_context.stop_frame = 0
  else
    Debugger.current_context.stop_next = steps
  end
end
Also aliased as: breakpoint, breakpoint