VDBDebuggerApplication.st
changeset 22 6684f4d82301
parent 17 c5ee4ea44165
child 23 ed5f4b55cee5
--- a/VDBDebuggerApplication.st	Sun Sep 21 20:17:16 2014 +0100
+++ b/VDBDebuggerApplication.st	Sun Sep 21 23:46:10 2014 +0100
@@ -1,7 +1,8 @@
 "{ Package: 'jv:vdb' }"
 
 VDBAbstractApplication subclass:#VDBDebuggerApplication
-	instanceVariableNames:'layoutSpecHolder selectedFrameHolder containerBottom'
+	instanceVariableNames:'layoutSpecHolder selectedInferiorHolder selectedThreadHolder
+		selectedFrameHolder containerBottom'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'VGB-UI'
@@ -185,15 +186,21 @@
          label: 'Visual Debugger'
          name: 'Visual Debugger'
          min: (Point 10 10)
-         bounds: (Rectangle 0 0 718 390)
+         bounds: (Rectangle 0 0 800 600)
          menu: mainMenu
        )
        component: 
       (SpecCollection
          collection: (
+          (MenuPanelSpec
+             name: 'ToolBar'
+             layout: (LayoutFrame 0 0 0 0 0 1 25 0)
+             menu: toolbarMenu
+             textDefault: true
+           )
           (SubCanvasSpec
-             name: 'SubCanvas1'
-             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             name: 'Layout'
+             layout: (LayoutFrame 0 0 25 0 0 1 0 1)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              specHolder: layoutSpecHolder
@@ -203,10 +210,83 @@
         
        )
      )
+
+    "Modified: / 21-09-2014 / 21:48:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !VDBDebuggerApplication class methodsFor:'menu specs'!
 
+execMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+
+    "
+     MenuEditor new openOnClass:VDBDebuggerApplication andSelector:#execMenu
+     (Menu new fromLiteralArrayEncoding:(VDBDebuggerApplication execMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            enabled: canExecRunHolder
+            label: 'Run'
+            itemValue: doExecRun
+            labelImage: (ResourceRetriever VDBIconLibrary #'i14089_start_task' 'Run')
+          )
+         (MenuItem
+            enabled: canExecResumeHolder
+            label: 'Resume'
+            itemValue: doExecResume
+            labelImage: (ResourceRetriever VDBIconLibrary #'resume_co' 'Resume')
+          )
+         (MenuItem
+            enabled: canExecSuspendHolder
+            label: 'Suspend'
+            itemValue: doExecSuspend
+            labelImage: (ResourceRetriever VDBIconLibrary #'suspend_co' 'Suspend')
+          )
+         (MenuItem
+            enabled: canExecTerminateHolder
+            label: 'Terminate'
+            itemValue: doExecTerminate
+            labelImage: (ResourceRetriever VDBIconLibrary #'terminate_co' 'Terminate')
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: canExecStepOverHolder
+            label: 'Step Over'
+            itemValue: doExecStepOver
+            labelImage: (ResourceRetriever VDBIconLibrary #'stepover_co' 'Step Over')
+          )
+         (MenuItem
+            enabled: canExecStepIntoHolder
+            label: 'Step Into'
+            itemValue: doExecStepInto
+            labelImage: (ResourceRetriever VDBIconLibrary #'stepinto_co' 'Step Into')
+          )
+         (MenuItem
+            enabled: canExecStepReturnHolder
+            label: 'Step Return'
+            itemValue: doExecStepReturn
+            labelImage: (ResourceRetriever VDBIconLibrary #'stepinto_co' 'Step Return')
+          )
+         )
+        nil
+        nil
+      )
+
+    "Modified: / 21-09-2014 / 22:40:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 mainMenu
     "This resource specification was automatically generated
      by the MenuEditor of ST/X."
@@ -247,34 +327,8 @@
             )
           )
          (MenuItem
-            label: 'Execution'
-            submenu: 
-           (Menu
-              (
-               (MenuItem
-                  enabled: canRunOrContinueHolder
-                  label: 'Run / Continue'
-                  itemValue: doRunOrContinue
-                )
-               (MenuItem
-                  enabled: canStepIntoHolder
-                  label: 'Step Into'
-                  itemValue: doStepIn
-                )
-               (MenuItem
-                  enabled: canStepOverHolder
-                  label: 'Step Over'
-                  itemValue: doStepOver
-                )
-               (MenuItem
-                  enabled: canStepOutHolder
-                  label: 'Step Out'
-                  itemValue: doStepOut
-                )
-               )
-              nil
-              nil
-            )
+            label: 'Run'
+            submenuChannel: execMenu
           )
          (MenuItem
             label: 'Window'
@@ -305,6 +359,13 @@
                   label: 'Inspect Session Record'
                   itemValue: doInspectSessionRecord
                 )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  label: 'Reopen Window'
+                  itemValue: doDebugReopenWindow
+                )
                )
               nil
               nil
@@ -314,6 +375,106 @@
         nil
         nil
       )
+!
+
+toolbarMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+
+    "
+     MenuEditor new openOnClass:VDBDebuggerApplication andSelector:#toolbarMenu
+     (Menu new fromLiteralArrayEncoding:(VDBDebuggerApplication toolbarMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            label: 'Exec Slice'
+            submenuChannel: toolbarMenuExecSlice
+            isMenuSlice: true
+          )
+         )
+        nil
+        nil
+      )
+!
+
+toolbarMenuExecSlice
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+
+    "
+     MenuEditor new openOnClass:VDBDebuggerApplication andSelector:#toolbarMenuExecSlice
+     (Menu new fromLiteralArrayEncoding:(VDBDebuggerApplication toolbarMenuExecSlice)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            enabled: canExecRunHolder
+            label: 'Run'
+            itemValue: doExecRun
+            labelImage: (ResourceRetriever VDBIconLibrary #'i14089_start_task')
+          )
+         (MenuItem
+            enabled: canExecResumeHolder
+            label: 'Resume'
+            itemValue: doExecResume
+            labelImage: (ResourceRetriever VDBIconLibrary #'resume_co')
+          )
+         (MenuItem
+            enabled: canExecSuspendHolder
+            label: 'Srminateuspend'
+            itemValue: doExecSuspend
+            labelImage: (ResourceRetriever VDBIconLibrary #'suspend_co')
+          )
+         (MenuItem
+            enabled: canExecTerminateHolder
+            label: 'Terminate'
+            itemValue: doExecTerminate
+            labelImage: (ResourceRetriever VDBIconLibrary #'terminate_co')
+          )
+         (MenuItem
+            label: '-'
+          )
+         (MenuItem
+            enabled: canExecStepOverHolder
+            label: 'Step Over'
+            itemValue: doExecStepOverRun
+            labelImage: (ResourceRetriever VDBIconLibrary #'stepover_co')
+          )
+         (MenuItem
+            enabled: canExecStepIntoHolder
+            label: 'Step Into'
+            itemValue: doExecStepInto
+            labelImage: (ResourceRetriever VDBIconLibrary #'stepinto_co')
+          )
+         (MenuItem
+            enabled: canExecStepReturnHolder
+            label: 'Step Return'
+            itemValue: doExecStepReturn
+            labelImage: (ResourceRetriever VDBIconLibrary #'stepinto_co')
+          )
+         )
+        nil
+        nil
+      )
+
+    "Modified: / 21-09-2014 / 22:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !VDBDebuggerApplication class methodsFor:'plugIn spec'!
@@ -353,6 +514,7 @@
 
     selectedFrameHolder isNil ifTrue:[
         selectedFrameHolder := ValueHolder new.
+        selectedFrameHolder addDependent:self.
     ].
     ^ selectedFrameHolder
 ! !
@@ -371,8 +533,45 @@
     "Created: / 10-06-2014 / 17:29:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!VDBDebuggerApplication methodsFor:'event handling'!
+
+onRunningEvent: aGDBStoppedEvent
+
+    "Created: / 21-09-2014 / 22:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+onStoppedEvent: aGDBStoppedEvent
+
+    "Created: / 21-09-2014 / 22:44:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+onThreadGroupExitedEvent: aGDBStoppedEvent
+
+    "Created: / 21-09-2014 / 22:45:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBDebuggerApplication methodsFor:'initialization & release'!
+
+subscribe   
+    "Register for debugger events. To be overrided by subclasses"
+
+    debugger announcer
+        when: GDBStoppedEvent       send: #onStoppedEvent:  to: self;
+        when: GDBRunningEvent       send: #onRunningEvent:  to: self;
+        when: GDBThreadGroupExitedEvent send: #onThreadGroupExitedEvent:  to: self.
+
+    "Created: / 21-09-2014 / 22:43:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !VDBDebuggerApplication methodsFor:'menu actions'!
 
+doDebugReopenWindow
+    self closeDownViews.
+    (Smalltalk at: self class name) openFor: debugger.
+
+    "Modified: / 21-09-2014 / 22:26:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 doOpenExecutable
     | file |
 
@@ -397,58 +596,6 @@
     Transcript showCR:self class name, ': action for #doQuit ...'.
 !
 
-doRunOrContinue
-    "automatically generated by UIEditor ..."
-
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be added ..."
-
-    Transcript showCR:self class name, ': action for #doRunOrContinue ...'.
-!
-
-doStepIn
-    "automatically generated by UIEditor ..."
-
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be added ..."
-
-    Transcript showCR:self class name, ': action for #doStepIn ...'.
-!
-
-doStepOut
-    "automatically generated by UIEditor ..."
-
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be added ..."
-
-    Transcript showCR:self class name, ': action for #doStepOut ...'.
-!
-
-doStepOver
-    "automatically generated by UIEditor ..."
-
-    "*** the code below performs no action"
-    "*** (except for some feedback on the Transcript)"
-    "*** Please change as required and accept in the browser."
-    "*** (and replace this comment by something more useful ;-)"
-
-    "action to be added ..."
-
-    Transcript showCR:self class name, ': action for #doStepOver ...'.
-!
-
 doWindowOpen: applicationClassName        
     | applicationClass application screen |
 
@@ -477,6 +624,56 @@
     "Modified: / 17-09-2014 / 23:36:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!VDBDebuggerApplication methodsFor:'menu actions-exec'!
+
+doExec: command
+    debugger send: command
+
+    "Created: / 21-09-2014 / 21:50:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecResume
+    self doExec: GDBMI_exec_continue new.
+
+    "Modified: / 21-09-2014 / 21:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecRun
+    self doExec: GDBMI_exec_run new.
+
+    "Modified: / 21-09-2014 / 21:51:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecStepInto
+    self doExec: GDBMI_exec_step new.
+
+    "Modified: / 21-09-2014 / 21:52:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecStepOver
+    self doExec: GDBMI_exec_next new.
+
+    "Modified: / 21-09-2014 / 21:52:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecStepReturn
+    self doExec: GDBMI_exec_finish new.
+
+    "Modified: / 21-09-2014 / 21:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecSuspend
+    self doExec: GDBMI_exec_interrupt new
+
+    "Modified: / 21-09-2014 / 21:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+doExecTerminate
+    self notYetImplemented
+
+    "Modified: / 21-09-2014 / 21:52:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !VDBDebuggerApplication methodsFor:'menu queries'!
 
 canRunOrContinueHolder