Class: Byebug::WhereCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/byebug/commands/frame.rb

Overview

Implements byebug “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, format_subcmd, format_subcmds, help, 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 Byebug::Command

Class Method Details

.descriptionObject



182
183
184
185
186
187
188
189
190
191
# File 'lib/byebug/commands/frame.rb', line 182

def description
  %{
    w[here]|bt|backtrace\tdisplay stack frames

    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

.namesObject



178
179
180
# File 'lib/byebug/commands/frame.rb', line 178

def names
  %w(where backtrace)
end

Instance Method Details

#executeObject



169
170
171
172
173
174
175
# File 'lib/byebug/commands/frame.rb', line 169

def execute
  print_backtrace
  if truncated_callstack?(Byebug.start_sentinal)
     print \
       "Warning: saved frames may be incomplete; compare with caller(0)\n"
  end
end

#regexpObject



165
166
167
# File 'lib/byebug/commands/frame.rb', line 165

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