Fix frame of `GDBThreadSelectedEvent` if inferior is running
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 28 Jan 2019 14:56:14 +0000
changeset 173 02546d4fbe6d
parent 172 836209352efb
child 174 18ef81a3fee5
Fix frame of `GDBThreadSelectedEvent` if inferior is running When ifnferior is running at time we get `=thread-selected` event, we should at least make that frame kind of usable by fixing up it's debugger and thread. This allow clients to use (to some extent) event's frame without worring (too much) about these details.
GDBThreadGroup.st
--- a/GDBThreadGroup.st	Thu Jan 24 21:59:23 2019 +0000
+++ b/GDBThreadGroup.st	Mon Jan 28 14:56:14 2019 +0000
@@ -214,14 +214,25 @@
     | thread frame |
 
     thread := self threadWithId:aGDBThreadSelectedEvent threadId.
+    frame := aGDBThreadSelectedEvent frame.
+
     aGDBThreadSelectedEvent setThread: thread.
-    "/ Be carefull, thread may be rinning!!
-    (thread isStopped and:[(frame := aGDBThreadSelectedEvent frame) notNil]) ifTrue:[ 
+    "/ Be carefull, thread may be running!!
+    (thread isStopped and:[frame notNil]) ifTrue:[ 
         aGDBThreadSelectedEvent setFrame: (thread stack at: (frame level + 1))
+    ] ifFalse:[ 
+        "/ If it is running, at least fixup it's frame, if there's any (it may not
+        "/ if the thread is running at the time of =thread-select event.
+        "/ Uff, so many cases...
+        frame notNil ifTrue:[
+            frame 
+                setDebugger: debugger;
+                setThread: thread.
+        ].
     ].
 
     "Created: / 29-07-2018 / 22:21:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 16-01-2019 / 23:25:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-01-2019 / 23:35:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GDBThreadGroup methodsFor:'initialization'!