Method: Debugger.start_

Defined in:
ext/ruby_debug/ruby_debug.c

.start_Boolean .start_ { ... } ⇒ Boolean

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.

Overloads:

  • .start_Boolean

    Returns:

    • (Boolean)
  • .start_ { ... } ⇒ Boolean

    Yields:

    Returns:

    • (Boolean)


1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
# File 'ext/ruby_debug/ruby_debug.c', line 1136

static VALUE
debug_start(VALUE self)
{
    VALUE result;
    start_count++;

    if(IS_STARTED)
        result = Qfalse;
    else
    {
        locker             = Qnil;
        rdebug_breakpoints = rb_ary_new();
        rdebug_catchpoints = rb_hash_new();
        rdebug_threads_tbl = threads_table_create();

        rb_add_event_hook(debug_event_hook, RUBY_EVENT_ALL, Qnil);
        result = Qtrue;
    }

    if(rb_block_given_p()) 
      rb_ensure(rb_yield, self, debug_stop_i, self);

    return result;
}