Split event processing and event delivery
authorJan Vrany <jan.vrany@labware.com>
Mon, 29 Mar 2021 12:53:41 +0100
changeset 244 f0e4ddb50242
parent 243 aaaf3757899b
child 245 ebd35e88da73
Split event processing and event delivery
GDBEvent.st
GDBEventDelivery.st
GDBEventDispatcher.st
GDBEventSubscription.st
Make.proto
Make.spec
abbrev.stc
bc.mak
extensions.st
jv_libgdbs.st
libInit.cc
--- a/GDBEvent.st	Mon Jun 28 12:44:28 2021 +0100
+++ b/GDBEvent.st	Mon Mar 29 12:53:41 2021 +0100
@@ -108,6 +108,18 @@
     "Modified: / 20-06-2014 / 09:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!GDBEvent methodsFor:'private - dispatching'!
+
+dispatchUsing: aGDBEventDispatcher
+    "Dispatch the event using given event dispatcher.
+
+     STRICTLY PRIVATE"
+
+    aGDBEventDispatcher dispatchEvent: self.
+
+    "Created: / 29-03-2021 / 12:21:30 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
 !GDBEvent methodsFor:'testing'!
 
 isAsyncEvent
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GDBEventDelivery.st	Mon Mar 29 12:53:41 2021 +0100
@@ -0,0 +1,97 @@
+"
+COPYRIGHT (c) 2021 LabWare
+
+jv:libgdbs - GNU Debugger Interface Library
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License. 
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+"{ Package: 'jv:libgdbs' }"
+
+"{ NameSpace: Smalltalk }"
+
+GDBInternalEvent subclass:#GDBEventDelivery
+	instanceVariableNames:'subscription event'
+	classVariableNames:''
+	poolDictionaries:'GDBDebugFlags'
+	category:'GDB-Private'
+!
+
+!GDBEventDelivery class methodsFor:'documentation'!
+
+copyright
+"
+COPYRIGHT (c) 2021 LabWare
+
+jv:libgdbs - GNU Debugger Interface Library
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License. 
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+"
+! !
+
+!GDBEventDelivery methodsFor:'accessing'!
+
+event
+    ^ event
+!
+
+event:aGDBEvent
+    self assert: (aGDBEvent isKindOf: GDBEvent).
+    event := aGDBEvent.
+
+    "Modified: / 29-03-2021 / 12:58:09 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+subscription
+    ^ subscription
+!
+
+subscription:aSubscription
+    self assert: (aSubscription isKindOf: Subscription).
+    subscription := aSubscription.
+
+    "Modified: / 29-03-2021 / 12:57:48 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+subscription:aGDBEventSubscription event: aGDBEvent
+    self subscription: aGDBEventSubscription.
+    self event: aGDBEvent.
+
+    "Modified: / 29-03-2021 / 12:56:02 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
+!GDBEventDelivery methodsFor:'private - dispatching'!
+
+dispatchUsing: aGDBEventDispatcher
+    "Dispatch the event using given event dispatcher.
+
+     STRICTLY PRIVATE"
+
+    subscription value: event
+
+    "Created: / 29-03-2021 / 12:21:30 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
--- a/GDBEventDispatcher.st	Mon Jun 28 12:44:28 2021 +0100
+++ b/GDBEventDispatcher.st	Mon Mar 29 12:53:41 2021 +0100
@@ -148,6 +148,8 @@
 !GDBEventDispatcher methodsFor:'private'!
 
 dispatchEvent:aGDBEvent
