diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debug.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/debug.rb b/lib/debug.rb index b5ae3e95c8..67861cba64 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -752,8 +752,17 @@ EOHELP (id ? ":in `#{id.id2name}'" : "") end + def script_lines(file, line) + unless (lines = SCRIPT_LINES__[file]) and lines != true + Tracer::Single.get_line(file, line) if File.exist?(file) + lines = SCRIPT_LINES__[file] + lines = nil if lines == true + end + lines + end + def display_list(b, e, file, line) - if lines = SCRIPT_LINES__[file] and lines != true + if lines = script_lines(file, line) stdout.printf "[%d, %d] in %s\n", b, e, file b.upto(e) do |n| if n > 0 && lines[n-1] @@ -764,20 +773,14 @@ EOHELP end end end - elsif File.exists? file - Tracer::Single.get_line(file, line) - display_list(b, e, file, line) else stdout.printf "No sourcefile available for %s\n", file end end def line_at(file, line) - lines = SCRIPT_LINES__[file] - if lines - return "\n" if lines == true - line = lines[line-1] - return "\n" unless line + lines = script_lines(file, line) + if lines and line = lines[line-1] return line end return "\n" |