tests/GDBDebuggerTestsR.st
changeset 103 56bf65352505
parent 101 d8fee2af20b2
child 104 4add55336dfe
--- a/tests/GDBDebuggerTestsR.st	Mon Jan 29 10:21:03 2018 +0000
+++ b/tests/GDBDebuggerTestsR.st	Thu Feb 15 08:46:03 2018 +0000
@@ -331,6 +331,49 @@
     "Modified (format): / 11-07-2017 / 23:31:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test_stack_01
+    "Tests that stack frames object are preserved amonh run/top cycles
+     if they 're still valid"
+
+    | stack1 stack2 |
+
+    debugger := GDBDebugger new.
+    self assert: debugger isConnected.
+    debugger executable: GDBDebuggeesResource current binaryFactorial1.
+    debugger send: 'b factorial'.
+    debugger send: 'r' andWaitFor: GDBStoppedEvent.
+
+    stack1 := debugger selectedInferior threads first stack.
+    debugger send: 'c' andWaitFor: GDBStoppedEvent.
+    stack2 := debugger selectedInferior threads first stack.
+    self assert: stack1 size == 2.
+    self assert: stack2 size == 3.
+    self assert: stack1 first  == stack2 second.
+    self assert: stack1 second == stack2 third.
+    self assert: stack2 first line == 4.
+    self assert: stack2 second line == 7.
+
+    stack1 := debugger selectedInferior threads first stack.
+    debugger send: 'c' andWaitFor: GDBStoppedEvent.
+    stack2 := debugger selectedInferior threads first stack.
+    self assert: stack1 size == 3.
+    self assert: stack2 size == 4.
+    self assert: stack1 first  == stack2 second.
+    self assert: stack1 second == stack2 third.
+    self assert: stack1 third == stack2 fourth.
+    self assert: stack2 first line == 4.
+    self assert: stack2 second line == 7.
+    self assert: stack2 third line == 7.
+
+
+    debugger send: 'd'.
+    debugger send: 'c' andWaitFor: GDBThreadGroupExitedEvent.
+    debugger send: 'quit' andWait: false.
+
+    "Created: / 30-01-2018 / 15:54:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 01-02-2018 / 21:04:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test_variables_01
     | variables d |
 
@@ -378,6 +421,8 @@
     debugger send: 'quit' andWait: false.
 
     "Created: / 30-01-2018 / 10:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+
 ! !
 
 !GDBDebuggerTestsR class methodsFor:'documentation'!