1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Refactoring. Added Context#format_frame to format a frame, used by up/down

command and Context#display_frames.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nahi 2002-02-23 09:40:58 +00:00
parent d80b8cd59e
commit 018c5191bf

View file

@ -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)