Class: ShadowStack
- Inherits:
-
Object
- Object
- ShadowStack
- Defined in:
- lib/ShadowStack.rb
Overview
SHADOW STACK
Track the executions in a call stack.
Instance Method Summary collapse
- #base ⇒ Object
- #display ⇒ Object
- #display_execution_tree(execution) ⇒ Object
-
#initialize ⇒ ShadowStack
constructor
A new instance of ShadowStack.
- #peek ⇒ Object
-
#push(execution) ⇒ Object
Push Execution.
Constructor Details
#initialize ⇒ ShadowStack
Returns a new instance of ShadowStack.
9 10 11 12 |
# File 'lib/ShadowStack.rb', line 9 def initialize() @bottom = nil @top = nil end |
Instance Method Details
#base ⇒ Object
18 19 20 |
# File 'lib/ShadowStack.rb', line 18 def base() @bottom end |
#display ⇒ Object
45 46 47 |
# File 'lib/ShadowStack.rb', line 45 def display display_execution_tree(@bottom) end |
#display_execution_tree(execution) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/ShadowStack.rb', line 49 def display_execution_tree(execution) p execution unless execution.parent == nil display_execution_tree(execution.parent) end end |
#peek ⇒ Object
14 15 16 |
# File 'lib/ShadowStack.rb', line 14 def peek() @top end |
#push(execution) ⇒ Object
Push Execution.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ShadowStack.rb', line 30 def push(execution) # Reference previous execution. if @bottom.nil? @bottom = execution else execution.child = @top @top.parent = execution end # Place new execution at the top of the stack. @top = execution end |