Module: Byebug
- Defined in:
- ext/byebug/byebug.c
Defined Under Namespace
Classes: Breakpoint
Class Method Summary collapse
- ._start ⇒ Object
- .add_catchpoint(value) ⇒ Object
- .breakpoints ⇒ Object
- .catchpoints ⇒ Object
- .context ⇒ Object
- .debug_at_exit ⇒ Object
- .debug_load(*args) ⇒ Object
- .post_mortem=(value) ⇒ Object
- .post_mortem? ⇒ Boolean
- .remove_tracepoints ⇒ Object
- .setup_tracepoints ⇒ Object
- .started? ⇒ Boolean
- .tracing=(value) ⇒ Object
- .tracing? ⇒ Boolean
Class Method Details
._start ⇒ Object
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'ext/byebug/byebug.c', line 382
static VALUE
Byebug_start(VALUE self)
{
VALUE result;
if (BYEBUG_STARTED)
result = Qfalse;
else
{
Byebug_setup_tracepoints(self);
result = Qtrue;
}
if (rb_block_given_p())
rb_ensure(rb_yield, self, Byebug_stop, self);
return result;
}
|
.add_catchpoint(value) ⇒ Object
521 522 523 524 525 526 527 528 529 |
# File 'ext/byebug/byebug.c', line 521
static VALUE
Byebug_add_catchpoint(VALUE self, VALUE value)
{
if (TYPE(value) != T_STRING)
rb_raise(rb_eTypeError, "value of a catchpoint must be String");
rb_hash_aset(catchpoints, rb_str_dup(value), INT2FIX(0));
return value;
}
|
.breakpoints ⇒ Object
507 508 509 510 511 |
# File 'ext/byebug/byebug.c', line 507
static VALUE
Byebug_breakpoints(VALUE self)
{
return breakpoints;
}
|
.catchpoints ⇒ Object
513 514 515 516 517 518 519 |
# File 'ext/byebug/byebug.c', line 513
static VALUE
Byebug_catchpoints(VALUE self)
{
if (catchpoints == Qnil)
rb_raise(rb_eRuntimeError, "Byebug.start is not called yet.");
return catchpoints;
}
|
.context ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'ext/byebug/byebug.c', line 54
static VALUE
Byebug_context(VALUE self)
{
if (context == Qnil) {
context = Context_create();
}
return context;
}
|
.debug_at_exit ⇒ Object
471 472 473 474 475 476 477 478 479 |
# File 'ext/byebug/byebug.c', line 471
static VALUE
Byebug_at_exit(VALUE self)
{
VALUE proc;
if (!rb_block_given_p()) rb_raise(rb_eArgError, "called without a block");
proc = rb_block_proc();
rb_set_end_proc(debug_at_exit_i, proc);
return proc;
}
|
.debug_load(*args) ⇒ Object
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'ext/byebug/byebug.c', line 416
static VALUE
Byebug_load(int argc, VALUE *argv, VALUE self)
{
VALUE file, stop, context_obj;
debug_context_t *context;
int state = 0;
if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
{
stop = Qfalse;
}
Byebug_start(self);
context_obj = Byebug_context(self);
Data_Get_Struct(context_obj, debug_context_t, context);
context->stack_size = 0;
if (RTEST(stop)) context->steps = 1;
/* Initializing $0 to the script's path */
ruby_script(RSTRING_PTR(file));
rb_load_protect(file, 0, &state);
if (0 != state)
{
VALUE errinfo = rb_errinfo();
reset_stepping_stop_points(context);
rb_set_errinfo(Qnil);
return errinfo;
}
/* We should run all at_exit handler's in order to provide, for instance, a
* chance to run all defined test cases */
rb_exec_end_proc();
return Qnil;
}
|
.post_mortem=(value) ⇒ Object
500 501 502 503 504 505 |
# File 'ext/byebug/byebug.c', line 500
static VALUE
Byebug_set_post_mortem(VALUE self, VALUE value)
{
post_mortem = RTEST(value) ? Qtrue : Qfalse;
return value;
}
|
.post_mortem? ⇒ Boolean
494 495 496 497 498 |
# File 'ext/byebug/byebug.c', line 494
static VALUE
Byebug_post_mortem(VALUE self)
{
return post_mortem;
}
|
.remove_tracepoints ⇒ Object
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'ext/byebug/byebug.c', line 330
static VALUE
Byebug_remove_tracepoints(VALUE self)
{
context = Qnil;
breakpoints = Qnil;
catchpoints = Qnil;
if (tpLine != Qnil) {
rb_tracepoint_disable(tpLine);
tpLine = Qnil;
}
if (tpCall != Qnil) {
rb_tracepoint_disable(tpCall);
tpCall = Qnil;
}
if (tpCCall != Qnil) {
rb_tracepoint_disable(tpCCall);
tpCCall = Qnil;
}
if (tpReturn != Qnil) {
rb_tracepoint_disable(tpReturn);
tpReturn = Qnil;
}
if (tpCReturn != Qnil) {
rb_tracepoint_disable(tpCReturn);
tpCReturn = Qnil;
}
if (tpRaise != Qnil) {
rb_tracepoint_disable(tpRaise);
tpRaise = Qnil;
}
return Qnil;
}
|
.setup_tracepoints ⇒ Object
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'ext/byebug/byebug.c', line 288
static VALUE
Byebug_setup_tracepoints(VALUE self)
{
if (catchpoints != Qnil) return Qnil;
breakpoints = rb_ary_new();
catchpoints = rb_hash_new();
tpLine = rb_tracepoint_new(Qnil,
RUBY_EVENT_LINE,
process_line_event, NULL);
tpCall = rb_tracepoint_new(Qnil,
RUBY_EVENT_CALL | RUBY_EVENT_B_CALL | RUBY_EVENT_CLASS,
process_call_event, NULL);
tpCCall = rb_tracepoint_new(Qnil,
RUBY_EVENT_C_CALL,
process_c_call_event, NULL);
tpReturn = rb_tracepoint_new(Qnil,
RUBY_EVENT_RETURN | RUBY_EVENT_B_RETURN | RUBY_EVENT_END,
process_return_event, NULL);
tpCReturn = rb_tracepoint_new(Qnil,
RUBY_EVENT_C_RETURN,
process_c_return_event, NULL);
tpRaise = rb_tracepoint_new(Qnil,
RUBY_EVENT_RAISE,
process_raise_event, NULL);
rb_tracepoint_enable(tpLine);
rb_tracepoint_enable(tpCall);
rb_tracepoint_enable(tpCCall);
rb_tracepoint_enable(tpReturn);
rb_tracepoint_enable(tpCReturn);
rb_tracepoint_enable(tpRaise);
return Qnil;
}
|
.started? ⇒ Boolean
365 366 367 368 369 |
# File 'ext/byebug/byebug.c', line 365
static VALUE
Byebug_started(VALUE self)
{
return BYEBUG_STARTED;
}
|
.tracing=(value) ⇒ Object
487 488 489 490 491 492 |
# File 'ext/byebug/byebug.c', line 487
static VALUE
Byebug_set_tracing(VALUE self, VALUE value)
{
tracing = RTEST(value) ? Qtrue : Qfalse;
return value;
}
|
.tracing? ⇒ Boolean
481 482 483 484 485 |
# File 'ext/byebug/byebug.c', line 481
static VALUE
Byebug_tracing(VALUE self)
{
return tracing;
}
|