Class: Byebug::Breakpoint
- Inherits:
-
Object
- Object
- Byebug::Breakpoint
- Defined in:
- ext/byebug/breakpoint.c
Class Method Summary collapse
Instance Method Summary collapse
- #enabled=(bool) ⇒ Object
- #enabled? ⇒ Boolean
- #expr ⇒ Object
- #expr=(expr) ⇒ Object
- #hit_condition ⇒ Object
- #hit_condition=(value) ⇒ Object
- #hit_count ⇒ Object
- #hit_value ⇒ Object
- #hit_value=(value) ⇒ Object
- #id ⇒ Object
- #initialize(source, pos, expr) ⇒ Object constructor
- #pos ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(source, pos, expr) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'ext/byebug/breakpoint.c', line 108
static VALUE
Breakpoint_initialize(VALUE self, VALUE source, VALUE pos, VALUE expr)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
breakpoint->type = FIXNUM_P(pos) ? BP_POS_TYPE : BP_METHOD_TYPE;
if(breakpoint->type == BP_POS_TYPE)
breakpoint->pos.line = FIX2INT(pos);
else
breakpoint->pos.mid = SYM2ID(pos);
breakpoint->id = ++breakpoint_max;
breakpoint->source = StringValue(source);
breakpoint->enabled = Qtrue;
breakpoint->expr = NIL_P(expr) ? expr : StringValue(expr);
breakpoint->hit_count = 0;
breakpoint->hit_value = 0;
breakpoint->hit_condition = HIT_COND_NONE;
return Qnil;
}
|
Class Method Details
.remove(breakpoints, id_value) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'ext/byebug/breakpoint.c', line 132
static VALUE
Breakpoint_remove(VALUE self, VALUE breakpoints, VALUE id_value)
{
int i;
int id;
VALUE breakpoint_object;
breakpoint_t *breakpoint;
if (breakpoints == Qnil) return Qnil;
id = FIX2INT(id_value);
for(i = 0; i < RARRAY_LEN(breakpoints); i++)
{
breakpoint_object = rb_ary_entry(breakpoints, i);
Data_Get_Struct(breakpoint_object, breakpoint_t, breakpoint);
if(breakpoint->id == id)
{
rb_ary_delete_at(breakpoints, i);
return breakpoint_object;
}
}
return Qnil;
}
|
Instance Method Details
#enabled=(bool) ⇒ Object
216 217 218 219 220 221 222 223 |
# File 'ext/byebug/breakpoint.c', line 216
static VALUE
Breakpoint_set_enabled(VALUE self, VALUE bool)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return breakpoint->enabled = bool;
}
|
#enabled? ⇒ Boolean
207 208 209 210 211 212 213 214 |
# File 'ext/byebug/breakpoint.c', line 207
static VALUE
Breakpoint_enabled(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return breakpoint->enabled;
}
|
#expr ⇒ Object
188 189 190 191 192 193 194 195 |
# File 'ext/byebug/breakpoint.c', line 188
static VALUE
Breakpoint_expr(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return breakpoint->expr;
}
|
#expr=(expr) ⇒ Object
197 198 199 200 201 202 203 204 205 |
# File 'ext/byebug/breakpoint.c', line 197
static VALUE
Breakpoint_set_expr(VALUE self, VALUE expr)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
breakpoint->expr = NIL_P(expr) ? expr: StringValue(expr);
return expr;
}
|
#hit_condition ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'ext/byebug/breakpoint.c', line 53
static VALUE
Breakpoint_hit_condition(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, 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=(value) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'ext/byebug/breakpoint.c', line 73
static VALUE
Breakpoint_set_hit_condition(VALUE self, VALUE value)
{
breakpoint_t *breakpoint;
ID id_value;
Data_Get_Struct(self, 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_count ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'ext/byebug/breakpoint.c', line 24
static VALUE
Breakpoint_hit_count(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return INT2FIX(breakpoint->hit_count);
}
|
#hit_value ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'ext/byebug/breakpoint.c', line 34
static VALUE
Breakpoint_hit_value(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return INT2FIX(breakpoint->hit_value);
}
|
#hit_value=(value) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'ext/byebug/breakpoint.c', line 43
static VALUE
Breakpoint_set_hit_value(VALUE self, VALUE value)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
breakpoint->hit_value = FIX2INT(value);
return value;
}
|
#id ⇒ Object
157 158 159 160 161 162 163 164 |
# File 'ext/byebug/breakpoint.c', line 157
static VALUE
Breakpoint_id(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return INT2FIX(breakpoint->id);
}
|
#pos ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 |
# File 'ext/byebug/breakpoint.c', line 175
static VALUE
Breakpoint_pos(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
if (breakpoint->type == BP_METHOD_TYPE)
return rb_str_new2(rb_id2name(breakpoint->pos.mid));
else
return INT2FIX(breakpoint->pos.line);
}
|
#source ⇒ Object
166 167 168 169 170 171 172 173 |
# File 'ext/byebug/breakpoint.c', line 166
static VALUE
Breakpoint_source(VALUE self)
{
breakpoint_t *breakpoint;
Data_Get_Struct(self, breakpoint_t, breakpoint);
return breakpoint->source;
}
|