Skip to content

Commit

Permalink
Rename functions that conflict with debase's
Browse files Browse the repository at this point in the history
  • Loading branch information
tzmfreedom committed Mar 30, 2018
1 parent 10895fd commit bf9f45b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Master (Unreleased)

* Error when using byebug with `debase` gem (#447, @tzmfreedom)

## 10.0.1 - 2018-03-21

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion ext/byebug/breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ find_breakpoint_by_method(VALUE breakpoints, VALUE klass, ID mid, VALUE bind,
}

void
Init_breakpoint(VALUE mByebug)
Init_byebug_breakpoint(VALUE mByebug)
{
breakpoint_max = 0;

Expand Down
10 changes: 5 additions & 5 deletions ext/byebug/byebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ call_at_line_check(VALUE ctx, debug_context_t *dc, VALUE breakpoint)
if (!NIL_P(breakpoint))
call_at_breakpoint(ctx, dc, breakpoint);

reset_stepping_stop_points(dc);
byebug_reset_stepping_stop_points(dc);

call_at_line(ctx, dc);
}
Expand Down Expand Up @@ -344,7 +344,7 @@ return_event(VALUE trace_point, void *data)

if ((dc->steps_out == 0) && (CTX_FL_TEST(dc, CTX_FL_STOP_ON_RET)))
{
reset_stepping_stop_points(dc);
byebug_reset_stepping_stop_points(dc);

call_at_return(context, dc, rb_tracearg_return_value(trace_arg));
}
Expand Down Expand Up @@ -393,7 +393,7 @@ end_event(VALUE trace_point, void *data)

if ((dc->steps_out == 0) && (CTX_FL_TEST(dc, CTX_FL_STOP_ON_RET)))
{
reset_stepping_stop_points(dc);
byebug_reset_stepping_stop_points(dc);

call_at_end(context, dc);
}
Expand Down Expand Up @@ -747,7 +747,7 @@ Debug_load(int argc, VALUE *argv, VALUE self)
if (0 != state)
{
status = rb_errinfo();
reset_stepping_stop_points(dc);
byebug_reset_stepping_stop_points(dc);
}

return status;
Expand Down Expand Up @@ -892,7 +892,7 @@ Init_byebug()

Init_threads_table(mByebug);
Init_byebug_context(mByebug);
Init_breakpoint(mByebug);
Init_byebug_breakpoint(mByebug);

rb_global_variable(&breakpoints);
rb_global_variable(&catchpoints);
Expand Down
10 changes: 5 additions & 5 deletions ext/byebug/byebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ typedef struct
} breakpoint_t;

/* functions from locker.c */
extern void add_to_locked(VALUE thread);
extern VALUE pop_from_locked();
extern void remove_from_locked(VALUE thread);
extern void byebug_add_to_locked(VALUE thread);
extern VALUE byebug_pop_from_locked();
extern void byebug_remove_from_locked(VALUE thread);

/* functions from threads.c */
extern void Init_threads_table(VALUE mByebug);
Expand All @@ -127,13 +127,13 @@ extern VALUE next_thread;
extern void Init_byebug_context(VALUE mByebug);
extern VALUE byebug_context_create(VALUE thread);
extern VALUE context_dup(debug_context_t *context);
extern void reset_stepping_stop_points(debug_context_t *context);
extern void byebug_reset_stepping_stop_points(debug_context_t *context);
extern VALUE call_with_debug_inspector(struct call_with_inspection_data *data);
extern VALUE context_backtrace_set(const rb_debug_inspector_t *inspector,
void *data);

/* functions from breakpoint.c */
extern void Init_breakpoint(VALUE mByebug);
extern void Init_byebug_breakpoint(VALUE mByebug);
extern VALUE find_breakpoint_by_pos(VALUE breakpoints, VALUE source, VALUE pos,
VALUE bind);

Expand Down
8 changes: 4 additions & 4 deletions ext/byebug/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ static VALUE cDebugThread;
static int thnum_max = 0;

/* "Step", "Next" and "Finish" do their work by saving information about where
* to stop next. reset_stepping_stop_points removes/resets this information. */
* to stop next. byebug_reset_stepping_stop_points removes/resets this information. */
extern void
reset_stepping_stop_points(debug_context_t *context)
byebug_reset_stepping_stop_points(debug_context_t *context)
{
context->dest_frame = -1;
context->lines = -1;
Expand Down Expand Up @@ -63,7 +63,7 @@ byebug_context_create(VALUE thread)
context->flags = 0;
context->thnum = ++thnum_max;
context->thread = thread;
reset_stepping_stop_points(context);
byebug_reset_stepping_stop_points(context);
context->stop_reason = CTX_STOP_NONE;

rb_debug_inspector_open(context_backtrace_set, (void *)context);
Expand All @@ -81,7 +81,7 @@ context_dup(debug_context_t *context)
debug_context_t *new_context = ALLOC(debug_context_t);

memcpy(new_context, context, sizeof(debug_context_t));
reset_stepping_stop_points(new_context);
byebug_reset_stepping_stop_points(new_context);
new_context->backtrace = context->backtrace;
CTX_FL_SET(new_context, CTX_FL_DEAD);

Expand Down
8 changes: 4 additions & 4 deletions ext/byebug/locker.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ is_in_locked(VALUE thread)
}

extern void
add_to_locked(VALUE thread)
byebug_add_to_locked(VALUE thread)
{
locked_thread_t *node;

Expand All @@ -50,7 +50,7 @@ add_to_locked(VALUE thread)
}

extern VALUE
pop_from_locked()
byebug_pop_from_locked()
{
VALUE thread;
locked_thread_t *node;
Expand All @@ -71,7 +71,7 @@ pop_from_locked()
}

extern void
remove_from_locked(VALUE thread)
byebug_remove_from_locked(VALUE thread)
{
locked_thread_t *node;
locked_thread_t *next_node;
Expand All @@ -81,7 +81,7 @@ remove_from_locked(VALUE thread)

if (locked_head->thread == thread)
{
pop_from_locked();
byebug_pop_from_locked();
return;
}

Expand Down
6 changes: 3 additions & 3 deletions ext/byebug/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ acquire_lock(debug_context_t *dc)
while ((!NIL_P(locker) && locker != rb_thread_current())
|| CTX_FL_TEST(dc, CTX_FL_SUSPEND))
{
add_to_locked(rb_thread_current());
byebug_add_to_locked(rb_thread_current());
rb_thread_stop();

if (CTX_FL_TEST(dc, CTX_FL_SUSPEND))
Expand All @@ -159,10 +159,10 @@ release_lock(void)
locker = Qnil;

if (NIL_P(next_thread))
thread = pop_from_locked();
thread = byebug_pop_from_locked();
else
{
remove_from_locked(next_thread);
byebug_remove_from_locked(next_thread);
thread = next_thread;
next_thread = Qnil;
}
Expand Down

0 comments on commit bf9f45b

Please sign in to comment.