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.
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
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 }"
StrongSubscription subclass:#GDBEventSubscription
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'GDB-Private'
!
!GDBEventSubscription class methodsFor:'documentation'!
copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany
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
"
! !
!GDBEventSubscription class methodsFor:'private'!
blockFor: anObject withSelector: aSelector
| args |
args := aSelector numArgs.
anObject isView ifTrue:[
args = 0 ifTrue: [ ^[ anObject sensor pushUserEvent: aSelector for: anObject ] ].
args = 1 ifTrue: [ ^[ :anAnnouncement | anObject sensor pushUserEvent: aSelector for: anObject withArgument: anAnnouncement ] ].
args = 2 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | anObject sensor pushUserEvent: aSelector for: anObject withArguments: (Array with: anAnnouncement with: anAnnouncer) ] ].
self error: 'Couldn''t create block'.
].
"/ If the observer (receiver of events) is an application,
"/ then push the event processing to application's event
"/ queue. This avoids blocking of event dispatcher and ensures
"/ that UI is synchronized.
"/
"/ However, we must be carefull since application windows may
"/ not yet be opened or fully initialized so we have to check
"/ for existence of sensor. If application/window is not fully
"/ initialized, process the event as usual.
(anObject isKindOf: ApplicationModel) ifTrue:[
args = 0 ifTrue: [ ^[ | window |
window := anObject window.
window notNil
ifTrue:[ window sensor pushUserEvent: aSelector for: anObject ]
ifFalse:[ anObject perform: aSelector ]
]
].
args = 1 ifTrue: [ ^[ :anAnnouncement | | window |
window := anObject window.
window notNil
ifTrue:[ window sensor pushUserEvent: aSelector for: anObject withArgument: anAnnouncement ]
ifFalse:[ anObject perform: aSelector with: anAnnouncement ]
]
].
args = 1 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | | window |
window := anObject window.
window notNil
ifTrue:[ window sensor pushUserEvent: aSelector for: anObject withArguments: (Array with: anAnnouncement with: anAnnouncer) ]
ifFalse:[ anObject perform: aSelector with: anAnnouncement with: anAnnouncer ]
].
].
self error: 'Couldn''t create block'.
].
^ super blockFor: anObject withSelector: aSelector
"Created: / 18-09-2014 / 00:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 01-10-2018 / 17:30:56 / jv"
! !
!GDBEventSubscription class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !