diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | lib/tracer.rb | 1 | ||||
-rw-r--r-- | parse.y | 9 |
4 files changed, 13 insertions, 4 deletions
@@ -1,3 +1,7 @@ +Wed Oct 20 10:31:33 2004 Yukihiro Matsumoto <[email protected]> + + * parse.y (lex_getline): should update ruby_debug_lines. + Wed Oct 20 04:17:55 2004 Yukihiro Matsumoto <[email protected]> * ext/dbm/dbm.c (fdbm_delete_if): should check if deleting element @@ -2457,6 +2457,7 @@ call_trace_func(event, node, self, id, klass) if (!trace_func) return; if (tracing) return; if (id == ID_ALLOCATOR) return; + if (!node && ruby_sourceline == 0) return; if (!(node_save = ruby_current_node)) { node_save = NEW_BEGIN(0); @@ -2491,7 +2492,7 @@ call_trace_func(event, node, self, id, klass) INT2FIX(ruby_sourceline), id?ID2SYM(id):Qnil, self?rb_f_binding(self):Qnil, - klass), + klass?klass:Qnil), Qundef, 0); } if (raised) thread_set_raised(); diff --git a/lib/tracer.rb b/lib/tracer.rb index 3ccf1b5017..c3f2fb8f2e 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -97,6 +97,7 @@ class Tracer SCRIPT_LINES__[file] = list = [] end end + if l = list[line - 1] l else @@ -4351,6 +4351,7 @@ yycompile(parser, f, line) ruby_current_node = 0; ruby_sourcefile = rb_source_filename(f); + ruby_sourceline = line - 1; n = yyparse((void*)parser); ruby_debug_lines = 0; compile_for_eval = 0; @@ -4402,7 +4403,11 @@ static VALUE lex_getline(parser) struct parser_params *parser; { - return (*parser->parser_lex_gets)(parser, parser->parser_lex_input); + VALUE line = (*parser->parser_lex_gets)(parser, parser->parser_lex_input); + if (ruby_debug_lines && !NIL_P(line)) { + rb_ary_push(ruby_debug_lines, line); + } + return line; } #ifndef RIPPER @@ -4419,7 +4424,6 @@ rb_compile_string(f, s, line) lex_gets_ptr = 0; lex_input = s; lex_pbeg = lex_p = lex_pend = 0; - ruby_sourceline = line - 1; compile_for_eval = ruby_in_eval; return yycompile(parser, f, line); @@ -4454,7 +4458,6 @@ rb_compile_file(f, file, start) lex_gets = lex_io_gets; lex_input = file; lex_pbeg = lex_p = lex_pend = 0; - ruby_sourceline = start - 1; return yycompile(parser, f, start); } |