Class: Debugger::WhereCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/frame.rb

Overview

Implements debugger “where” or “backtrace” command.

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/ruby-debug/commands/frame.rb', line 151

def help(cmd)
  s = if cmd == 'where'
    %{
      w[here]\tdisplay stack frames
    }
  else
    %{
      bt|backtrace\t\talias for where - display stack frames
    }
  end
  s += %{
Print the entire stack frame. Each frame is numbered, the most recent
frame is 0. frame number can be referred to in the "frame" command;
"up" and "down" add or subtract respectively to frame numbers shown.
The position of the current frame is marked with -->.  }
end

.help_commandObject



147
148
149
# File 'lib/ruby-debug/commands/frame.rb', line 147

def help_command
  %w|where backtrace|
end

Instance Method Details

#executeObject



140
141
142
143
144
# File 'lib/ruby-debug/commands/frame.rb', line 140

def execute
  print(prc("frame.line", (0...@state.context.stack_size)) do |item, _|
    get_pr_arguments(item == @state.frame_pos, item, @state.context)
  end)
end

#regexpObject



136
137
138
# File 'lib/ruby-debug/commands/frame.rb', line 136

def regexp
  /^\s*(?:w(?:here)?|bt|backtrace)$/
end