aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debug.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-24 16:19:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-24 16:19:00 +0000
commit9e97f6ca6324060e309f8cb020da71f9ad49dbaa (patch)
treec63f363fe7e60a177b26a8f4abc100b5faad2c86 /lib/debug.rb
parent66ad210df88207d0aefcdd19cfd60b83157a2068 (diff)
downloadruby-9e97f6ca6324060e309f8cb020da71f9ad49dbaa.tar.gz
debug.rb: Fix debug listing
* lib/debug.rb (display_list): Fix debug listing when called from the same file it has been required. patch by Dario Bertini <berdario AT gmail.com> [Bug #8318] [fix GH-280] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/debug.rb')
-rw-r--r--lib/debug.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/debug.rb b/lib/debug.rb
index 40886b14a6..b5ae3e95c8 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -753,8 +753,8 @@ EOHELP
end
def display_list(b, e, file, line)
- stdout.printf "[%d, %d] in %s\n", b, e, file
if lines = SCRIPT_LINES__[file] and lines != true
+ stdout.printf "[%d, %d] in %s\n", b, e, file
b.upto(e) do |n|
if n > 0 && lines[n-1]
if n == line
@@ -764,6 +764,9 @@ 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