added 'S' -> stopp a process
authorClaus Gittinger <cg@exept.de>
Thu, 25 Feb 1999 21:17:04 +0100
changeset 4003 d0f97b9cd4de
parent 4002 341a896cb334
child 4004 b9ce30dcb84c
added 'S' -> stopp a process added optional count-prefix for 'l'-command (only output n contexts)
MiniDebug.st
MiniDebugger.st
--- a/MiniDebug.st	Thu Feb 25 21:16:06 1999 +0100
+++ b/MiniDebug.st	Thu Feb 25 21:17:04 1999 +0100
@@ -11,7 +11,7 @@
 "
 
 Object subclass:#MiniDebugger
-	instanceVariableNames:'tracing stepping traceBlock command commandArg'
+	instanceVariableNames:'tracing stepping traceBlock command commandArg commandCount'
 	classVariableNames:'TheOneAndOnlyDebugger'
 	poolDictionaries:''
 	category:'System-Debugging-Support'
@@ -267,10 +267,24 @@
 !
 
 printBacktraceFrom:aContext
-    aContext notNil ifTrue:[
-	aContext fullPrintAll
-    ] ifFalse:[
-	'no context' errorPrintCR
+    |context n|
+
+    aContext isNil ifTrue:[
+        'no context' errorPrintCR.
+        ^ self
+    ].
+
+    context := aContext.
+    n := commandCount.
+    [context notNil] whileTrue: [
+        context fullPrint.
+        context := context sender.
+        n notNil ifTrue:[
+            n := n - 1.
+            n <= 0 ifTrue:[
+                ^ self
+            ]
+        ]
     ]
 !
 
@@ -337,6 +351,7 @@
                 id notNil ifTrue:[
                     'no process with id: ' print. id printCR.
                 ] ifFalse:[
+                    '-------- VM walkback of current process -------' printCR.
                     ObjectMemory printStackBacktrace
                 ]
             ]
@@ -429,13 +444,23 @@
             ]
         ].
 
-	(cmd == $a) ifTrue:[
-	    "without id-arg, this is handled by caller"
-	    proc notNil ifTrue:[
-		valid := true.
-		proc interruptWith:[AbortSignal raise]
-	    ]
-	].
+        (cmd == $S) ifTrue:[
+            valid := true. 
+            proc notNil ifTrue:[
+                'stopping process id: ' print. id printCR.
+                proc stop.
+            ] ifFalse:[
+                'invalid process id: ' print. id printCR.
+            ]
+        ].
+
+        (cmd == $a) ifTrue:[
+            "without id-arg, this is handled by caller"
+            proc notNil ifTrue:[
+                valid := true.
+                proc interruptWith:[AbortSignal raise]
+            ]
+        ].
 
         (cmd == $Q) ifTrue:[
             valid := true. 
@@ -551,7 +576,7 @@
     UserInterruptSignal handle:[:ex |
         ex restart
     ] do:[
-        |c cmd arg|
+        |c cmd arg cnt|
 
         cmd := Character fromUser.
         cmd isNil ifTrue:[
@@ -562,6 +587,18 @@
             cmd := $c
         ].
 
+        cnt := nil.
+        (cmd isDigit) ifTrue:[
+            cnt := 0.
+            [cmd isDigit] whileTrue:[
+                cnt := cnt * 10 + cmd digitValue.
+                cmd := Character fromUser
+            ].
+            [cmd == Character space] whileTrue:[
+                cmd := Character fromUser
+            ].
+        ].
+
         "
          collect to end-of-line in arg
         "
@@ -573,6 +610,7 @@
         ].
         commandArg := arg copyFrom:2.
         command := cmd.
+        commandCount := cnt.
     ].
     ^ command
 
@@ -639,5 +677,5 @@
 !MiniDebugger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/MiniDebug.st,v 1.39 1998-09-09 16:19:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/MiniDebug.st,v 1.40 1999-02-25 20:17:04 cg Exp $'
 ! !
--- a/MiniDebugger.st	Thu Feb 25 21:16:06 1999 +0100
+++ b/MiniDebugger.st	Thu Feb 25 21:17:04 1999 +0100
@@ -11,7 +11,7 @@
 "
 
 Object subclass:#MiniDebugger
-	instanceVariableNames:'tracing stepping traceBlock command commandArg'
+	instanceVariableNames:'tracing stepping traceBlock command commandArg commandCount'
 	classVariableNames:'TheOneAndOnlyDebugger'
 	poolDictionaries:''
 	category:'System-Debugging-Support'
@@ -267,10 +267,24 @@
 !
 
 printBacktraceFrom:aContext
-    aContext notNil ifTrue:[
-	aContext fullPrintAll
-    ] ifFalse:[
-	'no context' errorPrintCR
+    |context n|
+
+    aContext isNil ifTrue:[
+        'no context' errorPrintCR.
+        ^ self
+    ].
+
+    context := aContext.
+    n := commandCount.
+    [context notNil] whileTrue: [
+        context fullPrint.
+        context := context sender.
+        n notNil ifTrue:[
+            n := n - 1.
+            n <= 0 ifTrue:[
+                ^ self
+            ]
+        ]
     ]
 !
 
@@ -337,6 +351,7 @@
                 id notNil ifTrue:[
                     'no process with id: ' print. id printCR.
                 ] ifFalse:[
+                    '-------- VM walkback of current process -------' printCR.
                     ObjectMemory printStackBacktrace
                 ]
             ]
@@ -429,13 +444,23 @@
             ]
         ].
 
-	(cmd == $a) ifTrue:[
-	    "without id-arg, this is handled by caller"
-	    proc notNil ifTrue:[
-		valid := true.
-		proc interruptWith:[AbortSignal raise]
-	    ]
-	].
+        (cmd == $S) ifTrue:[
+            valid := true. 
+            proc notNil ifTrue:[
+                'stopping process id: ' print. id printCR.
+                proc stop.
+            ] ifFalse:[
+                'invalid process id: ' print. id printCR.
+            ]
+        ].
+
+        (cmd == $a) ifTrue:[
+            "without id-arg, this is handled by caller"
+            proc notNil ifTrue:[
+                valid := true.
+                proc interruptWith:[AbortSignal raise]
+            ]
+        ].
 
         (cmd == $Q) ifTrue:[
             valid := true. 
@@ -551,7 +576,7 @@
     UserInterruptSignal handle:[:ex |
         ex restart
     ] do:[
-        |c cmd arg|
+        |c cmd arg cnt|
 
         cmd := Character fromUser.
         cmd isNil ifTrue:[
@@ -562,6 +587,18 @@
             cmd := $c
         ].
 
+        cnt := nil.
+        (cmd isDigit) ifTrue:[
+            cnt := 0.
+            [cmd isDigit] whileTrue:[
+                cnt := cnt * 10 + cmd digitValue.
+                cmd := Character fromUser
+            ].
+            [cmd == Character space] whileTrue:[
+                cmd := Character fromUser
+            ].
+        ].
+
         "
          collect to end-of-line in arg
         "
@@ -573,6 +610,7 @@
         ].
         commandArg := arg copyFrom:2.
         command := cmd.
+        commandCount := cnt.
     ].
     ^ command
 
@@ -639,5 +677,5 @@
 !MiniDebugger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.39 1998-09-09 16:19:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.40 1999-02-25 20:17:04 cg Exp $'
 ! !