show source of blocks if possible
authorClaus Gittinger <cg@exept.de>
Wed, 28 May 2003 10:23:53 +0200
changeset 4932 0758cd0b8ce9
parent 4931 ddc7ef975325
child 4933 7e3a4fb72aad
show source of blocks if possible
DebugView.st
--- a/DebugView.st	Wed May 28 10:21:29 2003 +0200
+++ b/DebugView.st	Wed May 28 10:23:53 2003 +0200
@@ -5381,6 +5381,15 @@
     "Modified: / 17.11.2001 / 22:12:16 / cg"
 !
 
+hideStackInspector 
+    stackInspector notNil ifTrue:[
+        stackInspector destroy.
+        stackInspector := nil.
+        receiverInspector origin:(0.0 @ 0.0) corner:0.5 @ 1.0.
+        contextInspector origin:(0.5 @ 0.0) corner:(1.0 @ 1.0)
+    ]
+!
+
 processEvent:anEvent
     "filter keyboard events for popUp variable value display"
 
@@ -5456,9 +5465,9 @@
         s nextPutAll: '**** '; nextPutLine:(con printString).
         con := con sender.
         [con notNil] whileTrue:[
-    Error catch:[:ex |
-            s nextPutAll: '**** '; nextPutLine:(con printString).
-    ].
+            Error catch:[:ex |
+                s nextPutAll: '**** '; nextPutLine:(con printString).
+            ].
 
             con receiver == self ifTrue:[
                 con := nil
@@ -5475,6 +5484,22 @@
     "Modified: / 18.11.2001 / 00:02:32 / cg"
 !
 
+showStackInspectorFor:con 
+    stackInspector isNil ifTrue:[
+        receiverInspector origin:(0.0 @ 0.0) corner:0.3 @ 1.0.
+        contextInspector origin:(0.3 @ 0.0) corner:(0.6 @ 1.0).
+        stackInspector := InspectorView 
+                    origin:(0.6 @ 0.0)
+                    corner:(1.0 @ 1.0)
+                    in:contextInspector superView.
+        stackInspector realize.
+        stackInspector fieldListLabel:'Stack'.
+        stackInspector hideReceiver:true
+    ].
+    stackInspector inspect:(con stackFrame asArray).
+    stackInspector showLast
+!
+
 updateForContext:lineNr
     "show selected code for lineNr in contextList in textView.
      Also used to autoselect an interesting context on entry."
@@ -5534,33 +5559,16 @@
             "/ show a stack inspector sometimes
 
             con hasStackToShow ifTrue:[
-                stackInspector isNil ifTrue:[
-                    receiverInspector origin:(0.0 @ 0.0) corner:0.3 @ 1.0.
-                    contextInspector origin:(0.3 @ 0.0) corner:(0.6 @ 1.0).
-
-                    stackInspector := InspectorView
-                                        origin:(0.6 @ 0.0) corner:(1.0 @ 1.0)
-                                        in:contextInspector superView.
-                    stackInspector realize.
-                    stackInspector fieldListLabel:'Stack'.
-                    stackInspector hideReceiver:true.
-                ].
-                stackInspector inspect:(con stackFrame asArray).
-                stackInspector showLast.
+                self showStackInspectorFor:con
             ] ifFalse:[
-                stackInspector notNil ifTrue:[
-                    stackInspector destroy.
-                    stackInspector := nil.
-                    receiverInspector origin:(0.0 @ 0.0) corner:0.5 @ 1.0.
-                    contextInspector origin:(0.5 @ 0.0) corner:(1.0 @ 1.0).
-                ]
+                self hideStackInspector
             ].
 
             "
              get the home context
             "
             con isBlockContext ifTrue:[
-                homeContext := con methodHome
+                homeContext := con methodHome.
             ] ifFalse:[
                 homeContext := con
             ].
@@ -5579,9 +5587,10 @@
                  mhmh - an optimized block
                  should get the block here, and get the method from
                  that one ...
-                 But in 2.10.x, there is no easy way to get to the block
+                 But in the current version, there is no easy way to get to the block
                  since that one is not in the context.
-                 Starting with 2.11, the new block calling scheme will fix this.
+                 A future new block calling scheme will fix this 
+                 (passing the block instead of the home as block argument).
                 "
 
                 "temporary kludge - peek into the sender context.
@@ -5604,11 +5613,9 @@
                         ].
                     ]
                 ].
-
             ] ifFalse:[
                 "fetch rec here - so we wont need context in doItAction"
                 rec := homeContext receiver.
-
                 sel := homeContext selector.
                 sel notNil ifTrue:[
                     canAccept := true.
@@ -5631,6 +5638,7 @@
                              valueWithReceiver kind of method invocation;
                              if so, grab the method from the sender and show it
                             "
+                            
                             ((sender := homeContext sender) notNil
                             and:[(sender selector startsWith:'valueWithReceiver:')
                             and:[sender receiver isMethod]]) ifTrue:[
@@ -5660,6 +5668,16 @@
 
             code isNil ifTrue:[
                 errMsg := nil.
+                method isNil ifTrue:[
+                    "/ fall back heuristics
+                    con isBlockContext ifTrue:[
+                        ((sender := con sender) notNil
+                        and:[(sender selector startsWith:'value')
+                        and:[sender receiver isBlock]]) ifTrue:[
+                            code := sender receiver source.
+                        ]
+                    ].
+                ].
                 method notNil ifTrue:[
                     Error handle:[:ex |
                         ex signal isControlInterrupt ifTrue:[
@@ -5874,7 +5892,7 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.342 2003-05-14 16:37:23 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.343 2003-05-28 08:23:53 cg Exp $'
 ! !
 
 DebugView initialize!