Module: Kernel
- Defined in:
- lib/ruby-debug-base.rb
Instance Method Summary collapse
-
#binding_n(n = 0) ⇒ Object
Returns a binding of n-th call frame.
-
#debugger(steps = 1, &block) ⇒ Object
(also: #breakpoint)
Enters the debugger in the current thread after steps line events occur.
Instance Method Details
#binding_n(n = 0) ⇒ Object
Returns a binding of n-th call frame
241 242 243 244 245 |
# File 'lib/ruby-debug-base.rb', line 241 def binding_n(n = 0) Debugger.skip do Debugger.current_context.frame_binding(n+2) end end |
#debugger(steps = 1, &block) ⇒ Object Also known as: breakpoint
Enters the debugger in the current thread after steps line events occur. Before entering the debugger, a user-defined startup script is may be 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.
If block block is given (and the debugger hasn’t been started, we run the block under the debugger.
FIXME: Alas, when a block is given, we can’t support running the startup script or support the steps option.
223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/ruby-debug-base.rb', line 223 def debugger(steps = 1, &block) if block Debugger.start({}, &block) else Debugger.start unless Debugger.started? Debugger.run_init_script(StringIO.new) if 0 == steps Debugger.current_context.stop_frame = 0 else Debugger.current_context.stop_next = steps end end end |