GDBThread.st
changeset 39 2b9d2f75906f
parent 37 a85f0c91f164
child 40 0ce76b671515
--- a/GDBThread.st	Mon Sep 08 23:56:17 2014 +0100
+++ b/GDBThread.st	Tue Sep 09 12:44:37 2014 +0100
@@ -1,7 +1,7 @@
 "{ Package: 'jv:libgdbs' }"
 
 GDBDebuggerObject subclass:#GDBThread
-	instanceVariableNames:'id group status'
+	instanceVariableNames:'id group status stack'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'GDB-Core'
@@ -35,6 +35,20 @@
     ^ id
 
     "Created: / 07-09-2014 / 22:41:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+stack
+    self ensureIsStopped.
+    stack isNil ifTrue:[ 
+        stack := GDBStack newWithThread: self.
+    ].
+    ^ stack
+
+    "Created: / 09-09-2014 / 00:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+status
+    ^ status
 ! !
 
 !GDBThread methodsFor:'initialization'!
@@ -56,9 +70,13 @@
 !
 
 setStatus: aGDBThreadStatus
-    status := aGDBThreadStatus
+    status := aGDBThreadStatus.
+    status isStopped ifFalse:[
+        stack := nil.
+    ].
 
     "Created: / 07-09-2014 / 23:25:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-09-2014 / 00:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 setTerminated
@@ -68,6 +86,19 @@
     "Modified: / 07-09-2014 / 23:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!GDBThread methodsFor:'private'!
+
+ensureIsStopped
+    self isStopped ifTrue:[
+        (GDBInvalidObject newException)
+            parameter:self;
+            messageText:'Invalid state (thread is running or already dead)';
+            raise.
+    ].
+
+    "Created: / 09-09-2014 / 00:04:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !GDBThread methodsFor:'testing'!
 
 isRunning