DebugView.st
changeset 13666 72c4ba297f65
parent 13641 8b66149100f6
child 13764 225df800cafd
--- a/DebugView.st	Wed Nov 06 20:31:52 2013 +0100
+++ b/DebugView.st	Wed Nov 06 21:01:54 2013 +0100
@@ -469,40 +469,24 @@
         ('DebugView [info]: breakpoint on:' , ex suspendedContext printString) infoPrintCR.
         ex proceed
     ] do:[
+        |debugger|
+
         "
          well, it could be a stepping or sending debugger up there;
          in this case, return to it. This happens, when a stepping process
          runs into an error (for example, a halt). In this case, we want the
          stepping debugger to come up again instead of a new one.
         "
-        OpenDebuggers notNil ifTrue:[
-            active := Processor activeProcess.
-            OpenDebuggers do:[:aDebugger |
-                |debuggersProcess|
-
-                (aDebugger notNil and:[aDebugger ~~ 0]) ifTrue:[
-                    debuggersProcess := aDebugger inspectedProcess.
-                    debuggersProcess == active ifTrue:[
-                        aDebugger device isOpen ifTrue:[
-                            DebuggingDebugger == true ifTrue:[
-                                'reusing cached debugger' errorPrintCR.
-                            ].
-                            aDebugger unstep.
-                            aDebugger setLabelFor:aString in:active.
-                            aDebugger mayProceed:mayProceed.
-                            ^ aDebugger enter:aContext select:nil.
-                        ]
-                    ].
-                    (debuggersProcess notNil and:[ debuggersProcess isDead ]) ifTrue:[
-                        aDebugger destroy.
-                    ].
-                ]
-            ]
+        (debugger := self openDebuggerForActiveProcess) notNil ifTrue:[
+            debugger unstep.
+            debugger setLabelFor:aString in:active.
+            debugger mayProceed:mayProceed.
+            ^ debugger enter:aContext select:nil.
         ].
     ].
     ^ self enterUnconditional:aContext withMessage:aString mayProceed:mayProceed
 
-    "Modified: / 17-07-2012 / 19:08:18 / cg"
+    "Modified: / 06-11-2013 / 20:58:54 / cg"
 !
 
 enterException:ex
@@ -663,6 +647,46 @@
     "Modified: 1.1.1970 / 23:27:06 / cg"
 !
 
+openDebuggerForActiveProcess
+    "return an already open debugger for the active process, or nil, if there is none.
+     Open debuggers exist when stepping only, as then, the debugger is left open until the step
+     is reached, to avoid too much flickering and redrawing on the screen"
+
+    |active|
+
+    "
+     well, it could be a stepping or sending debugger up there;
+     in this case, return to it. This happens, when a stepping process
+     runs into an error (for example, a halt). In this case, we want the
+     stepping debugger to come up again instead of a new one.
+    "
+    OpenDebuggers notNil ifTrue:[
+        active := Processor activeProcess.
+        OpenDebuggers do:[:aDebugger |
+            |debuggersProcess|
+
+            (aDebugger notNil and:[aDebugger ~~ 0]) ifTrue:[
+                debuggersProcess := aDebugger inspectedProcess.
+                debuggersProcess == active ifTrue:[
+                    aDebugger device isOpen ifTrue:[
+                        DebuggingDebugger == true ifTrue:[
+                            'reusing cached debugger' errorPrintCR.
+                        ].
+                        aDebugger unstep.
+                        ^ aDebugger.
+                    ]
+                ].
+                (debuggersProcess notNil and:[ debuggersProcess isDead ]) ifTrue:[
+                    aDebugger destroy.
+                ].
+            ]
+        ]
+    ].
+    ^ nil
+
+    "Created: / 06-11-2013 / 20:57:49 / cg"
+!
+
 openOn:aProcess
     "start a  debugger on aProcess
      (actually not more than a good-looking inspector)"
@@ -9025,15 +9049,15 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.640 2013-10-17 11:22:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.641 2013-11-06 20:01:54 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.640 2013-10-17 11:22:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.641 2013-11-06 20:01:54 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: DebugView.st,v 1.640 2013-10-17 11:22:34 cg Exp $'
+    ^ '$Id: DebugView.st,v 1.641 2013-11-06 20:01:54 cg Exp $'
 ! !