Class: Debugger::Breakpoint

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

Instance Method Summary collapse

Instance Method Details

#enabled=(bool) ⇒ Object

Enables or disables breakpoint.



322
323
324
325
326
327
328
329
# File 'ext/breakpoint.c', line 322

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)


307
308
309
310
311
312
313
314
# File 'ext/breakpoint.c', line 307

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)


407
408
409
410
411
412
413
414
# File 'ext/breakpoint.c', line 407

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.



422
423
424
425
426
427
428
429
430
# File 'ext/breakpoint.c', line 422

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



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'ext/breakpoint.c', line 502

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)



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'ext/breakpoint.c', line 531

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)


453
454
455
456
457
458
459
460
# File 'ext/breakpoint.c', line 453

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)


468
469
470
471
472
473
474
475
# File 'ext/breakpoint.c', line 468

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.



483
484
485
486
487
488
489
490
491
# File 'ext/breakpoint.c', line 483

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)


438
439
440
441
442
443
444
445
# File 'ext/breakpoint.c', line 438

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)


368
369
370
371
372
373
374
375
376
377
378
# File 'ext/breakpoint.c', line 368

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.



386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'ext/breakpoint.c', line 386

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)


337
338
339
340
341
342
343
344
# File 'ext/breakpoint.c', line 337

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.



352
353
354
355
356
357
358
359
360
# File 'ext/breakpoint.c', line 352

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;
}