Class: Byebug::FrameCommand

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

Overview

Move to specific frames in the backtrace.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FrameFunctions

#adjust_frame, #get_pr_arguments, #navigate_to_frame, #switch_to_frame

Methods inherited from Command

commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, #match

Methods included from StringFunctions

#camelize, #prettify

Methods included from FileFunctions

#get_line, #get_lines, #n_lines, #normalize

Methods included from ParseFunctions

#get_int, #parse_steps, #syntax_valid?, #without_stderr

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/byebug/commands/frame.rb', line 197

def description
  prettify <<-EOD
    f[rame][ frame-number]

    Move the current frame to the specified frame number, or the 0 if no
    frame-number has been given.

    A negative number indicates position from the other end, so
    "frame -1" moves to the oldest frame, and "frame 0" moves to the
    newest frame.

    Without an argument, the command prints the current stack frame. Since
    the current position is redisplayed, it may trigger a resyncronization
    if there is a front end also watching over things.
  EOD
end

.namesObject



193
194
195
# File 'lib/byebug/commands/frame.rb', line 193

def names
  %w(frame)
end

Instance Method Details

#executeObject



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

def execute
  unless @match[1]
    print(pr('frame.line', get_pr_arguments(@state.frame)))
    return
  end

  pos, err = get_int(@match[1], 'Frame')
  return errmsg(err) unless pos

  adjust_frame(pos, true)
end

#regexpObject



176
177
178
# File 'lib/byebug/commands/frame.rb', line 176

def regexp
  /^\s* f(?:rame)? (?:\s+(\S+))? \s*$/x
end