Class: RPicSim::StackTrace

Inherits:
Object
  • Object
show all
Defined in:
lib/rpicsim/stack_trace.rb

Overview

Represents a stack trace from the simulated firmware.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entriesObject (readonly)

Array of RPicSim::StackTraceEntry objects. The last one represents where the program counter (PC) is. The entries before the last one approximately represent addresses of CALL or RCALL instructions that have not yet returned.

Returns:



13
14
15
# File 'lib/rpicsim/stack_trace.rb', line 13

def entries
  @entries
end

Instance Method Details

#output(io, padding = '') ⇒ Object

Prints the stack trace to the specified IO object, preceding each line with the specified padding string.

Example usage:

stack_trace.output($stdout, '  ')

Parameters:

  • io

    An object that behaves like a writable IO object.

  • padding (String) (defaults to: '')


29
30
31
32
33
# File 'lib/rpicsim/stack_trace.rb', line 29

def output(io, padding = '')
  @entries.reverse_each do |entry|
    output_entry(entry, io, padding)
  end
end