Avoid update cycle when handling `=thread-selected` event
When debugger receives `=thread-selected` event it updates the value
of `selectedFrameHolder` (and `selectedThreadHolder`). This in turn
may result in call to `updateAfterSelectedFrameHolderChanged` which
isues `-thread-select` command (this is necessary to sync GDB user
context when user clicks on frame in UI). However, `-thread=select` may
result in another `=thread-selected` event and hence we cycle.
To avoid this endless loop, temporarily suspend updates from holders
when updating frame and thread holder from `=thread-selected` handler.
--- a/VDBDebuggerApplication.st Tue Jun 18 11:14:38 2019 +0100
+++ b/VDBDebuggerApplication.st Thu Jun 20 10:36:20 2019 +0100
@@ -1176,14 +1176,16 @@
frame := selectedFrameHolder value.
frame notNil ifTrue:[
debugger
- send:(GDBMI_thread_select new arguments:(Array with:frame thread id))
- andWait:false.
+ send:(GDBMI_thread_select new arguments:(Array with:frame thread id))
+ andWait:false.
debugger
send:(GDBMI_stack_select_frame new arguments:(Array with:frame level))
andWait:false.
].
"Created: / 27-02-2015 / 13:24:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-06-2019 / 16:15:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 20-06-2019 / 10:07:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
updateAfterSelectedThreadGroupHolderChanged
@@ -1308,11 +1310,18 @@
thread := aGDBThreadSelectedEvent thread.
group := aGDBThreadSelectedEvent threadGroup.
- self selectedFrameHolder value: frame.
- self selectedThreadHolder value: thread.
- self selectedThreadGroupHolder value: group.
+ self selectedFrameHolder withoutUpdating: self do: [
+ self selectedFrameHolder value: frame.
+ ].
+ self selectedThreadHolder withoutUpdating: self do: [
+ self selectedThreadHolder value: thread.
+ ].
+ self selectedThreadGroupHolder withoutUpdating: self do: [
+ self selectedThreadGroupHolder value: group.
+ ].
"Created: / 30-07-2018 / 07:33:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 19-06-2019 / 17:20:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!VDBDebuggerApplication methodsFor:'initialization'!