Class: Debugger::Breakpoint

Inherits:
Object
  • Object
show all
Defined in:
ext/ruby_debug/breakpoint.c

Instance Method Summary collapse

Instance Method Details

#enabled=(bool) ⇒ Object

Enables or disables breakpoint.



318
319
320
321
322
323
324
325
# File 'ext/ruby_debug/breakpoint.c', line 318

static VALUE
breakpoint_set_enabled(VALUE self, VALUE bool)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return breakpoint->enabled = bool;
}

#enabled?Boolean

Returns whether breakpoint is enabled or not.

Returns:

  • (Boolean)


303
304
305
306
307
308
309
310
# File 'ext/ruby_debug/breakpoint.c', line 303

static VALUE
breakpoint_enabled(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return breakpoint->enabled;
}

#exprString

Returns a codition expression when this breakpoint should be activated.

Returns:

  • (String)


403
404
405
406
407
408
409
410
# File 'ext/ruby_debug/breakpoint.c', line 403

static VALUE
breakpoint_expr(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return breakpoint->expr;
}

#expr=(string) ⇒ Object

Sets the codition expression when this breakpoint should be activated.



418
419
420
421
422
423
424
425
426
# File 'ext/ruby_debug/breakpoint.c', line 418

static VALUE
breakpoint_set_expr(VALUE self, VALUE expr)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    breakpoint->expr = NIL_P(expr) ? expr: StringValue(expr);
    return expr;
}

#hit_conditionObject

Returns the hit condition of the breakpoint:

nil if it is an unconditional breakpoint, or :greater_or_equal, :equal, :modulo



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'ext/ruby_debug/breakpoint.c', line 498

static VALUE
breakpoint_hit_condition(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    switch(breakpoint->hit_condition)
    {
        case HIT_COND_GE:
            return ID2SYM(rb_intern("greater_or_equal"));
        case HIT_COND_EQ:
            return ID2SYM(rb_intern("equal"));
        case HIT_COND_MOD:
            return ID2SYM(rb_intern("modulo"));
        case HIT_COND_NONE:
        default:
            return Qnil;
    }
}

#hit_condition=(symbol) ⇒ Object

Sets the hit condition of the breakpoint which must be one of the following values:

nil if it is an unconditional breakpoint, or :greater_or_equal(:ge), :equal(:eq), :modulo(:mod)



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
# File 'ext/ruby_debug/breakpoint.c', line 527

static VALUE
breakpoint_set_hit_condition(VALUE self, VALUE value)
{
    debug_breakpoint_t *breakpoint;
    ID id_value;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    id_value = rb_to_id(value);

    if(rb_intern("greater_or_equal") == id_value || rb_intern("ge") == id_value)
        breakpoint->hit_condition = HIT_COND_GE;
    else if(rb_intern("equal") == id_value || rb_intern("eq") == id_value)
        breakpoint->hit_condition = HIT_COND_EQ;
    else if(rb_intern("modulo") == id_value || rb_intern("mod") == id_value)
        breakpoint->hit_condition = HIT_COND_MOD;
    else
        rb_raise(rb_eArgError, "Invalid condition parameter");
    return value;
}

#hit_countInteger

Returns the hit count of the breakpoint.

Returns:

  • (Integer)


449
450
451
452
453
454
455
456
# File 'ext/ruby_debug/breakpoint.c', line 449

static VALUE
breakpoint_hit_count(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return INT2FIX(breakpoint->hit_count);
}

#hit_valueInteger

Returns the hit value of the breakpoint.

Returns:

  • (Integer)


464
465
466
467
468
469
470
471
# File 'ext/ruby_debug/breakpoint.c', line 464

static VALUE
breakpoint_hit_value(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return INT2FIX(breakpoint->hit_value);
}

#hit_value=(int) ⇒ Object

Sets the hit value of the breakpoint.



479
480
481
482
483
484
485
486
487
# File 'ext/ruby_debug/breakpoint.c', line 479

static VALUE
breakpoint_set_hit_value(VALUE self, VALUE value)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    breakpoint->hit_value = FIX2INT(value);
    return value;
}

#idInteger

Returns id of the breakpoint.

Returns:

  • (Integer)


434
435
436
437
438
439
440
441
# File 'ext/ruby_debug/breakpoint.c', line 434

static VALUE
breakpoint_id(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return INT2FIX(breakpoint->id);
}

#posString, Integer

Returns the position of this breakpoint.

Returns:

  • (String, Integer)


364
365
366
367
368
369
370
371
372
373
374
# File 'ext/ruby_debug/breakpoint.c', line 364

static VALUE
breakpoint_pos(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    if(breakpoint->type == BP_METHOD_TYPE)
        return rb_str_new2(rb_id2name(breakpoint->pos.mid));
    else
        return INT2FIX(breakpoint->pos.line);
}

#pos=(string) ⇒ Object

Sets the position of this breakpoint.



382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'ext/ruby_debug/breakpoint.c', line 382

static VALUE
breakpoint_set_pos(VALUE self, VALUE value)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    if(breakpoint->type == BP_METHOD_TYPE)
    {
        breakpoint->pos.mid = rb_to_id(StringValue(value));
    }
    else
        breakpoint->pos.line = FIX2INT(value);
    return value;
}

#sourceString

Returns a source of the breakpoint.

Returns:

  • (String)


333
334
335
336
337
338
339
340
# File 'ext/ruby_debug/breakpoint.c', line 333

static VALUE
breakpoint_source(VALUE self)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    return breakpoint->source;
}

#source=(string) ⇒ Object

Sets the source of the breakpoint.



348
349
350
351
352
353
354
355
356
# File 'ext/ruby_debug/breakpoint.c', line 348

static VALUE
breakpoint_set_source(VALUE self, VALUE value)
{
    debug_breakpoint_t *breakpoint;

    Data_Get_Struct(self, debug_breakpoint_t, breakpoint);
    breakpoint->source = StringValue(value);
    return value;
}