Skip to content

Commit

Permalink
removed trailing spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Sep 14, 2011
1 parent 5bcd44f commit 38f0fbb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
8 changes: 4 additions & 4 deletions ext/ruby_debug/breakpoint.c
Expand Up @@ -20,7 +20,7 @@ int
check_breakpoint_hit_condition(VALUE breakpoint)
{
debug_breakpoint_t *debug_breakpoint;

if(breakpoint == Qnil)
return 0;
Data_Get_Struct(breakpoint, debug_breakpoint_t, debug_breakpoint);
Expand Down Expand Up @@ -100,7 +100,7 @@ check_breakpoints_by_pos(debug_context_t *debug_context, const char *file, int l

if(!CTX_FL_TEST(debug_context, CTX_FL_ENABLE_BKPT))
return Qnil;

if(check_breakpoint_by_pos(debug_context->breakpoint, file, line))
return debug_context->breakpoint;

Expand All @@ -123,7 +123,7 @@ check_breakpoints_by_method(debug_context_t *debug_context, VALUE klass, ID mid,

if(!CTX_FL_TEST(debug_context, CTX_FL_ENABLE_BKPT))
return Qnil;

if(check_breakpoint_by_method(debug_context->breakpoint, klass, mid, self))
return debug_context->breakpoint;

Expand Down Expand Up @@ -532,7 +532,7 @@ breakpoint_set_hit_condition(VALUE self, VALUE value)

Data_Get_Struct(self, debug_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)
Expand Down
78 changes: 39 additions & 39 deletions ext/ruby_debug/ruby_debug.c
Expand Up @@ -115,7 +115,7 @@ get_event_name(rb_event_flag_t event)
}
}

static void
static void
debug_runtime_error(debug_context_t *debug_context, const char *err)
{
if (debug_context != NULL) CTX_FL_SET(debug_context, CTX_FL_IGNORE);
Expand Down Expand Up @@ -394,7 +394,7 @@ FUNC_FASTCALL(do_jump)(rb_thread_t *th, rb_control_frame_t *cfp)
cfp->pc[-2] = debug_context->saved_jump_ins[0];
cfp->pc[-1] = debug_context->saved_jump_ins[1];

if ((debug_context->jump_pc < debug_context->jump_cfp->iseq->iseq_encoded) ||
if ((debug_context->jump_pc < debug_context->jump_cfp->iseq->iseq_encoded) ||
(debug_context->jump_pc >= debug_context->jump_cfp->iseq->iseq_encoded + debug_context->jump_cfp->iseq->iseq_size))
debug_runtime_error(debug_context, "Invalid jump PC target");

Expand Down Expand Up @@ -435,7 +435,7 @@ FUNC_FASTCALL(do_jump)(rb_thread_t *th, rb_control_frame_t *cfp)
} while (cfp <= jump_cfp);

jump_cfp->iseq->catch_table_size = 1;
jump_cfp->iseq->catch_table =
jump_cfp->iseq->catch_table =
create_catch_table(debug_context, jump_pc - jump_cfp->iseq->iseq_encoded);
jump_cfp->iseq->catch_table->sp = -1;

Expand All @@ -459,7 +459,7 @@ FUNC_FASTCALL(do_catchall)(rb_thread_t *th, rb_control_frame_t *cfp)
if (debug_context == NULL)
debug_runtime_error(NULL, "Lost context in catchall");
if (debug_context->saved_frames == NULL)
return(cfp); /* re-throw exception */
return(cfp); /* re-throw exception */

if (CTX_FL_TEST(debug_context, CTX_FL_RETHROW))
{
Expand Down Expand Up @@ -683,7 +683,7 @@ static VALUE
call_at_line(VALUE context, debug_context_t *debug_context, VALUE file, VALUE line)
{
VALUE args;

last_debugged_thnum = debug_context->thnum;
save_current_position(debug_context);

Expand Down Expand Up @@ -779,7 +779,7 @@ c_call_new_frame_p(VALUE klass, ID mid)
return 0;
}

static void
static void
call_at_line_check(VALUE self, debug_context_t *debug_context, VALUE breakpoint, VALUE context, const char *file, int line)
{
debug_context->stop_reason = CTX_STOP_STEP;
Expand Down Expand Up @@ -855,7 +855,7 @@ FUNC_FASTCALL(do_catch)(rb_thread_t *th, rb_control_frame_t *cfp)
cfp->pc[-1] = debug_context->saved_jump_ins[1];

cfp->pc = debug_context->jump_pc;

debug_context->jump_pc = NULL;
debug_context->jump_cfp = NULL;

Expand Down Expand Up @@ -910,7 +910,7 @@ set_cfp(debug_context_t *debug_context)
{
if (cfp->iseq != NULL)
{
if (cfp->pc != NULL)
if (cfp->pc != NULL)
{
if ((cfp_count < debug_context->cfp_count) && (debug_context->cfp[cfp_count] != cfp))
has_changed = 1;
Expand Down Expand Up @@ -944,7 +944,7 @@ set_cfp(debug_context_t *debug_context)
}
}

static void
static void
save_frames(debug_context_t *debug_context)
{
int size;
Expand All @@ -967,7 +967,7 @@ save_frames(debug_context_t *debug_context)
debug_context->catch_cfp = GET_THREAD()->cfp;
ZFREE(debug_context->saved_frames);

size = sizeof(rb_control_frame_t) *
size = sizeof(rb_control_frame_t) *
((debug_context->cfp[debug_context->cfp_count-1] - debug_context->cfp[0]) + 1);
debug_context->saved_frames = (rb_control_frame_t*)malloc(size);
memcpy(debug_context->saved_frames, debug_context->cfp[0], size);
Expand Down Expand Up @@ -1118,9 +1118,9 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
if (iseq->type == ISEQ_TYPE_ENSURE)
{
/* don't allow "ensure" blocks to execute yet: jump out of here by re-throwing exception */
VALUE *jump_pc =
VALUE *jump_pc =
iseq->iseq_encoded + iseq->iseq_size - insn_len(BIN(getdynamic)) - insn_len(BIN(throw));

if (jump_pc[0] != bin_getdynamic || jump_pc[insn_len(BIN(getdynamic))] != bin_throw)
debug_runtime_error(debug_context, "Unexpected instructions in ENSURE block");

Expand Down Expand Up @@ -1189,7 +1189,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
/* make sure all threads have event flag set so we'll get its events */
st_foreach(th->vm->living_threads, set_thread_event_flag_i, 0);

if (debug_context->thread_pause)
if (debug_context->thread_pause)
{
debug_context->thread_pause = 0;
debug_context->stop_next = 1;
Expand All @@ -1198,7 +1198,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
}

/* ignore a skipped section of code */
if (CTX_FL_TEST(debug_context, CTX_FL_SKIPPED))
if (CTX_FL_TEST(debug_context, CTX_FL_SKIPPED))
goto cleanup;

debug_context->cur_cfp = th->cfp;
Expand All @@ -1214,7 +1214,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
{
CTX_FL_SET(debug_context, CTX_FL_ENABLE_BKPT);
moved = 1;
}
}

if(event != RUBY_EVENT_LINE)
CTX_FL_SET(debug_context, CTX_FL_STEPPED);
Expand All @@ -1228,7 +1228,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
int hit_count;

/* send catchpoint notification */
hit_count = INT2FIX(FIX2INT(rb_hash_aref(rdebug_catchpoints,
hit_count = INT2FIX(FIX2INT(rb_hash_aref(rdebug_catchpoints,
debug_context->catch_table.mod_name)+1));
rb_hash_aset(rdebug_catchpoints, debug_context->catch_table.mod_name, hit_count);
debug_context->stop_reason = CTX_STOP_CATCHPOINT;
Expand All @@ -1250,7 +1250,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
debug_context->stop_next--;
if(debug_context->stop_next < 0)
debug_context->stop_next = -1;
if(moved || (CTX_FL_TEST(debug_context, CTX_FL_STEPPED) &&
if(moved || (CTX_FL_TEST(debug_context, CTX_FL_STEPPED) &&
!CTX_FL_TEST(debug_context, CTX_FL_FORCE_MOVE)))
{
debug_context->stop_line--;
Expand Down Expand Up @@ -1321,7 +1321,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
}

cleanup:

debug_context->stop_reason = CTX_STOP_NONE;

/* check that all contexts point to alive threads */
Expand Down Expand Up @@ -1608,7 +1608,7 @@ debug_thread_inherited(VALUE klass)
* +stop+ parameter forces the debugger to stop at the first line of code in the +file+
* +increment_start+ determines if start_count should be incremented. When
* control threads are used, they have to be set up before loading the
* debugger; so here +increment_start+ will be false.
* debugger; so here +increment_start+ will be false.
* FOR INTERNAL USE ONLY.
*/
static VALUE
Expand All @@ -1617,8 +1617,8 @@ debug_debug_load(int argc, VALUE *argv, VALUE self)
VALUE file, stop, context, increment_start;
debug_context_t *debug_context;
int state = 0;
if(rb_scan_args(argc, argv, "12", &file, &stop, &increment_start) == 1)

if(rb_scan_args(argc, argv, "12", &file, &stop, &increment_start) == 1)
{
stop = Qfalse;
increment_start = Qtrue;
Expand All @@ -1633,7 +1633,7 @@ debug_debug_load(int argc, VALUE *argv, VALUE self)
/* Initializing $0 to the script's path */
ruby_script(RSTRING_PTR(file));
rb_load_protect(file, 0, &state);
if (0 != state)
if (0 != state)
{
VALUE errinfo = rb_errinfo();
debug_suspend(self);
Expand All @@ -1642,7 +1642,7 @@ debug_debug_load(int argc, VALUE *argv, VALUE self)
return errinfo;
}

/* We should run all at_exit handler's in order to provide,
/* 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();

Expand Down Expand Up @@ -1808,7 +1808,7 @@ check_frame_number(debug_context_t *debug_context, VALUE frame)
return frame_n;
}

static int
static int
optional_frame_position(int argc, VALUE *argv)
{
unsigned int i_scanned;
Expand Down Expand Up @@ -1934,7 +1934,7 @@ context_frame_locals(int argc, VALUE *argv, VALUE self)
rb_control_frame_t *cfp;
rb_iseq_t *iseq;
VALUE hash;

frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
Expand Down Expand Up @@ -2000,7 +2000,7 @@ context_frame_self(int argc, VALUE *argv, VALUE self)
{
VALUE frame;
debug_context_t *debug_context;

frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);

Expand All @@ -2011,7 +2011,7 @@ context_frame_self(int argc, VALUE *argv, VALUE self)
* call-seq:
* context.frame_class(frame_position) -> obj
*
* Returns the real class of the frame.
* Returns the real class of the frame.
* It could be different than context.frame_self(frame).class
*/
static VALUE
Expand All @@ -2021,7 +2021,7 @@ context_frame_class(int argc, VALUE *argv, VALUE self)
VALUE frame;
debug_context_t *debug_context;
rb_control_frame_t *cfp;

frame = optional_frame_position(argc, argv);
Data_Get_Struct(self, debug_context_t, debug_context);
cfp = GET_CFP;
Expand Down Expand Up @@ -2136,7 +2136,7 @@ context_thnum(VALUE self)
debug_context_t *debug_context;

Data_Get_Struct(self, debug_context_t, debug_context);

return INT2FIX(debug_context->thnum);
}

Expand Down Expand Up @@ -2284,7 +2284,7 @@ context_dead(VALUE self)
/*
* call-seq:
* context.stop_reason -> sym
*
*
* Returns the reason for the stop. It maybe of the following values:
* :initial, :step, :breakpoint, :catchpoint, :post-mortem
*/
Expand All @@ -2295,7 +2295,7 @@ context_stop_reason(VALUE self)
const char * sym_name;

Data_Get_Struct(self, debug_context_t, debug_context);

switch(debug_context->stop_reason)
{
case CTX_STOP_STEP:
Expand All @@ -2313,7 +2313,7 @@ context_stop_reason(VALUE self)
}
if(CTX_FL_TEST(debug_context, CTX_FL_DEAD))
sym_name = "post-mortem";

return ID2SYM(rb_intern(sym_name));
}

Expand Down Expand Up @@ -2437,9 +2437,9 @@ Init_context()
rb_define_method(cContext, "stack_inc", context_stack_inc, 0);
rb_define_method(cContext, "stack_dec", context_stack_dec, 0);
rb_define_method(cContext, "dead?", context_dead, 0);
rb_define_method(cContext, "breakpoint",
rb_define_method(cContext, "breakpoint",
context_breakpoint, 0); /* in breakpoint.c */
rb_define_method(cContext, "set_breakpoint",
rb_define_method(cContext, "set_breakpoint",
context_set_breakpoint, -1); /* in breakpoint.c */
rb_define_method(cContext, "jump", context_jump, 2);
rb_define_method(cContext, "pause", context_pause, 0);
Expand Down Expand Up @@ -2517,12 +2517,12 @@ Init_ruby_debug()
rb_define_module_function(mDebugger, "started?", debug_is_started, 0);
rb_define_module_function(mDebugger, "breakpoints", debug_breakpoints, 0);
rb_define_module_function(mDebugger, "add_breakpoint", debug_add_breakpoint, -1);
rb_define_module_function(mDebugger, "remove_breakpoint",
rdebug_remove_breakpoint,
rb_define_module_function(mDebugger, "remove_breakpoint",
rdebug_remove_breakpoint,
1); /* in breakpoint.c */
rb_define_module_function(mDebugger, "add_catchpoint",
rb_define_module_function(mDebugger, "add_catchpoint",
rdebug_add_catchpoint, 1); /* in breakpoint.c */
rb_define_module_function(mDebugger, "catchpoints",
rb_define_module_function(mDebugger, "catchpoints",
debug_catchpoints, 0); /* in breakpoint.c */
rb_define_module_function(mDebugger, "last_context", debug_last_interrupted, 0);
rb_define_module_function(mDebugger, "contexts", debug_contexts, 0);
Expand All @@ -2544,7 +2544,7 @@ Init_ruby_debug()
cThreadsTable = rb_define_class_under(mDebugger, "ThreadsTable", rb_cObject);

cDebugThread = rb_define_class_under(mDebugger, "DebugThread", rb_cThread);
rb_define_singleton_method(cDebugThread, "inherited",
rb_define_singleton_method(cDebugThread, "inherited",
debug_thread_inherited, 1);

Init_context();
Expand Down
8 changes: 4 additions & 4 deletions ext/ruby_debug/ruby_debug.h
@@ -1,5 +1,5 @@
/* Context info */
enum ctx_stop_reason {CTX_STOP_NONE, CTX_STOP_STEP, CTX_STOP_BREAKPOINT,
enum ctx_stop_reason {CTX_STOP_NONE, CTX_STOP_STEP, CTX_STOP_BREAKPOINT,
CTX_STOP_CATCHPOINT};

/* Context flags */
Expand Down Expand Up @@ -91,7 +91,7 @@ classname_cmp(VALUE name, VALUE klass)
VALUE class_name = (Qnil == name) ? rb_str_new2("main") : name;
if (klass == Qnil) return(0);
mod_name = rb_mod_name(klass);
return (mod_name != Qnil
return (mod_name != Qnil
&& rb_str_cmp(class_name, mod_name) == 0);
}

Expand All @@ -118,9 +118,9 @@ typedef struct {
/* routines in breakpoint.c */
extern int check_breakpoint_expression(VALUE breakpoint, VALUE binding);
extern int check_breakpoint_hit_condition(VALUE breakpoint);
extern VALUE check_breakpoints_by_method(debug_context_t *debug_context,
extern VALUE check_breakpoints_by_method(debug_context_t *debug_context,
VALUE klass, ID mid, VALUE self);
extern VALUE check_breakpoints_by_pos(debug_context_t *debug_context,
extern VALUE check_breakpoints_by_pos(debug_context_t *debug_context,
const char *file, int line);
extern VALUE create_breakpoint_from_args(int argc, VALUE *argv, int id);
extern VALUE context_breakpoint(VALUE self);
Expand Down

0 comments on commit 38f0fbb

Please sign in to comment.