+    | deliveries |
+
     aGDBEvent debugger: debugger.
     TraceEvents ifTrue:[
         Logger 
@@ -159,15 +161,28 @@
             attachment:aGDBEvent
     ].
     announcer1 notNil ifTrue:[
-        announcer1 announce:aGDBEvent.
+        deliveries isNil ifTrue: [ deliveries := OrderedCollection new ].
+        announcer1 subscriptionsFor: aGDBEvent do: [ :subscription|
+            deliveries add: (GDBEventDelivery new subscription: subscription event: aGDBEvent)
+        ].
+        "/ announcer1 announce:aGDBEvent.
     ].
     announcer2 notNil ifTrue:[
-        announcer2 announce:aGDBEvent
+        deliveries isNil ifTrue: [ deliveries := OrderedCollection new ].
+        announcer2 subscriptionsFor: aGDBEvent do: [ :subscription|
+            deliveries add: (GDBEventDelivery new subscription: subscription event: aGDBEvent)
+        ].
+        "/ announcer2 announce:aGDBEvent
+    ].
+    deliveries notEmptyOrNil ifTrue: [ 
+        lock critical:[
+            deliveries reverseDo: [:delivery | queue addFirst: delivery ]
+        ]
     ].
 
     "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: / 09-03-2021 / 21:03:21 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 29-03-2021 / 12:44:25 / Jan Vrany <jan.vrany@labware.com>"
 !
 
 dispatchEvents
@@ -188,7 +203,7 @@
     ] whileTrue.
 
     "Created: / 26-03-2021 / 21:10:49 / Jan Vrany <jan.vrany@labware.com>"
-    "Modified: / 27-03-2021 / 08:19:04 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 29-03-2021 / 12:18:13 / Jan Vrany <jan.vrany@labware.com>"
     "Modified: / 28-06-2021 / 12:07:26 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
--- a/GDBEventSubscription.st	Mon Jun 28 12:44:28 2021 +0100
+++ b/GDBEventSubscription.st	Mon Mar 29 12:53:41 2021 +0100
@@ -1,6 +1,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2021 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -23,7 +24,7 @@
 StrongSubscription subclass:#GDBEventSubscription
 	instanceVariableNames:''
 	classVariableNames:''
-	poolDictionaries:''
+	poolDictionaries:'GDBDebugFlags'
 	category:'GDB-Private'
 !
 
@@ -33,6 +34,7 @@
 "
 jv:libgdbs - GNU Debugger Interface Library
 Copyright (C) 2015-now Jan Vrany
+Copyright (C) 2021 LabWare
 
 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
@@ -86,6 +88,25 @@
     "Modified: / 18-02-2019 / 10:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!GDBEventSubscription methodsFor:'delivery'!
+
+deliver: anAnnouncement from: anAnnouncer
+    TraceEvents ifTrue: [ 
+        Logger log: ('event loop: delivering %1 to %2' bindWith: anAnnouncement with: action printString) severity: #trace facility: 'GDB'.
+    ].
+    ^action cull: anAnnouncement cull: anAnnouncer
+
+    "Created: / 29-03-2021 / 11:54:10 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+value: anAnnouncement
+    interceptors isNil ifTrue: [ ^ self deliver: anAnnouncement from: self ].
+    interceptors do: [ :each |
+            each cull: anAnnouncement cull: announcer cull: self ]
+
+    "Created: / 29-03-2021 / 11:51:51 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
 !GDBEventSubscription class methodsFor:'documentation'!
 
 version_HG
--- a/Make.proto	Mon Jun 28 12:44:28 2021 +0100
+++ b/Make.proto	Mon Mar 29 12:53:41 2021 +0100
@@ -169,6 +169,7 @@
 $(OUTDIR)GDBDebugger.$(O) GDBDebugger.$(C) GDBDebugger.$(H): GDBDebugger.st $(INCLUDE_TOP)/jv/libgdbs/GDBCommandStatus.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBFeatures.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 $(OUTDIR)GDBDebuggerObject.$(O) GDBDebuggerObject.$(C) GDBDebuggerObject.$(H): GDBDebuggerObject.st $(INCLUDE_TOP)/jv/libgdbs/GDBObject.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBEventDispatcher.$(O) GDBEventDispatcher.$(C) GDBEventDispatcher.$(H): GDBEventDispatcher.st $(INCLUDE_TOP)/jv/libgdbs/GDBDebugFlags.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)GDBEventSubscription.$(O) GDBEventSubscription.$(C) GDBEventSubscription.$(H): GDBEventSubscription.st $(INCLUDE_TOP)/jv/libgdbs/GDBDebugFlags.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/StrongSubscription.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Subscription.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBInternalEvent.$(O) GDBInternalEvent.$(C) GDBInternalEvent.$(H): GDBInternalEvent.st $(INCLUDE_TOP)/jv/libgdbs/GDBEvent.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Announcement.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBInvalidObjectError.$(O) GDBInvalidObjectError.$(C) GDBInvalidObjectError.$(H): GDBInvalidObjectError.st $(INCLUDE_TOP)/jv/libgdbs/GDBError.$(H) $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBLocalProcess.$(O) GDBLocalProcess.$(C) GDBLocalProcess.$(H): GDBLocalProcess.st $(INCLUDE_TOP)/jv/libgdbs/GDBProcess.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
