Class: Debugger::FrameCommand

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

Overview

:nodoc:

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



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/ruby-debug/commands/frame.rb', line 280

def help(cmd)
  %{
    f[rame] [frame-number [thread thread-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. 

    If a thread number is given then we set the context for evaluating
    expressions to that frame of that thread. 
  }
end

.help_commandObject



276
277
278
# File 'lib/ruby-debug/commands/frame.rb', line 276

def help_command
  'frame'
end

Instance Method Details

#executeObject



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/ruby-debug/commands/frame.rb', line 256

def execute
  if not @match[1]
    pos = 0
  else
    pos = get_int(@match[1], "Frame")
    return unless pos
  end
  if @match[2]
    context = parse_thread_num('frame', @match[2])
    unless context
      errmsg "Thread #{@match[2]} doesn't exist.\n"
      return
    end
  else
    context = @state.context
  end
  adjust_frame(pos, true, context)
end

#regexpObject



248
249
250
251
252
253
254
# File 'lib/ruby-debug/commands/frame.rb', line 248

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