Module: Kernel
- Defined in:
- lib/byebug.rb
Overview
XXX: Implement # # Wraps the meth
method with Byebug.post_mortem … block. # def post_mortem_method(meth)
old_meth = "__postmortem_#{meth}"
old_meth = "#{$1}_set" if old_meth =~ /^(.+)=$/
alias_method old_meth.to_sym, meth
class_eval <<-EOD
def #{meth}(*args, &block)
Byebug.start do |dbg|
dbg.post_mortem do
#{old_meth}(*args, &block)
end
end
end
EOD
end
Instance Method Summary collapse
-
#binding_n(n = 0) ⇒ Object
Returns a binding of n-th call frame.
-
#byebug(steps = 1) ⇒ Object
(also: #breakpoint)
Enters byebug 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
395 396 397 398 399 |
# File 'lib/byebug.rb', line 395 def binding_n(n = 0) Byebug.skip do Byebug.current_context.frame_binding(n+1) end end |
#byebug(steps = 1) ⇒ Object Also known as: breakpoint
Enters byebug in the current thread after steps line events occur.
Before entering byebug startup, the init script is read. Setting steps to 0 will cause a break in byebug’s subroutine and not wait for a line event to occur. You will have to go “up 1” in order to be back to your debugged program from byebug. Setting steps to 0 could be useful if you want to stop right after the last statement in some scope, because the next step will take you out of some scope.
381 382 383 384 385 386 387 388 389 |
# File 'lib/byebug.rb', line 381 def byebug(steps = 1) Byebug.start Byebug.run_init_script(StringIO.new) if 0 == steps Byebug.current_context.stop_frame = 0 else Byebug.current_context.stop_next = steps end end |