@@ -343,7 +344,7 @@
 $(OUTDIR)GDBThreadGroupAddedEvent.$(O) GDBThreadGroupAddedEvent.$(C) GDBThreadGroupAddedEvent.$(H): GDBThreadGroupAddedEvent.st $(INCLUDE_TOP)/jv/libgdbs/GDBAsyncEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBNotificationEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBThreadGroupEvent.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Announcement.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBThreadGroupExitedEvent.$(O) GDBThreadGroupExitedEvent.$(C) GDBThreadGroupExitedEvent.$(H): GDBThreadGroupExitedEvent.st $(INCLUDE_TOP)/jv/libgdbs/GDBAsyncEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBNotificationEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBThreadGroupEvent.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Announcement.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)GDBThreadGroupStartedEvent.$(O) GDBThreadGroupStartedEvent.$(C) GDBThreadGroupStartedEvent.$(H): GDBThreadGroupStartedEvent.st $(INCLUDE_TOP)/jv/libgdbs/GDBAsyncEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBNotificationEvent.$(H) $(INCLUDE_TOP)/jv/libgdbs/GDBThreadGroupEvent.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Announcement.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/announcements/Announcement.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/Announcer.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/SubscriptionCollection.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/SubscriptionRegistry.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MABooleanDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MADescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAElementDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAMagnitudeDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MANumberDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAObject.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAOptionDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAReferenceDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MARelationDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MASingleOptionDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAStringDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAToManyRelationDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Filename.$(H) $(INCLUDE_TOP)/stx/libbasic/IdentityDictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/OrderedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UserPreferences.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/announcements/Announcer.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/SubscriptionCollection.$(H) $(INCLUDE_TOP)/stx/goodies/announcements/SubscriptionRegistry.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MABooleanDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MADescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAElementDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAMagnitudeDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MANumberDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAObject.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAOptionDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAReferenceDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MARelationDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MASingleOptionDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAStringDescription.$(H) $(INCLUDE_TOP)/stx/goodies/magritte/Magritte__MAToManyRelationDescription.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Filename.$(H) $(INCLUDE_TOP)/stx/libbasic/IdentityDictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/OrderedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UserPreferences.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/Make.spec	Mon Jun 28 12:44:28 2021 +0100
+++ b/Make.spec	Mon Mar 29 12:53:41 2021 +0100
@@ -58,7 +58,6 @@
 	GDBError \
 	GDBEvent \
 	GDBEventSequence \
-	GDBEventSubscription \
 	GDBFeatures \
 	GDBInstructionDissection \
 	GDBInternalPipeStream \
@@ -93,6 +92,7 @@
 	GDBDebugger \
 	GDBDebuggerObject \
 	GDBEventDispatcher \
+	GDBEventSubscription \
 	GDBInternalEvent \
 	GDBInvalidObjectError \
 	GDBLocalProcess \
@@ -116,6 +116,7 @@
 	GDBBreakpoint \
 	GDBConsoleOutputEvent \
 	GDBEventSequenceEvent \
+	GDBEventDelivery \
 	GDBExecutionEvent \
 	GDBExitEvent \
 	GDBFrame \
