Change `#pushEvent:` to insert event into the current event set
...if any. The reason is that sometimes events are pushed back
onto a queue as part of processing command post-execute hook
(this is mainly unify internal housekeeping since GDB does not
generate various events when state change is caused by an MI
command, see [1]).
In this case we want these artifical events to be processed within current
event set so internal data are in sync when `#send: ... andWait: true` returns.
If there's no event set currently being processed, insert event to the end
of the queue.
[1]: https://sourceware.org/pipermail/gdb/2019-June/047938.html
--- a/GDBEventDispatcher.st Sat May 22 22:43:27 2021 +0100
+++ b/GDBEventDispatcher.st Sat May 22 16:52:20 2021 +0100
@@ -72,6 +72,8 @@
pushEvent: aGDBEvent
lock critical:[
+ | index |
+
Logger
log:('event loop: pushing %1 (%2)' bindWith:aGDBEvent class name
with:aGDBEvent token)
@@ -79,13 +81,24 @@
facility:'GDB'
originator:self
attachment:aGDBEvent.
- queue add: aGDBEvent.
+
+ "/ Sometimes, events are pushed back onto a queue as part of processing
+ "/ command post-execute hook (this is mainly unify internal housekeeping
+ "/ since GDB does not generate various events when state change is caused by
+ "/ an MI command, see [1]).
+ "/
+ "/ In this case we want these artifical events to be processed within current
+ "/ event set so internal data are in sync when `#send: ... andWait: true` returns.
+ "/
+ "/ [1]: https://sourceware.org/pipermail/gdb/2019-June/047938.html
+ index := queue findFirst:[ :ev | ev isEventSetProcessingFinishedEvent ] ifNone: [queue size + 1].
+ queue add: aGDBEvent beforeIndex: index.
].
self start
"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: / 17-03-2021 / 13:26:57 / Jan Vrany <jan.vrany@labware.com>"
+ "Modified (comment): / 22-05-2021 / 16:49:54 / Jan Vrany <jan.vrany@labware.com>"
!
pushEventSet: aGDBEventSet