ext/byebug/byebug.c in byebug-1.3.0 vs ext/byebug/byebug.c in byebug-1.3.1
- old
+ new
@@ -93,26 +93,26 @@
*method_id = rb_tracearg_method_id(tp);
*defined_class = rb_tracearg_defined_class(tp);
}
static void
-call_at_line(debug_context_t *context, char *file, int line,
- VALUE context_object, VALUE path, VALUE lineno)
+call_at_line(debug_context_t *context, VALUE context_obj,
+ VALUE path, VALUE lineno)
{
CTX_FL_UNSET(context, CTX_FL_ENABLE_BKPT);
CTX_FL_UNSET(context, CTX_FL_FORCE_MOVE);
- context->last_file = file;
- context->last_line = line;
- rb_funcall(context_object, rb_intern("at_line"), 2, path, lineno);
+ context->last_file = RSTRING_PTR(path);
+ context->last_line = FIX2INT(lineno);
+ rb_funcall(context_obj, rb_intern("at_line"), 2, path, lineno);
}
#define EVENT_SETUP \
VALUE path, lineno, method_id, defined_class, binding, self; \
- VALUE context_object; \
+ VALUE context_obj; \
debug_context_t *context; \
- context_object = Byebug_context(mByebug); \
- Data_Get_Struct(context_object, debug_context_t, context); \
+ context_obj = Byebug_context(mByebug); \
+ Data_Get_Struct(context_obj, debug_context_t, context); \
if (!check_start_processing(context)) return; \
load_frame_info(trace_point, &path, &lineno, &method_id, &defined_class, \
&binding, &self); \
if (debug == Qtrue) \
printf("%s (stack_size: %d)\n", \
@@ -138,11 +138,11 @@
CTX_FL_SET(context, CTX_FL_ENABLE_BKPT);
moved = 1;
}
if (RTEST(tracing))
- rb_funcall(context_object, rb_intern("at_tracing"), 2, path, lineno);
+ rb_funcall(context_obj, rb_intern("at_tracing"), 2, path, lineno);
if (context->dest_frame == -1 || context->stack_size == context->dest_frame)
{
if (moved || !CTX_FL_TEST(context, CTX_FL_FORCE_MOVE))
{
@@ -157,22 +157,21 @@
if (context->steps == 0 || context->lines == 0)
{
context->stop_reason = CTX_STOP_STEP;
reset_stepping_stop_points(context);
- call_at_line(
- context, RSTRING_PTR(path), FIX2INT(lineno), context_object, path, lineno);
+ call_at_line(context, context_obj, path, lineno);
}
else if (CTX_FL_TEST(context, CTX_FL_ENABLE_BKPT))
{
breakpoint = find_breakpoint_by_pos(breakpoints, path, lineno, binding);
- if (breakpoint != Qnil) {
+ if (breakpoint != Qnil)
+ {
context->stop_reason = CTX_STOP_BREAKPOINT;
reset_stepping_stop_points(context);
- rb_funcall(context_object, rb_intern("at_breakpoint"), 1, breakpoint);
- call_at_line(context, RSTRING_PTR(path), FIX2INT(lineno), context_object,
- path, lineno);
+ rb_funcall(context_obj, rb_intern("at_breakpoint"), 1, breakpoint);
+ call_at_line(context, context_obj, path, lineno);
}
}
cleanup(context);
}
@@ -222,15 +221,15 @@
defined_class, binding, self);
breakpoint = find_breakpoint_by_method(breakpoints, defined_class,
SYM2ID(method_id),
binding, self);
- if (breakpoint != Qnil) {
- context->stop_reason = CTX_STOP_BREAKPOINT;
- rb_funcall(context_object, rb_intern("at_breakpoint"), 1, breakpoint);
- call_at_line(context, RSTRING_PTR(path), FIX2INT(lineno), context_object,
- path, lineno);
+ if (breakpoint != Qnil)
+ {
+ context->stop_reason = CTX_STOP_BREAKPOINT;
+ rb_funcall(context_obj, rb_intern("at_breakpoint"), 1, breakpoint);
+ call_at_line(context, context_obj, path, lineno);
}
cleanup(context);
}
@@ -275,13 +274,12 @@
if (hit_count != Qnil) {
/* increment exception */
rb_hash_aset(catchpoints, mod_name, INT2FIX(FIX2INT(hit_count) + 1));
context->stop_reason = CTX_STOP_CATCHPOINT;
- rb_funcall(context_object, rb_intern("at_catchpoint"), 1, rb_errinfo());
- call_at_line(context, RSTRING_PTR(path), FIX2INT(lineno), context_object,
- path, lineno);
+ rb_funcall(context_obj, rb_intern("at_catchpoint"), 1, rb_errinfo());
+ call_at_line(context, context_obj, path, lineno);
break;
}
}
cleanup(context);
@@ -401,57 +399,56 @@
}
static VALUE
set_current_skipped_status(VALUE status)
{
- VALUE context_object;
+ VALUE context_obj;
debug_context_t *context;
- context_object = Byebug_context(mByebug);
- Data_Get_Struct(context_object, debug_context_t, context);
+ context_obj = Byebug_context(mByebug);
+ Data_Get_Struct(context_obj, debug_context_t, context);
if (status)
CTX_FL_SET(context, CTX_FL_SKIPPED);
else
CTX_FL_UNSET(context, CTX_FL_SKIPPED);
return Qnil;
}
static VALUE
Byebug_load(int argc, VALUE *argv, VALUE self)
{
- VALUE file, stop, context_object;
- debug_context_t *context;
- int state = 0;
+ VALUE file, stop, context_obj;
+ debug_context_t *context;
+ int state = 0;
- if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
- {
- stop = Qfalse;
- }
+ if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
+ {
+ stop = Qfalse;
+ }
- Byebug_start(self);
+ Byebug_start(self);
- context_object = Byebug_context(self);
- Data_Get_Struct(context_object, debug_context_t, context);
- context->stack_size = 0;
- if (RTEST(stop)) context->steps = 1;
+ 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();
- //debug_suspend(self);
- reset_stepping_stop_points(context);
- rb_set_errinfo(Qnil);
- return errinfo;
- }
+ /* 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();
+ /* 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;
+ return Qnil;
}
static VALUE
debug_at_exit_c(VALUE proc)
{