@@ -279,7 +280,6 @@
     $(OUTDIR)GDBError.$(O) \
     $(OUTDIR)GDBEvent.$(O) \
     $(OUTDIR)GDBEventSequence.$(O) \
-    $(OUTDIR)GDBEventSubscription.$(O) \
     $(OUTDIR)GDBFeatures.$(O) \
     $(OUTDIR)GDBInstructionDissection.$(O) \
     $(OUTDIR)GDBInternalPipeStream.$(O) \
@@ -314,6 +314,7 @@
     $(OUTDIR)GDBDebugger.$(O) \
     $(OUTDIR)GDBDebuggerObject.$(O) \
     $(OUTDIR)GDBEventDispatcher.$(O) \
+    $(OUTDIR)GDBEventSubscription.$(O) \
     $(OUTDIR)GDBInternalEvent.$(O) \
     $(OUTDIR)GDBInvalidObjectError.$(O) \
     $(OUTDIR)GDBLocalProcess.$(O) \
@@ -337,6 +338,7 @@
     $(OUTDIR)GDBBreakpoint.$(O) \
     $(OUTDIR)GDBConsoleOutputEvent.$(O) \
     $(OUTDIR)GDBEventSequenceEvent.$(O) \
+    $(OUTDIR)GDBEventDelivery.$(O) \
     $(OUTDIR)GDBExecutionEvent.$(O) \
     $(OUTDIR)GDBExitEvent.$(O) \
     $(OUTDIR)GDBFrame.$(O) \
--- a/abbrev.stc	Mon Jun 28 12:44:28 2021 +0100
+++ b/abbrev.stc	Mon Mar 29 12:53:41 2021 +0100
@@ -8,7 +8,6 @@
 GDBError GDBError jv:libgdbs 'GDB-Core-Exeptions' 1
 GDBEvent GDBEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBEventSequence GDBEventSequence jv:libgdbs 'GDB-Core-Events' 0
-GDBEventSubscription GDBEventSubscription jv:libgdbs 'GDB-Private' 0
 GDBFeatures GDBFeatures jv:libgdbs 'GDB-Core' 0
 GDBInstructionDissection GDBInstructionDissection jv:libgdbs 'GDB-Private' 0
 GDBInternalPipeStream GDBInternalPipeStream jv:libgdbs 'GDB-Support' 0
@@ -22,7 +21,6 @@
 GDBMITraceResponseRecord GDBMITraceResponseRecord jv:libgdbs 'GDB-Private-MI Trace' 0
 GDBObject GDBObject jv:libgdbs 'GDB-Core' 0
 GDBOutputFormats GDBOutputFormats jv:libgdbs 'GDB-Core' 0
-GDBOutputFormat GDBOutputFormat jv:libgdbs 'GDB-Core' 0
 GDBPTY GDBPTY jv:libgdbs 'GDB-Private' 0
 GDBProcess GDBProcess jv:libgdbs 'GDB-Private' 0
 GDBShellCommandParser GDBShellCommandParser jv:libgdbs 'GDB-Private' 0
@@ -44,6 +42,7 @@
 GDBDebugger GDBDebugger jv:libgdbs 'GDB-Core' 0
 GDBDebuggerObject GDBDebuggerObject jv:libgdbs 'GDB-Core' 0
 GDBEventDispatcher GDBEventDispatcher jv:libgdbs 'GDB-Private' 0
+GDBEventSubscription GDBEventSubscription jv:libgdbs 'GDB-Private' 0
 GDBInternalEvent GDBInternalEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBInvalidObjectError GDBInvalidObjectError jv:libgdbs 'GDB-Core-Exeptions' 1
 GDBLocalProcess GDBLocalProcess jv:libgdbs 'GDB-Private' 0
@@ -52,6 +51,7 @@
 GDBMITracer GDBMITracer jv:libgdbs 'GDB-Private-MI Trace' 0
 GDBMemoryDump GDBMemoryDump jv:libgdbs 'GDB-Core' 0
 GDBMemoryDumpRow GDBMemoryDumpRow jv:libgdbs 'GDB-Core' 0
