Skip to content

Commit c235c83

Browse files
viuginick1valich
authored andcommitted
fix of stepping in ruby debugger source code reverted (#58)
it's time consuming and breaks attach
1 parent 23c219d commit c235c83

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed

ext/context.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,33 +135,18 @@ Context_mark(debug_context_t *context)
135135

136136
static void
137137
Context_free(debug_context_t *context) {
138-
xfree(context->init_stack_files);
139138
xfree(context);
140139
}
141140

142141
extern VALUE
143142
context_create(VALUE thread, VALUE cDebugThread) {
144143
debug_context_t *context;
145144
VALUE locations;
146-
VALUE location;
147-
VALUE path;
148-
VALUE lineno;
149145

150146
context = ALLOC(debug_context_t);
151147
context->stack_size = 0;
152148
locations = rb_funcall(thread, rb_intern("backtrace_locations"), 1, INT2FIX(1));
153-
context->init_stack_size = context->calced_stack_size = locations != Qnil ? RARRAY_LENINT(locations) : 0;
154-
155-
context->init_stack_files = ruby_xmalloc2((context->init_stack_size),sizeof(char*));
156-
157-
int i;
158-
for (i = 0; i < context->init_stack_size; i++) {
159-
location = rb_ary_entry(locations, i);
160-
path = rb_funcall(location, rb_intern("path"), 0);
161-
lineno = rb_funcall(location, rb_intern("lineno"), 0);
162-
context->init_stack_files[i] = path != Qnil ? RSTRING_PTR(path) : "";
163-
}
164-
149+
context->calced_stack_size = locations != Qnil ? RARRAY_LENINT(locations) : 0;
165150

166151
context->stack = NULL;
167152
context->thnum = ++thnum_current;

ext/debase_internals.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ process_line_event(VALUE trace_point, void *data)
323323
char *file;
324324
int line;
325325
int moved;
326-
int not_user_code = 0;
327326

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

341-
int i;
342-
if(context->calced_stack_size < context->init_stack_size) {
343-
for(i = 0; i < context->init_stack_size; i++)
344-
{
345-
if(strcmp(file, context->init_stack_files[i]) == 0) {
346-
not_user_code = 1;
347-
}
348-
}
349-
}
350-
351340
update_stack_size(context);
352341
print_event(tp, context);
353342

@@ -384,7 +373,7 @@ process_line_event(VALUE trace_point, void *data)
384373
}
385374

386375
breakpoint = breakpoint_find(breakpoints, path, lineno, trace_point);
387-
if (not_user_code == 0 && (context->stop_next == 0 || context->stop_line == 0 || breakpoint != Qnil)) {
376+
if (context->stop_next == 0 || context->stop_line == 0 || breakpoint != Qnil) {
388377
rb_ensure(start_inspector, context_object, stop_inspector, Qnil);
389378
context->stop_reason = CTX_STOP_STEP;
390379
if (breakpoint != Qnil) {

ext/debase_internals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ typedef struct debug_context {
5757
/* dest_frame uses calced_stack_size for stepping */
5858
int dest_frame;
5959
int calced_stack_size;
60-
int init_stack_size;
61-
62-
char **init_stack_files;
6360

6461
char *last_file;
6562
int last_line;

0 commit comments

Comments
 (0)