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
- .contexts ⇒ Object
- .current_context ⇒ Object
- .debug_load(*args) ⇒ Object
- .remove_tracepoints ⇒ Object
- .setup_tracepoints ⇒ Object
- .started? ⇒ Boolean
- .tracing ⇒ Object
- .tracing=(value) ⇒ Object
Class Method Details
._start ⇒ Object
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'ext/byebug/byebug.c', line 419
static VALUE
Byebug_start(VALUE self)
{
VALUE result;
if (Byebug_started(self))
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
518 519 520 521 522 523 524 525 526 |
# File 'ext/byebug/byebug.c', line 518
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
504 505 506 507 508 |
# File 'ext/byebug/byebug.c', line 504
static VALUE
Byebug_breakpoints(VALUE self)
{
return breakpoints;
}
|
.catchpoints ⇒ Object
510 511 512 513 514 515 516 |
# File 'ext/byebug/byebug.c', line 510
static VALUE
Byebug_catchpoints(VALUE self)
{
if (catchpoints == Qnil)
rb_raise(rb_eRuntimeError, "Byebug.start is not called yet.");
return catchpoints;
}
|
.contexts ⇒ Object
489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'ext/byebug/byebug.c', line 489
static VALUE
Byebug_contexts(VALUE self)
{
VALUE ary;
ary = rb_ary_new();
/* check that all contexts point to alive threads */
rb_hash_foreach(contexts, remove_dead_threads, 0);
rb_hash_foreach(contexts, values_i, ary);
return ary;
}
|
.current_context ⇒ Object
68 69 70 71 72 |
# File 'ext/byebug/byebug.c', line 68
static VALUE
Byebug_current_context(VALUE self)
{
return Byebug_thread_context(self, rb_thread_current());
}
|
.debug_load(*args) ⇒ Object
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'ext/byebug/byebug.c', line 438
static VALUE
Byebug_load(int argc, VALUE *argv, VALUE self)
{
VALUE file, stop, context_object;
debug_context_t *context;
int state = 0;
if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
{
stop = Qfalse;
}
Byebug_start(self);
context_object = Byebug_current_context(self);
Data_Get_Struct(context_object, debug_context_t, context);
context->stack_size = 0;
if (RTEST(stop)) context->stop_next = 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();
//debug_suspend(self);
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;
}
|
.remove_tracepoints ⇒ Object
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'ext/byebug/byebug.c', line 377
static VALUE
Byebug_remove_tracepoints(VALUE self)
{
contexts = Qnil;
breakpoints = Qnil;
catchpoints = Qnil;
if (tpLine != Qnil) rb_tracepoint_disable(tpLine);
tpLine = Qnil;
if (tpReturn != Qnil) rb_tracepoint_disable(tpReturn);
tpReturn = Qnil;
if (tpCall != Qnil) rb_tracepoint_disable(tpCall);
tpCall = Qnil;
if (tpRaise != Qnil) rb_tracepoint_disable(tpRaise);
tpRaise = Qnil;
return Qnil;
}
|
.setup_tracepoints ⇒ Object
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'ext/byebug/byebug.c', line 346
static VALUE
Byebug_setup_tracepoints(VALUE self)
{
if (catchpoints != Qnil) return Qnil;
contexts = rb_hash_new();
breakpoints = rb_ary_new();
catchpoints = rb_hash_new();
tpLine = rb_tracepoint_new(Qnil,
RUBY_EVENT_LINE,
process_line_event, NULL);
rb_tracepoint_enable(tpLine);
tpReturn = rb_tracepoint_new(Qnil,
RUBY_EVENT_RETURN | RUBY_EVENT_C_RETURN | RUBY_EVENT_B_RETURN | RUBY_EVENT_END,
process_return_event, NULL);
rb_tracepoint_enable(tpReturn);
tpCall = rb_tracepoint_new(Qnil,
RUBY_EVENT_CALL | RUBY_EVENT_C_CALL | RUBY_EVENT_B_CALL | RUBY_EVENT_CLASS,
process_call_event, NULL);
rb_tracepoint_enable(tpCall);
tpRaise = rb_tracepoint_new(Qnil,
RUBY_EVENT_RAISE, process_raise_event, NULL);
rb_tracepoint_enable(tpRaise);
return Qnil;
}
|
.started? ⇒ Boolean
402 403 404 405 406 |
# File 'ext/byebug/byebug.c', line 402
static VALUE
Byebug_started(VALUE self)
{
return catchpoints != Qnil ? Qtrue : Qfalse;
}
|
.tracing ⇒ Object
476 477 478 479 480 |
# File 'ext/byebug/byebug.c', line 476
static VALUE
Byebug_tracing(VALUE self)
{
return tracing;
}
|
.tracing=(value) ⇒ Object
482 483 484 485 486 487 |
# File 'ext/byebug/byebug.c', line 482
static VALUE
Byebug_set_tracing(VALUE self, VALUE value)
{
tracing = RTEST(value) ? Qtrue : Qfalse;
return value;
}
|