+GDBOutputFormat GDBOutputFormat jv:libgdbs 'GDB-Core' 0
 GDBRegister GDBRegister jv:libgdbs 'GDB-Core' 0
 GDBRemoteProcess GDBRemoteProcess jv:libgdbs 'GDB-Private' 0
 GDBStreamOutputEvent GDBStreamOutputEvent jv:libgdbs 'GDB-Core-Events' 0
@@ -66,6 +66,7 @@
 GDBBreakpoint GDBBreakpoint jv:libgdbs 'GDB-Core' 0
 GDBConsoleOutputEvent GDBConsoleOutputEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBEventSequenceEvent GDBEventSequenceEvent jv:libgdbs 'GDB-Core-Events' 0
+GDBEventDelivery GDBEventDelivery jv:libgdbs 'GDB-Private' 0
 GDBExecutionEvent GDBExecutionEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBExitEvent GDBExitEvent jv:libgdbs 'GDB-Core-Events' 0
 GDBFrame GDBFrame jv:libgdbs 'GDB-Core' 0
--- a/bc.mak	Mon Jun 28 12:44:28 2021 +0100
+++ b/bc.mak	Mon Mar 29 12:53:41 2021 +0100
@@ -81,7 +81,6 @@
 $(OUTDIR)GDBError.$(O) GDBError.$(C) GDBError.$(H): GDBError.st $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBEvent.$(O) GDBEvent.$(C) GDBEvent.$(H): GDBEvent.st $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBEventSequence.$(O) GDBEventSequence.$(C) GDBEventSequence.$(H): GDBEventSequence.st $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\OrderedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(STCHDR)
-$(OUTDIR)GDBEventSubscription.$(O) GDBEventSubscription.$(C) GDBEventSubscription.$(H): GDBEventSubscription.st $(INCLUDE_TOP)\stx\goodies\announcements\StrongSubscription.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Subscription.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBFeatures.$(O) GDBFeatures.$(C) GDBFeatures.$(H): GDBFeatures.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SharedPool.$(H) $(STCHDR)
 $(OUTDIR)GDBInstructionDissection.$(O) GDBInstructionDissection.$(C) GDBInstructionDissection.$(H): GDBInstructionDissection.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBInternalPipeStream.$(O) GDBInternalPipeStream.$(C) GDBInternalPipeStream.$(H): GDBInternalPipeStream.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\Stream.$(H) $(STCHDR)
@@ -116,6 +115,7 @@
 $(OUTDIR)GDBDebugger.$(O) GDBDebugger.$(C) GDBDebugger.$(H): GDBDebugger.st $(INCLUDE_TOP)\jv\libgdbs\GDBCommandStatus.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBFeatures.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 $(OUTDIR)GDBDebuggerObject.$(O) GDBDebuggerObject.$(C) GDBDebuggerObject.$(H): GDBDebuggerObject.st $(INCLUDE_TOP)\jv\libgdbs\GDBObject.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBEventDispatcher.$(O) GDBEventDispatcher.$(C) GDBEventDispatcher.$(H): GDBEventDispatcher.st $(INCLUDE_TOP)\jv\libgdbs\GDBDebugFlags.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)GDBEventSubscription.$(O) GDBEventSubscription.$(C) GDBEventSubscription.$(H): GDBEventSubscription.st $(INCLUDE_TOP)\jv\libgdbs\GDBDebugFlags.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\StrongSubscription.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Subscription.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBInternalEvent.$(O) GDBInternalEvent.$(C) GDBInternalEvent.$(H): GDBInternalEvent.st $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBInvalidObjectError.$(O) GDBInvalidObjectError.$(C) GDBInvalidObjectError.$(H): GDBInvalidObjectError.st $(INCLUDE_TOP)\jv\libgdbs\GDBError.$(H) $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBLocalProcess.$(O) GDBLocalProcess.$(C) GDBLocalProcess.$(H): GDBLocalProcess.st $(INCLUDE_TOP)\jv\libgdbs\GDBProcess.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
