Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions ext/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,33 +135,18 @@ Context_mark(debug_context_t *context)

static void
Context_free(debug_context_t *context) {
xfree(context->init_stack_files);
xfree(context);
}

extern VALUE
context_create(VALUE thread, VALUE cDebugThread) {
debug_context_t *context;
VALUE locations;
VALUE location;
VALUE path;
VALUE lineno;

context = ALLOC(debug_context_t);
context->stack_size = 0;
locations = rb_funcall(thread, rb_intern("backtrace_locations"), 1, INT2FIX(1));
context->init_stack_size = context->calced_stack_size = locations != Qnil ? RARRAY_LENINT(locations) : 0;

context->init_stack_files = ruby_xmalloc2((context->init_stack_size),sizeof(char*));

int i;
for (i = 0; i < context->init_stack_size; i++) {
location = rb_ary_entry(locations, i);
path = rb_funcall(location, rb_intern("path"), 0);
lineno = rb_funcall(location, rb_intern("lineno"), 0);
context->init_stack_files[i] = path != Qnil ? RSTRING_PTR(path) : "";
}

context->calced_stack_size = locations != Qnil ? RARRAY_LENINT(locations) : 0;

context->stack = NULL;
context->thnum = ++thnum_current;
Expand Down
13 changes: 1 addition & 12 deletions ext/debase_internals.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ process_line_event(VALUE trace_point, void *data)
char *file;
int line;
int moved;
int not_user_code = 0;

context_object = Debase_current_context(mDebase);
Data_Get_Struct(context_object, debug_context_t, context);
Expand All @@ -338,16 +337,6 @@ process_line_event(VALUE trace_point, void *data)
file = RSTRING_PTR(path);
line = FIX2INT(lineno);

int i;
if(context->calced_stack_size < context->init_stack_size) {
for(i = 0; i < context->init_stack_size; i++)
{
if(strcmp(file, context->init_stack_files[i]) == 0) {
not_user_code = 1;
}
}
}

update_stack_size(context);
print_event(tp, context);

Expand Down Expand Up @@ -384,7 +373,7 @@ process_line_event(VALUE trace_point, void *data)
}

breakpoint = breakpoint_find(breakpoints, path, lineno, trace_point);
if (not_user_code == 0 && (context->stop_next == 0 || context->stop_line == 0 || breakpoint != Qnil)) {
if (context->stop_next == 0 || context->stop_line == 0 || breakpoint != Qnil) {
rb_ensure(start_inspector, context_object, stop_inspector, Qnil);
context->stop_reason = CTX_STOP_STEP;
if (breakpoint != Qnil) {
Expand Down
3 changes: 0 additions & 3 deletions ext/debase_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ typedef struct debug_context {
/* dest_frame uses calced_stack_size for stepping */
int dest_frame;
int calced_stack_size;
int init_stack_size;

char **init_stack_files;

char *last_file;
int last_line;
Expand Down