Class: RPicSim::StackTrace
- Inherits:
-
Object
- Object
- RPicSim::StackTrace
- Defined in:
- lib/rpicsim/stack_trace.rb
Overview
Represents a stack trace from the simulated firmware.
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Array of StackTraceEntry objects.
Instance Method Summary collapse
-
#output(io, padding = '') ⇒ Object
Prints the stack trace to the specified IO object, preceding each line with the specified padding string.
Instance Attribute Details
#entries ⇒ Object (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.
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, ' ')
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 |