class RPicSim::StackTrace
Represents a stack trace from the simulated firmware.
@api public
Attributes
entries[R]
Array of {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.
@return An array of {StackTraceEntry} objects.
Public Class Methods
new(entries = [])
click to toggle source
@api private
# File lib/rpicsim/stack_trace.rb, line 16 def initialize(entries = []) @entries = entries end
Public Instance Methods
output(io, padding = '')
click to toggle source
Prints the stack trace to the specified IO object, preceding each line with the specified padding string.
Example usage:
stack_trace.output($stdout, ' ')
@param io An object that behaves like a writable IO object. @param padding [String]
# File lib/rpicsim/stack_trace.rb, line 29 def output(io, padding = '') @entries.reverse_each do |entry| output_entry(entry, io, padding) end end
Private Instance Methods
output_entry(entry, io, padding)
click to toggle source
# File lib/rpicsim/stack_trace.rb, line 37 def output_entry(entry, io, padding) io.puts padding + entry.description end