Sha256: 4de2fc5c43b7e139592b32435efad01b93667f7921690c69b878ba624af2ca94

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2013 Rocky Bernstein <rockyb@rubyforge.net>
require_relative 'up'

# Debugger "down" command. Is the same as the "up" command with the
# direction (set by DIRECTION) reversed.
class Trepan::Command::DownCommand < Trepan::Command::UpCommand

  Trepan::Util.suppress_warnings {
    old_verbose = $VERBOSE
    $VERBOSE    = nil
    HELP = <<-HELP
#{NAME} [count]

Move the current frame down in the stack trace (to a newer frame). 0
is the most-recent frame. If no count is given, move down 1.

See also 'up' and 'frame'.
  HELP

    NAME          = File.basename(__FILE__, '.rb')
    SHORT_HELP    = 'Move frame in the direction of the caller of the last-selected frame'
  }

  def initialize(proc)
    super
    @direction = -1 # +1 for up.
  end

end

if __FILE__ == $0
  # Demo it.
  require 'thread_frame'
  require_relative '../mock'
  dbgr, cmd = MockDebugger::setup

  def sep ; puts '=' * 40 end
  cmd.run [cmd.name]
  %w(-1 0 1 -2).each do |count|
    puts "#{cmd.name} #{count}"
    cmd.run([cmd.name, count])
    sep
  end
  def foo(cmd, name)
    cmd.proc.frame_setup(RubyVM::Frame::current)
    puts "#{name}"
    cmd.run([name])
    sep
    puts "#{name} -1"
    cmd.run([name, '-1'])
  end
  foo(cmd, cmd.name)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trepanning-1.93.35 processor/command/down.rb
trepanning-1.93.32 processor/command/down.rb