Class: Rubinius::Debugger::Command::Backtrace

Inherits:
Rubinius::Debugger::Command show all
Defined in:
lib/rubinius/debugger/commands.rb

Instance Method Summary collapse

Methods inherited from Rubinius::Debugger::Command

commands, #current_frame, #current_method, descriptor, ext_help, help, #initialize, #listen, match?, pattern, #run_code, #variables

Methods included from Display

#ask, #crit, #display, #error, #info, #section

Constructor Details

This class inherits a constructor from Rubinius::Debugger::Command

Instance Method Details

#run(args) ⇒ Object



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/rubinius/debugger/commands.rb', line 467

def run(args)
  verbose = (args =~ /-v/)

  if m = /(\d+)/.match(args)
    count = m[1].to_i
  else
    count = nil
  end

  info "Backtrace:"

  @debugger.each_frame(current_frame) do |frame|
    return if count and frame.number >= count

    info "%4d %s" % [frame.number, frame.describe]

    if verbose
      frame.local_variables.each do |local|
        info "       #{local} = #{frame.run(local.to_s).inspect}"
      end
    end
  end
end