@@ -139,6 +139,7 @@
 $(OUTDIR)GDBBreakpoint.$(O) GDBBreakpoint.$(C) GDBBreakpoint.$(H): GDBBreakpoint.st $(INCLUDE_TOP)\jv\libgdbs\GDBDebuggerObject.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBObject.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBConsoleOutputEvent.$(O) GDBConsoleOutputEvent.$(C) GDBConsoleOutputEvent.$(H): GDBConsoleOutputEvent.st $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBStreamOutputEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBEventSequenceEvent.$(O) GDBEventSequenceEvent.$(C) GDBEventSequenceEvent.$(H): GDBEventSequenceEvent.st $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBInternalEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)GDBEventDelivery.$(O) GDBEventDelivery.$(C) GDBEventDelivery.$(H): GDBEventDelivery.st $(INCLUDE_TOP)\jv\libgdbs\GDBDebugFlags.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBInternalEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBExecutionEvent.$(O) GDBExecutionEvent.$(C) GDBExecutionEvent.$(H): GDBExecutionEvent.st $(INCLUDE_TOP)\jv\libgdbs\GDBAsyncEvent.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBExitEvent.$(O) GDBExitEvent.$(C) GDBExitEvent.$(H): GDBExitEvent.st $(INCLUDE_TOP)\jv\libgdbs\GDBEvent.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBInternalEvent.$(H) $(INCLUDE_TOP)\stx\goodies\announcements\Announcement.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)GDBFrame.$(O) GDBFrame.$(C) GDBFrame.$(H): GDBFrame.st $(INCLUDE_TOP)\jv\libgdbs\GDBDebuggerObject.$(H) $(INCLUDE_TOP)\jv\libgdbs\GDBObject.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/extensions.st	Mon Jun 28 12:44:28 2021 +0100
+++ b/extensions.st	Mon Mar 29 12:53:41 2021 +0100
@@ -8,6 +8,27 @@
     "Created: / 06-09-2021 / 15:33:23 / Jan Vrany <jan.vrany@labware.com>"
 ! !
 
+!Announcer methodsFor:'enumerating'!
+
+subscriptionsFor: anObject do: aBlock
+    "Evaluate `aBlock` for each subscription for `anObject` (the subscription
+     instance is passed as an parameter to the block)"
+
+    | announcement actualClass |
+    
+    announcement := anObject asAnnouncement.
+    actualClass := announcement class.
+    registry subscriptionsFor: actualClass do: aBlock.
+    [ actualClass notNil and:[actualClass ~~ announcementBaseClass] ] whileTrue: [
+        actualClass := actualClass superclass.
+        registry subscriptionsFor: actualClass do: aBlock. 
+    ].
+    ^announcement
+
+    "Created: / 29-03-2021 / 12:35:06 / Jan Vrany <jan.vrany@labware.com>"
+    "Modified: / 29-03-2021 / 19:47:13 / Jan Vrany <jan.vrany@labware.com>"
+! !
+
 !ByteArray methodsFor:'printing & storing'!
 
 pythonOn: aStream
@@ -204,6 +225,18 @@
     "Modified: / 03-02-2018 / 21:26:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SubscriptionRegistry methodsFor:'enumerating'!
+
+subscriptionsFor: aClass do: aBlock
+    "Evaluate `aBlock` for each subscription for `aClass` (the subscription
+     instance is passed as an parameter to the block)" 
+
+    subscriptionsByAnnouncementClasses
+            at: aClass
+            ifPresent: [ :subscriptionCollection |
+                    subscriptionCollection do: [ :each | each notNil ifTrue:[aBlock value: each]]]
+! !
+
 !UserPreferences methodsFor:'accessing-vdb'!
 
 gdbCommand
--- a/jv_libgdbs.st	Mon Jun 28 12:44:28 2021 +0100
+++ b/jv_libgdbs.st	Mon Mar 29 12:53:41 2021 +0100
@@ -125,7 +125,6 @@
         GDBError
         GDBEvent
         GDBEventSequence
