UI: add a menu item to attach another debugger to cuurrent GDB
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 23 Apr 2019 13:58:59 +0100
changeset 156 6295a4afb286
parent 155 85d7d83f4280
child 157 e08810465090
UI: add a menu item to attach another debugger to cuurrent GDB This is only useful to debug crashing GDB (yes, even debugger crashes and has to be debugged)
VDBDebuggerApplication.st
--- a/VDBDebuggerApplication.st	Tue Mar 26 11:26:57 2019 +0000
+++ b/VDBDebuggerApplication.st	Tue Apr 23 13:58:59 2019 +0100
@@ -744,7 +744,7 @@
                   isVisible: true
                   choice: layoutSpecHolder
                   choiceValue: layoutIDAProSpec
-                ) 
+                )
                (MenuItem
                   label: 'Console-Only Layout'
                   isVisible: true
@@ -842,6 +842,15 @@
                   itemValue: doDebugReopenLauncher
                   isVisible: true
                 )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  enabled: canDebugOpenAndAttachToGDB
+                  label: 'Open & Attach to GDB Process'
+                  itemValue: doDebugOpenAndAttachToGDB
+                  isVisible: true
+                )
                )
               nil
               nil
@@ -851,8 +860,6 @@
         nil
         nil
       )
-
-    "Modified: / 05-10-2018 / 09:14:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 toolbarMenu
@@ -1430,6 +1437,16 @@
     "Modified: / 31-08-2018 / 22:51:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+doDebugOpenAndAttachToGDB
+    | debuggerOnGDB |
+
+    debuggerOnGDB := debugger class newWithProcess: (debugger process class newWithCommand: debugger process command).
+    self class openFor: debuggerOnGDB.
+    debuggerOnGDB attach: debugger process id.
+
+    "Modified: / 28-03-2019 / 12:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 doDebugReopenDebugger
     | d |
 
@@ -1638,6 +1655,14 @@
     "Modified: / 26-07-2018 / 22:00:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+canDebugOpenAndAttachToGDB
+    <resource: #uiCallback>
+
+    ^ [ debugger notNil and:[ debugger process isLocal ] ]
+
+    "Modified: / 27-03-2019 / 09:40:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 canViewEnableFrameFilters
     ^ [ debugger isFrameFiltersEnabled not ]