Improved `GDBEvent >> #printOn:`
authorJan Vrany <jan.vrany@labware.com>
Tue, 22 Feb 2022 12:21:22 +0000
changeset 256 9e2ac3a4f23c
parent 255 7b97dc7ee9a0
child 257 0366f709feb8
Improved `GDBEvent >> #printOn:` ...to allow printing details. This is usefull when analyzing event processing trace logs.
GDBCommandEvent.st
GDBCommandResultEvent.st
GDBEvent.st
GDBEventDispatcher.st
GDBFrame.st
GDBStreamOutputEvent.st
GDBThread.st
--- a/GDBCommandEvent.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBCommandEvent.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,6 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -33,6 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -71,6 +73,14 @@
     "Created: / 11-06-2014 / 12:49:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!GDBCommandEvent methodsFor:'printing & storing'!
+
+printDetailOn: aStream
+    aStream nextPutAll: command asString
+
+    "Created: / 22-02-2022 / 11:56:18 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
 !GDBCommandEvent class methodsFor:'documentation'!
 
 version_HG
--- a/GDBCommandResultEvent.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBCommandResultEvent.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,6 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -33,6 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -76,18 +78,13 @@
 
 !GDBCommandResultEvent methodsFor:'printing & storing'!
 
-printOn:aStream
-    "append a printed representation of the receiver to the argument, aStream"
+printDetailOn: aStream
+    aStream
+        nextPutAll: result status;
+        nextPutAll:', ';  
+        nextPutAll: result command asString.
 
-    super printOn:aStream.
-    aStream 
-        nextPut:$(;
-        nextPutAll: result status;
-        nextPutAll:': ';
-        nextPutAll: result command asString;
-        nextPut:$).
-
-    "Created: / 19-01-2019 / 22:59:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 22-02-2022 / 11:53:23 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !GDBCommandResultEvent methodsFor:'testing'!
--- a/GDBEvent.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBEvent.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,7 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -108,6 +108,31 @@
     "Modified: / 20-06-2014 / 09:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!GDBEvent methodsFor:'printing & storing'!
+
+printDetailOn: aStream
+    "Nothing special, to be overriden by subclasses"
+
+    "Created: / 22-02-2022 / 11:52:38 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+printOn:aStream
+    "append a printed representation of the receiver to the argument, aStream"
+
+    super printOn:aStream.
+    aStream nextPut: $(.
+    token notNil ifTrue: [ 
+        token printOn: aStream base: 10 size: 3 fill: Character space.
+    ] ifFalse: [ 
+        aStream nextPutAll: '???'.
+    ].
+    aStream nextPutAll: ', '.
+    self printDetailOn: aStream.
+    aStream nextPut: $).
+
+    "Created: / 22-02-2022 / 11:52:11 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
 !GDBEvent methodsFor:'private - dispatching'!
 
 dispatchUsing: aGDBEventDispatcher
--- a/GDBEventDispatcher.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBEventDispatcher.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,7 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -75,8 +75,7 @@
         | index |
 
         Logger 
-            log:('event loop: pushing %1 (%2)' bindWith:aGDBEvent class name
-                    with:aGDBEvent token)
+            log:('event loop: pushing %1' bindWith:aGDBEvent)
             severity:#trace
             facility:'GDB'
             originator:self
@@ -98,7 +97,7 @@
 
     "Created: / 02-06-2014 / 22:49:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-10-2018 / 14:30:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 22-05-2021 / 16:49:54 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 22-02-2022 / 11:56:54 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 pushEventSet: aGDBEventSet
@@ -153,8 +152,7 @@
     aGDBEvent debugger: debugger.
     TraceEvents ifTrue:[
         Logger 
-            log:('event loop: broadcasting %1 (%2)' bindWith:aGDBEvent class name
-                    with:aGDBEvent token)
+            log:('event loop: broadcasting %1' bindWith:aGDBEvent)
             severity:#trace
             facility:'GDB'
             originator:self
@@ -182,7 +180,7 @@
 
     "Created: / 02-06-2014 / 22:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-10-2018 / 14:36:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 29-03-2021 / 12:44:25 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 22-02-2022 / 11:57:30 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 dispatchEvents
--- a/GDBFrame.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBFrame.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,7 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -35,7 +35,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2021 LabWare
+Copyright (C) 2021-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -352,7 +352,13 @@
 
     super printOn: aStream.
     aStream nextPutAll:'('.
-    level printOn:aStream base: 10 size: 2 fill: Character space.
+    "/ In rare occations, level may be nil, for example if frame object 
+    "/ comes from stopped event. sigh...
+    level isNil ifTrue: [
+        aStream nextPutAll: ' ?'
+    ] ifFalse: [  
+        level printOn:aStream base: 10 size: 2 fill: Character space.
+    ].
     aStream nextPutAll:' '.
     addr printOn:aStream.
     aStream nextPutAll:' '.
@@ -364,6 +370,7 @@
     aStream nextPutAll:')'.
 
     "Modified: / 27-02-2015 / 15:21:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-02-2022 / 11:24:30 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !GDBFrame methodsFor:'private'!
--- a/GDBStreamOutputEvent.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBStreamOutputEvent.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,6 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -33,6 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -78,14 +80,9 @@
 
 !GDBStreamOutputEvent methodsFor:'printing & storing'!
 
-printOn:aStream
-    "append a printed representation if the receiver to the argument, aStream"
+printDetailOn:aStream
+    value printOn:aStream
 
-    super printOn:aStream.
-    aStream nextPut:$(.
-    value printOn:aStream.
-    aStream nextPut:$).
-
-    "Modified: / 03-06-2014 / 00:18:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 22-02-2022 / 11:53:46 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
--- a/GDBThread.st	Wed Jan 26 16:06:07 2022 +0000
+++ b/GDBThread.st	Tue Feb 22 12:21:22 2022 +0000
@@ -1,7 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2020-2021 LabWare
+Copyright (C) 2020-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -34,7 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
-Copyright (C) 2020-2021 LabWare
+Copyright (C) 2020-2022 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -199,10 +199,12 @@
 
     aGDBThreadSelectedEvent setThread: self.
     "/ Be carefull, thread may be running!!
-    (false "thread isStopped and:[frame notNil]") ifTrue:[ 
-        "/ This is actually not a good idea. This code is executed
-        "/ within event dispatching process so one may not execute
-        "/ more commands - which is what `thread stack` does. Sigh.
+    (self isStopped and:[frame notNil]) ifTrue:[ 
+        "/ Beware, `self stack` may execute another command
+        "/ and this is called from within event dispatch loop.
+        "/ 
+        "/ This was not possible before, but now it should
+        "/ (see commit bf5cfa214dd4)
         aGDBThreadSelectedEvent setFrame: (self stack at: (frame level + 1))
     ] ifFalse:[ 
         "/ If it is running, at least fixup event's frame, if there's any (it may not
@@ -217,6 +219,7 @@
 
     "Created: / 29-07-2018 / 22:21:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 20-11-2019 / 22:09:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-01-2022 / 15:23:24 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
 !GDBThread methodsFor:'initialization'!