Class Debugger::WhereCommand
In: cli/ruby-debug/commands/frame.rb
Parent: Command

Implements debugger "where" or "backtrace" command.

Methods

execute   help   help_command   regexp  

Public Class methods

[Source]

     # File cli/ruby-debug/commands/frame.rb, line 181
181:       def help(cmd)
182:         s = if cmd == 'where'
183:           %{
184:             w[here]\tdisplay stack frames
185:             }
186:             else
187:           %{
188:             bt|backtrace\t\talias for where - display stack frames
189:          }
190:             end
191:         s += %{
192: Print the entire stack frame. Each frame is numbered, the most recent
193: frame is 0. frame number can be referred to in the "frame" command;
194: "up" and "down" add or subtract respectively to frame numbers shown.
195: The position of the current frame is marked with -->.  } 
196:       end

[Source]

     # File cli/ruby-debug/commands/frame.rb, line 177
177:       def help_command
178:         %w|where backtrace|
179:       end

Public Instance methods

[Source]

     # File cli/ruby-debug/commands/frame.rb, line 160
160:     def execute
161:       (0...@state.context.stack_size).each do |idx|
162:         if idx == @state.frame_pos
163:           print "--> "
164:         else
165:           print "    "
166:         end
167:         print_frame(idx)
168: 
169:       end
170:       if truncated_callstack?(@state.context, Debugger.start_sentinal)
171:         print "Warning: saved frames may be incomplete;\n"
172:         print "compare debugger backtrace (bt) with Ruby caller(0).\n" 
173:       end
174:     end

[Source]

     # File cli/ruby-debug/commands/frame.rb, line 156
156:     def regexp
157:       /^\s*(?:w(?:here)?|bt|backtrace)$/
158:     end

[Validate]