fast next in subcontext of subblock
authorClaus Gittinger <cg@exept.de>
Wed, 23 Oct 1996 20:13:15 +0200
changeset 803 f8371812c789
parent 802 da3f109853ba
child 804 7861d5447298
fast next in subcontext of subblock
DebugView.st
--- a/DebugView.st	Wed Oct 23 19:32:35 1996 +0200
+++ b/DebugView.st	Wed Oct 23 20:13:15 1996 +0200
@@ -1157,7 +1157,7 @@
 stepOrNext
     |where here s isWrap method lastWrappedConAddr wrappedMethod 
      inBlock left ignore contextBelow lastWrappedContext
-     leftWrap enteredWrap|
+     leftWrap enteredWrap anyStepBlocks belowSteppedContext|
 
     "/ DebuggingDebugger := true
 
@@ -1268,6 +1268,7 @@
     ].
 
     inBlock := false.
+    anyStepBlocks := false.
 
     "/
     "/ is this for a send or a step/next ?
@@ -1307,15 +1308,34 @@
 "/steppedContext print. ' ' print. ((ObjectMemory addressOf:steppedContext)printStringRadix:16) printCR.
 
             where == steppedContext ifFalse:[
-                "
-                 check if we are in a context below steppedContext
-                 (i.e. if steppedContext can be reached from
-                  interrupted context. Not using context-ref but its
-                  address to avoid creation of many useless contexts.)
-                "
+
+                "/ check if we are in a context below steppedContext
+                "/ (i.e. if steppedContext can be reached from
+                "/  interrupted context. Not using context-ref but its
+                "/  address to avoid creation of many useless contexts.)
+
                 inBlock ifFalse:[
                     [where notNil] whileTrue:[
 
+                        "/ if either the receiver or any arg of this context
+                        "/ is a block of the steppedContext, we must really
+                        "/ do a single step. Otherwise, stepping through a
+                        "/ do:-loop would be very difficult.
+
+                        (where receiver isBlock
+                        and:[where receiver home == steppedContext])
+                        ifTrue:[
+                            anyStepBlocks := true.
+                        ] ifFalse:[
+                            where args do:[:arg |
+                                (arg isBlock
+                                and:[arg home == steppedContext])
+                                ifTrue:[
+                                    anyStepBlocks := true.
+                                ]
+                            ]
+                        ].
+
                         DebuggingDebugger == true ifTrue:[
                             ((ObjectMemory addressOf:where) printStringRadix:16)print. ' ' print.
                             where selector printNL.
@@ -1336,9 +1356,11 @@
                               Must flush caches since optimized methods not always
                               look for pending interrupts
                             "
-                            ObjectMemory flushInlineCaches.
-                            (contextBelow notNil 
-                            and:[inBlock not]) ifTrue:[
+'---' printCR.
+contextBelow printCR.
+inBlock printCR.
+
+                            contextBelow notNil ifTrue:[
 "/ 'prepare for unwind-catch' printNL.
 "/ 'con= ' print. contextBelow printCR.
                                 contextBelow selector notNil ifTrue:[
@@ -1352,6 +1374,8 @@
                                 Processor activeProcess forceInterruptOnReturnOf:contextBelow.
                                 StepInterruptPending := nil.
                             ] ifFalse:[
+                                ObjectMemory flushInlineCaches.
+
                                 here selector notNil ifTrue:[
                                     self label:'single stepping - please wait ...(' , here selector , ')'.
                                 ].
@@ -1368,11 +1392,15 @@
                             ^ nil
                         ].
 
-                        where home == steppedContext ifTrue:[
+                        where methodHome == steppedContext methodHome ifTrue:[
                             inBlock := true.
                         ].
 
-                        contextBelow := where.
+                        anyStepBlocks ifFalse:[
+                            inBlock ifFalse:[
+                                contextBelow := where
+                            ]
+                        ].
                         where := where sender
                     ].
                     s := 'context returned'.
@@ -1408,6 +1436,8 @@
             steppedContext := steppedContext home.
             s := 'after step'.
             left := false.
+"/ DebugView enterUnconditional:thisContext withMessage:'debug'.
+
         ]
     ].
 
@@ -1555,7 +1585,7 @@
     self enter:thisContext sender sender
 
     "Created: 14.10.1996 / 12:53:39 / cg"
-    "Modified: 23.10.1996 / 01:20:16 / cg"
+    "Modified: 23.10.1996 / 19:11:27 / cg"
 ! !
 
 !DebugView methodsFor:'menu / button actions'!
@@ -2983,5 +3013,5 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.113 1996-10-23 15:35:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.114 1996-10-23 18:13:15 cg Exp $'
 ! !