summaryrefslogtreecommitdiff
path: root/lib/debug.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/debug.rb')
-rw-r--r--lib/debug.rb29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/debug.rb b/lib/debug.rb
index b9703ed7de..b69e7f9913 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -450,7 +450,7 @@ class DEBUGGER__
stdout.print "At toplevel\n"
end
binding, binding_file, binding_line = @frames[frame_pos]
- stdout.printf "#%d %s:%s\n", frame_pos+1, binding_file, binding_line
+ stdout.print format_frame(frame_pos)
when /^\s*down(?:\s+(\d+))?$/
previous_line = nil
@@ -465,7 +465,7 @@ class DEBUGGER__
stdout.print "At stack bottom\n"
end
binding, binding_file, binding_line = @frames[frame_pos]
- stdout.printf "#%d %s:%s\n", frame_pos+1, binding_file, binding_line
+ stdout.print format_frame(frame_pos)
when /^\s*fin(?:ish)?$/
if frame_pos == @frames.size
@@ -596,20 +596,22 @@ EOHELP
end
def display_frames(pos)
- pos += 1
- n = 0
- at = @frames
- for bind, file, line, id in at
- n += 1
- break unless bind
- if pos == n
- stdout.printf "--> #%d %s:%s%s\n", n, file, line, id ? ":in `#{id.id2name}'":""
- else
- stdout.printf " #%d %s:%s%s\n", n, file, line, id ? ":in `#{id.id2name}'":""
- end
+ 0.upto(@frames.size - 1) do |n|
+ if n == pos
+ stdout.print "--> "
+ else
+ stdout.print " "
+ end
+ stdout.print format_frame(n)
end
end
+ def format_frame(pos)
+ bind, file, line, id = @frames[pos]
+ sprintf "#%d %s:%s%s\n", pos + 1, file, line,
+ (id ? ":in `#{id.id2name}'" : "")
+ 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
@@ -778,6 +780,7 @@ EOHELP
context(th[0]).set_trace arg
end
Thread.critical = false
+ arg
end
def set_last_thread(th)