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:
parent
d80b8cd59e
commit
018c5191bf
29
lib/debug.rb
29
lib/debug.rb
@ -450,7 +450,7 @@ class DEBUGGER__
|
|||||||
stdout.print "At toplevel\n"
|
stdout.print "At toplevel\n"
|
||||||
end
|
end
|
||||||
binding, binding_file, binding_line = @frames[frame_pos]
|
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+))?$/
|
when /^\s*down(?:\s+(\d+))?$/
|
||||||
previous_line = nil
|
previous_line = nil
|
||||||
@ -465,7 +465,7 @@ class DEBUGGER__
|
|||||||
stdout.print "At stack bottom\n"
|
stdout.print "At stack bottom\n"
|
||||||
end
|
end
|
||||||
binding, binding_file, binding_line = @frames[frame_pos]
|
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)?$/
|
when /^\s*fin(?:ish)?$/
|
||||||
if frame_pos == @frames.size
|
if frame_pos == @frames.size
|
||||||
@ -596,20 +596,22 @@ EOHELP
|
|||||||
end
|
end
|
||||||
|
|
||||||
def display_frames(pos)
|
def display_frames(pos)
|
||||||
pos += 1
|
0.upto(@frames.size - 1) do |n|
|
||||||
n = 0
|
if n == pos
|
||||||
at = @frames
|
stdout.print "--> "
|
||||||
for bind, file, line, id in at
|
else
|
||||||
n += 1
|
stdout.print " "
|
||||||
break unless bind
|
end
|
||||||
if pos == n
|
stdout.print format_frame(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
|
|
||||||
end
|
end
|
||||||
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)
|
def display_list(b, e, file, line)
|
||||||
stdout.printf "[%d, %d] in %s\n", b, e, file
|
stdout.printf "[%d, %d] in %s\n", b, e, file
|
||||||
if lines = SCRIPT_LINES__[file] and lines != true
|
if lines = SCRIPT_LINES__[file] and lines != true
|
||||||
@ -778,6 +780,7 @@ EOHELP
|
|||||||
context(th[0]).set_trace arg
|
context(th[0]).set_trace arg
|
||||||
end
|
end
|
||||||
Thread.critical = false
|
Thread.critical = false
|
||||||
|
arg
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_last_thread(th)
|
def set_last_thread(th)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user