Module | Debugger |
In: |
lib/ruby-debug-base.rb
lib/ruby-debug-base/version.rb ext/ruby_debug.c |
Debugger is the module name space for ruby-debug.
DEFAULT_START_SETTINGS | = | { :init => true, # Set $0 and save ARGV? :post_mortem => false, # post-mortem debugging on uncaught exception? :tracing => nil | Default options to Debugger.start | |
VERSION | = | "0.10.5.rc1" |
handler | [RW] | interface modules provide handler object |
last_exception | [RW] | |
reload_source_on_change | [RW] | if true, checks the modification time of source files and reloads if it was modified |
Adds a new breakpoint. source is a name of a file or a class. pos is a line number or a method name if source is a class name. condition is a string which is evaluated to true when this breakpoint is activated.
Returns an Array of Breakpoint objects; all the breakpoints that have been created.
Returns a current catchpoints, which is a hash exception names that will trigger a debugger when raised. The values are the number of times taht catchpoint was hit, initially 0.
Returns current context. Note: Debugger.current_context.thread == Thread.current
Same as Kernel#load but resets current context‘s frames. stop parameter forces the debugger to stop at the first line of code in the file increment_start determines if start_count should be incremented. When
control threads are used, they have to be set up before loading the debugger; so here +increment_start+ will be false.
FOR INTERNAL USE ONLY.
Activates the post-mortem mode. There are two ways of using it:
By calling Debugger.post_mortem method without a block, you install at_exit hook that intercepts any unhandled by your script exceptions and enables post-mortem mode.
If you know that a particular block of code raises an exception you can enable post-mortem mode by wrapping this block with Debugger.post_mortem, e.g.
def offender raise 'error' end Debugger.post_mortem do ... offender ... end
This method is internal and activates the debugger. Use Debugger.start (from lib/ruby-debug-base.rb) instead.
The return value is the value of !Debugger.started? before issuing the start; That is, true is returned, unless debugger was previously started.
If a block is given, it starts debugger and yields to block. When the block is finished executing it stops the debugger with Debugger.stop method. Inside the block you will probably want to have a call to Debugger.debugger. For example:
Debugger.start{debugger; foo} # Stop inside of foo
Also, ruby-debug only allows one invocation of debugger at a time; nested Debugger.start‘s have no effect and you can‘t use this inside the debugger itself.
Note that if you want to completely remove the debugger hook, you must call Debugger.stop as many times as you called Debugger.start method.
This method disables the debugger. It returns true if the debugger is disabled, otherwise it returns false.
Note that if you want to complete remove the debugger hook, you must call Debugger.stop as many times as you called Debugger.start method.
Debugger.start(options) -> bool Debugger.start(options) { … } -> obj
If it‘s called without a block it returns true, unless debugger was already started. If a block is given, it starts debugger and yields to block. When the block is finished executing it stops the debugger with Debugger.stop method.
If a block is given, it starts debugger and yields to block. When the block is finished executing it stops the debugger with Debugger.stop method. Inside the block you will probably want to have a call to Debugger.debugger. For example:
Debugger.start{debugger; foo} # Stop inside of foo
Also, ruby-debug only allows one invocation of debugger at a time; nested Debugger.start‘s have no effect and you can‘t use this inside the debugger itself.
Note that if you want to stop debugger, you must call Debugger.stop as many time as you called Debugger.start method.
options is a hash used to set various debugging options. Set :init true if you want to save ARGV and some variables which make a debugger restart possible. Only the first time :init is set true will values get set. Since ARGV is saved, you should make sure it hasn‘t been changed before the (first) call. Set :post_mortem true if you want to enter post-mortem debugging on an uncaught exception. Once post-mortem debugging is set, it can‘t be unset.