Merge
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 26 Mar 2019 11:26:57 +0000
changeset 155 85d7d83f4280
parent 154 26937faa5a97 (current diff)
parent 153 063fd7d1d5be (diff)
child 156 6295a4afb286
Merge
VDBBreakpointListApplication.st
--- a/VDBBreakpointListApplication.st	Mon Feb 18 10:55:12 2019 +0000
+++ b/VDBBreakpointListApplication.st	Tue Mar 26 11:26:57 2019 +0000
@@ -10,7 +10,7 @@
 
 "{ NameSpace: Smalltalk }"
 
-VDBAbstractListApplication subclass:#VDBBreakpointListApplication
+VDBAbstractTreeApplication subclass:#VDBBreakpointListApplication
 	instanceVariableNames:'selectedBreakpointHolder'
 	classVariableNames:''
 	poolDictionaries:''
@@ -59,10 +59,12 @@
     ^ 
     #(FullSpec
        name: windowSpec
+       uuid: '8774fbe0-4fb0-11e9-b432-606720e43e2c'
        window: 
       (WindowSpec
          label: 'VDBAbstractListApplication'
          name: 'VDBAbstractListApplication'
+         uuid: '475530e1-4fae-11e9-b432-606720e43e2c'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 300 577)
        )
@@ -72,14 +74,16 @@
           (VariableVerticalPanelSpec
              name: 'VariableVerticalPanel1'
              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             uuid: '475530e2-4fae-11e9-b432-606720e43e2c'
              showHandle: true
              snapMode: both
              handlePosition: left
              component: 
             (SpecCollection
                collection: (
-                (SelectionInListModelViewSpec
-                   name: 'SelectionInListModelView1'
+                (HierarchicalListViewSpec
+                   name: 'Breakpoints'
+                   uuid: '475530e3-4fae-11e9-b432-606720e43e2c'
                    model: internalSelectionHolder
                    menu: contextMenu
                    hasHorizontalScrollBar: true
@@ -88,10 +92,14 @@
                    useIndex: false
                    highlightMode: line
                    doubleClickSelector: doDoubleClick
+                   showLines: false
+                   useDefaultIcons: false
+                   showRoot: false
                    postBuildCallback: postBuildInternalListView:
                  )
                 (SubCanvasSpec
                    name: 'BreakpointCanvas'
+                   uuid: '475557f0-4fae-11e9-b432-606720e43e2c'
                    hasHorizontalScrollBar: false
                    hasVerticalScrollBar: false
                    majorKey: VDBBreakpointApplication
@@ -119,8 +127,6 @@
         
        )
      )
-
-    "Modified (format): / 14-07-2017 / 10:28:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !VDBBreakpointListApplication class methodsFor:'plugIn spec'!
@@ -176,13 +182,19 @@
 !VDBBreakpointListApplication methodsFor:'change & update-delayed'!
 
 delayedUpdateInternalList
-    | oldBreakpointPs newBreakpointPs |
+    | root list |
 
-    oldBreakpointPs := self internalListHolder value.
-    newBreakpointPs := debugger breakpoints collect:[ :e| VDBBreakpointPresenter new setBreakpoint: e ].
-    self internalListHolder value: newBreakpointPs.
+    debugger isNil ifTrue:[
+        self internalListHolder root children:#().
+        ^ self.
+    ].  
+    root := self internalListHolder root.
+    list := debugger breakpoints collect:[:b | VDBBreakpointPresenter new setBreakpoint: b; parent: root ].
+    root children:list.
+    root expand.
+    self delayedInvalidateInternalList
 
-    "Modified: / 10-07-2017 / 13:37:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-03-2019 / 10:17:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 delayedUpdateSelection
--- a/VDBBreakpointPresenter.st	Mon Feb 18 10:55:12 2019 +0000
+++ b/VDBBreakpointPresenter.st	Tue Mar 26 11:26:57 2019 +0000
@@ -87,37 +87,57 @@
             location := breakpoint propertyAt: 'what'.
             aStream nextPutAll: location ? '??'.
         ] ifFalse:[
+            | func |
             aStream nextPutAll: 'B '.
             breakpoint number printOn:aStream.
             aStream nextPutAll:', '.
+
+            func := breakpoint func.
+            func isNil and:[  
+                func := breakpoint propertyAt:'original-location'
+            ].
     
-            breakpoint func notNil ifTrue:[ 
+            func notNil ifTrue:[ 
                 aStream nextPutAll:'in '.
-                breakpoint func printOn:aStream.   
-                aStream nextPutAll:'(), '. 
+                func printOn:aStream.   
+                "/ I (JV) prefer to have () after plain C function names. GDB seems to
+                "/ to add them for C functions but does add them for C++ functions / methods
+                "/ (well. perhaps this is compile who does that, does not matter).
+                "/ 
+                "/ So, if there's no $(, assume it's a C function and add () at the end.
+                "/ We'll see how this works...
+                (func includes: $() ifFalse:[
+                    aStream nextPutAll:'()'. 
+                ].
+                aStream nextPutAll:', '
             ].
-            breakpoint file notNil ifTrue:[
-                breakpoint file printOn:aStream.
-                aStream nextPut:$:.
-                breakpoint line printOn:aStream.
-            ] ifFalse:[ 
-                | addr |
+            breakpoint hasMultipleLocations ifTrue:[ 
+                breakpoint locations size printOn: aStream.
+                aStream nextPutAll: ' locations'.
+            ] ifFalse:[
+                breakpoint file notNil ifTrue:[
+                    breakpoint file printOn:aStream.
+                    aStream nextPut:$:.
+                    breakpoint line printOn:aStream.
+                ] ifFalse:[ 
+                    | addr |
 
-                addr := breakpoint addr.
-                addr isNil ifTrue:[ 
-                    aStream nextPutAll:'at ??'.
-                ] ifFalse:[addr isInteger ifTrue:[
-                    aStream nextPutAll:'at 0x'.
-                    addr printOn: aStream radix: 16
-                ] ifFalse:[ 
-                    addr printOn: aStream
-                ]].
-            ].                                                  
+                    addr := breakpoint addr.
+                    addr isNil ifTrue:[ 
+                        aStream nextPutAll:'at ??'.
+                    ] ifFalse:[addr isInteger ifTrue:[
+                        aStream nextPutAll:'at 0x'.
+                        addr printOn: aStream radix: 16
+                    ] ifFalse:[ 
+                        addr printOn: aStream
+                    ]].
+                ].      
+            ].
         ]
     ].
 
     "Created: / 10-07-2017 / 13:30:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-01-2019 / 21:13:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-03-2019 / 10:58:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 subject
@@ -164,6 +184,18 @@
     "Created: / 05-02-2018 / 12:26:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!VDBBreakpointPresenter methodsFor:'private'!
+
+fetchChildren
+    breakpoint hasMultipleLocations ifTrue:[
+        ^ breakpoint locations collect:[ :l | VDBBreakpointPresenter new setBreakpoint: l; parent: self ]
+    ] ifFalse:[ 
+        ^ #()
+    ].
+
+    "Created: / 26-03-2019 / 10:10:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !VDBBreakpointPresenter methodsFor:'testing'!
 
 isBreakpointPresenter
--- a/VDBSimpleConsoleView.st	Mon Feb 18 10:55:12 2019 +0000
+++ b/VDBSimpleConsoleView.st	Tue Mar 26 11:26:57 2019 +0000
@@ -215,10 +215,11 @@
         ^ self
     ].
 
-    (#(Shift_L Shift_R 
-      Control_L Control_R 
-      Alt_L Alt_R 
-      Caps_Lock 
+    (#(Shift Shift_L Shift_R 
+      Ctrl Control Control_L Control_R 
+      Cmd Alt Alt_L Alt_R 
+      Win_L Menu
+      Caps_Lock Escape
       PreviousPage NextPage
       Copy Paste Insert
     ) includes: key) ifTrue:[
@@ -230,6 +231,7 @@
 
     "Created: / 24-01-2019 / 22:02:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 26-01-2019 / 22:36:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-03-2019 / 14:11:13 / jv"
 !
 
 keyPressBackSpace
--- a/VDBSimpleDebuggerConsoleApplication.st	Mon Feb 18 10:55:12 2019 +0000
+++ b/VDBSimpleDebuggerConsoleApplication.st	Tue Mar 26 11:26:57 2019 +0000
@@ -11,7 +11,7 @@
 "{ NameSpace: Smalltalk }"
 
 VDBAbstractConsoleApplication subclass:#VDBSimpleDebuggerConsoleApplication
-	instanceVariableNames:'prompt promptPrinted running'
+	instanceVariableNames:'prompt promptPrinted running ignoreNextLogEvent'
 	classVariableNames:''
 	poolDictionaries:'GDBCommandStatus'
 	category:'VDB-UI-Console'
@@ -96,25 +96,32 @@
         "/
         "/ See GDB manual, Section 5.5.3 Background Execution
 
-        (#('run' 
-           'attach' 
-           'step' 'stepi' 'next' 'nexti' 
-           'continue' 'until' 'finish' 
-           'rn' 'rns' 'rs' 'rsi' 'rc') includes: cmd operation) ifTrue:[ 
-            cmd runOnBackground: true.      
-        ].
+        (#('run' 'attach') includes: cmd operation) ifTrue:[ 
+            "/ Sigh, background command execution is not supported by some
+            "/ targets, most notably by Windows native target. However, at this
+            "/ point we don't know which target we will use therefore we cannot
+            "/ check target features. 
+            "/ 
+            "/ Therefore make a guess and assime we gonna use native target.
+            "/ This is so bad, this *absolutely* has to be fixed somehow.
+            cmd runOnBackground: debugger nativeTargetHasFeatureAsync.
+        ] ifFalse:[ (#('step' 'stepi' 'next' 'nexti' 'continue' 'until' 'finish' 'rn' 'rns' 'rs' 'rsi' 'rc') includes: cmd operation) ifTrue:[ 
+            debugger hasFeatureAsync ifTrue:[
+                cmd runOnBackground: true.      
+            ].
+        ]].
     ].
-    consoleView readOnly:true.  
+    consoleView readOnly:true. 
+    ignoreNextLogEvent := true.
     debugger send:cmd andWithResultDo:[:result| 
-        result isError ifTrue:[ 
-            consoleView showCR: (result propertyAt: #msg)
-        ].
         consoleView readOnly:false.
+        ignoreNextLogEvent := false.
         self showPrompt.
     ].
 
     "Created: / 25-01-2019 / 12:12:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 29-01-2019 / 09:37:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-03-2019 / 14:02:22 / jv"
 ! !
 
 !VDBSimpleDebuggerConsoleApplication methodsFor:'aspects'!
@@ -135,6 +142,16 @@
     "Created: / 19-01-2019 / 22:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+onLogOutputEvent: event
+    ignoreNextLogEvent ifTrue:[
+        ignoreNextLogEvent := false.
+    ] ifFalse:[
+        self onStreamOutputEvent: event
+    ].
+
+    "Created: / 13-03-2019 / 13:59:39 / jv"
+!
+
 onRunningEvent: event
     running := true.
     consoleView readOnly: true.
@@ -180,10 +197,11 @@
     prompt := '(gdb) '.
     promptPrinted := false.
     running := false.
+    ignoreNextLogEvent := false
 
     "Created: / 10-06-2014 / 01:23:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 07-04-2018 / 23:13:27 / jv"
     "Modified: / 25-01-2019 / 22:01:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-03-2019 / 14:01:53 / jv"
 !
 
 initializeConsoleView: view
@@ -224,6 +242,7 @@
         when: GDBStoppedEvent           send: #onStoppedEvent:          to: self;
 
         when: GDBConsoleOutputEvent     send: #onStreamOutputEvent:     to: self;
+        when: GDBLogOutputEvent         send: #onLogOutputEvent:        to: self;
         when: GDBTargetOutputEvent      send: #onStreamOutputEvent:     to: self;
 
         when: GDBCmdParamChangedEvent   send: #onCmdParamChanged:       to: self.
@@ -232,6 +251,7 @@
 
     "Created: / 06-06-2014 / 21:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 25-01-2019 / 12:33:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-03-2019 / 13:59:19 / jv"
 ! !
 
 !VDBSimpleDebuggerConsoleApplication methodsFor:'private'!