-        GDBEventSubscription
         GDBFeatures
         GDBInstructionDissection
         GDBInternalPipeStream
@@ -139,7 +138,6 @@
         GDBMITraceResponseRecord
         GDBObject
         GDBOutputFormats
-        GDBOutputFormat
         GDBPTY
         GDBProcess
         GDBShellCommandParser
@@ -161,6 +159,7 @@
         GDBDebugger
         GDBDebuggerObject
         GDBEventDispatcher
+        GDBEventSubscription
         GDBInternalEvent
         GDBInvalidObjectError
         GDBLocalProcess
@@ -169,6 +168,7 @@
         GDBMITracer
         GDBMemoryDump
         GDBMemoryDumpRow
+        GDBOutputFormat
         GDBRegister
         GDBRemoteProcess
         GDBStreamOutputEvent
@@ -183,6 +183,7 @@
         GDBBreakpoint
         GDBConsoleOutputEvent
         GDBEventSequenceEvent
+        GDBEventDelivery
         GDBExecutionEvent
         GDBExitEvent
         GDBFrame
@@ -367,6 +368,8 @@
         UserPreferences gdbCommand
         UserPreferences gdbCommand:
         'Announcement class' handles:
+        Announcer subscriptionsFor:do:
+        SubscriptionRegistry subscriptionsFor:do:
     )
 ! !
 
--- a/libInit.cc	Mon Jun 28 12:44:28 2021 +0100
+++ b/libInit.cc	Mon Mar 29 12:53:41 2021 +0100
@@ -23,7 +23,6 @@
 extern void _GDBError_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBEvent_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBEventSequence_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
-extern void _GDBEventSubscription_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBFeatures_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBInstructionDissection_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBInternalPipeStream_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -58,6 +57,7 @@
 extern void _GDBDebugger_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBDebuggerObject_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBEventDispatcher_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _GDBEventSubscription_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBInternalEvent_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBInvalidObjectError_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBLocalProcess_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -81,6 +81,7 @@
 extern void _GDBBreakpoint_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBConsoleOutputEvent_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBEventSequenceEvent_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
+extern void _GDBEventDelivery_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBExecutionEvent_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBExitEvent_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
 extern void _GDBFrame_Init(int pass, struct __vmData__ *__pRT__, OBJ snd);
@@ -253,7 +254,6 @@
     _GDBError_Init(pass,__pRT__,snd);
     _GDBEvent_Init(pass,__pRT__,snd);
     _GDBEventSequence_Init(pass,__pRT__,snd);
-    _GDBEventSubscription_Init(pass,__pRT__,snd);
     _GDBFeatures_Init(pass,__pRT__,snd);
     _GDBInstructionDissection_Init(pass,__pRT__,snd);
     _GDBInternalPipeStream_Init(pass,__pRT__,snd);
@@ -288,6 +288,7 @@
     _GDBDebugger_Init(pass,__pRT__,snd);
     _GDBDebuggerObject_Init(pass,__pRT__,snd);
     _GDBEventDispatcher_Init(pass,__pRT__,snd);
+    _GDBEventSubscription_Init(pass,__pRT__,snd);
     _GDBInternalEvent_Init(pass,__pRT__,snd);
     _GDBInvalidObjectError_Init(pass,__pRT__,snd);
     _GDBLocalProcess_Init(pass,__pRT__,snd);
@@ -311,6 +312,7 @@
     _GDBBreakpoint_Init(pass,__pRT__,snd);
     _GDBConsoleOutputEvent_Init(pass,__pRT__,snd);
     _GDBEventSequenceEvent_Init(pass,__pRT__,snd);
+    _GDBEventDelivery_Init(pass,__pRT__,snd);
     _GDBExecutionEvent_Init(pass,__pRT__,snd);
     _GDBExitEvent_Init(pass,__pRT__,snd);
     _GDBFrame_Init(pass,__pRT__,snd);