ext/byebug/byebug.c in byebug-3.0.0 vs ext/byebug/byebug.c in byebug-3.1.0
- old
+ new
@@ -33,18 +33,19 @@
trace_print(rb_trace_arg_t *trace_arg, debug_context_t *dc)
{
if (trace_arg)
{
int i = 0;
- VALUE path = rb_tracearg_path(trace_arg);
- VALUE line = rb_tracearg_lineno(trace_arg);
- VALUE event = rb_tracearg_event(trace_arg);
- VALUE mid = rb_tracearg_method_id(trace_arg);
- for (i=0; i<dc->calced_stack_size; i++) putc('|', stderr);
- fprintf(stderr, "[#%d] %s@%s:%d %s\n", dc->thnum,
- rb_id2name(SYM2ID(event)), RSTRING_PTR(path), NUM2INT(line),
- NIL_P(mid) ? "" : rb_id2name(SYM2ID(mid)));
+ const char *event = rb_id2name(SYM2ID(rb_tracearg_event(trace_arg)));
+ char *path = RSTRING_PTR(rb_tracearg_path(trace_arg));
+ int line = NUM2INT(rb_tracearg_lineno(trace_arg));
+ VALUE v_mid = rb_tracearg_method_id(trace_arg);
+ const char *mid = NIL_P(v_mid) ? "" : rb_id2name(SYM2ID(v_mid));
+
+ for (i = 0; i < dc->calced_stack_size; i++) putc('-', stdout);
+ printf("(%d)->[#%d] %s@%s:%d %s\n",
+ dc->calced_stack_size, dc->thnum, event, path, line, mid);
}
}
static void
cleanup(debug_context_t *dc)
@@ -541,21 +542,21 @@
return Qtrue;
}
/*
* call-seq:
- * Byebug.start_ -> bool
- * Byebug.start_ { ... } -> bool
+ * Byebug.start -> bool
+ * Byebug.start { ... } -> bool
*
- * This method is internal and activates the debugger. Use Byebug.start (from
- * <tt>lib/byebug.rb</tt>) instead.
+ * If a block is given, it starts byebug and yields block. After the block is
+ * executed it stops byebug with Byebug.stop method. Inside the block you
+ * will probably want to have a call to Byebug.byebug. For example:
*
+ * Byebug.start { byebug; foo } # Stop inside of foo
+ *
* The return value is the value of !Byebug.started? <i>before</i> issuing the
* +start+; That is, +true+ is returned, unless byebug was previously started.
- *
- * If a block is given, it starts byebug and yields to block. When the block
- * is finished executing it stops the debugger with Byebug.stop method.
*/
static VALUE
bb_start(VALUE self)
{
VALUE result;
@@ -622,11 +623,11 @@
return status;
}
/*
* call-seq:
- * Byebug.verbose -> bool
+ * Byebug.verbose? -> bool
*
* Returns +true+ if verbose output of TracePoint API events is enabled.
*/
static VALUE
bb_verbose(VALUE self)
@@ -648,11 +649,11 @@
return value;
}
/*
* call-seq:
- * Byebug.tracing -> bool
+ * Byebug.tracing? -> bool
*
* Returns +true+ if global tracing is enabled.
*/
static VALUE
bb_tracing(VALUE self)
@@ -770,16 +771,16 @@
rb_define_module_function(mByebug, "current_context" , bb_current_context , 0);
rb_define_module_function(mByebug, "debug_load" , bb_load , -1);
rb_define_module_function(mByebug, "post_mortem?" , bb_post_mortem , 0);
rb_define_module_function(mByebug, "post_mortem=" , bb_set_post_mortem , 1);
rb_define_module_function(mByebug, "raised_exception" , bb_raised_exception, 0);
- rb_define_module_function(mByebug, "_start" , bb_start , 0);
+ rb_define_module_function(mByebug, "start" , bb_start , 0);
rb_define_module_function(mByebug, "started?" , bb_started , 0);
rb_define_module_function(mByebug, "stop" , bb_stop , 0);
rb_define_module_function(mByebug, "thread_context" , bb_thread_context , 1);
rb_define_module_function(mByebug, "tracing?" , bb_tracing , 0);
rb_define_module_function(mByebug, "tracing=" , bb_set_tracing , 1);
- rb_define_module_function(mByebug, "verbose" , bb_verbose , 0);
+ rb_define_module_function(mByebug, "verbose?" , bb_verbose , 0);
rb_define_module_function(mByebug, "verbose=" , bb_set_verbose , 1);
cThreadsTable = rb_define_class_under(mByebug, "ThreadsTable", rb_cObject);
Init_context(mByebug);