summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-20 06:53:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-20 06:53:42 +0000
commitfbdc2bf5f70aa594eac63d27079708ae739a0481 (patch)
tree1d73a71b8e974f56b37654c8b00246fb93ed2181
parent30544883773f979b123ac9d00776cfcdf9c5c82c (diff)
* parse.y (lex_getline): should update ruby_debug_lines.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--eval.c3
-rw-r--r--lib/tracer.rb1
-rw-r--r--parse.y9
4 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ab872dd4df..a9b95b46d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Oct 20 10:31:33 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (lex_getline): should update ruby_debug_lines.
+
Wed Oct 20 04:17:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/dbm/dbm.c (fdbm_delete_if): should check if deleting element
diff --git a/eval.c b/eval.c
index eda872dc38..a237768145 100644
--- a/eval.c
+++ b/eval.c
@@ -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
diff --git a/parse.y b/parse.y
index e537858b09..8da26bea1e 100644
--- a/parse.y
+++ b/parse.y
@@ -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);
}