MiniDebugger.st
changeset 19145 d67d8a5f23a0
parent 19144 2f3d50c4e256
child 19146 29102aa35885
--- a/MiniDebugger.st	Thu Feb 04 13:45:25 2016 +0100
+++ b/MiniDebugger.st	Thu Feb 04 13:47:23 2016 +0100
@@ -576,110 +576,110 @@
     |id proc bool|
 
     commandArg notEmptyOrNil ifTrue:[
-	id := Number readFrom:commandArg onError:nil.
-	id notNil ifTrue:[
-	    proc := Process allSubInstances detect:[:p | p id == id] ifNone:nil.
-	    proc == Processor activeProcess ifTrue:[
-		id := proc := nil
-	    ]
-	] ifFalse:[
-	    commandArg = '-' ifTrue:[
-		bool := false
-	    ] ifFalse:[
-		commandArg = '+' ifTrue:[
-		    bool := true
-		]
-	    ]
-	]
+        id := Number readFrom:commandArg onError:nil.
+        id notNil ifTrue:[
+            proc := Process allSubInstances detect:[:p | p id == id] ifNone:nil.
+            proc == Processor activeProcess ifTrue:[
+                id := proc := nil
+            ]
+        ] ifFalse:[
+            commandArg = '-' ifTrue:[
+                bool := false
+            ] ifFalse:[
+                commandArg = '+' ifTrue:[
+                    bool := true
+                ]
+            ]
+        ]
     ].
 
     (cmd == $w) ifTrue:[
-	proc notNil ifTrue:[
-	    '-------- walkback of process ' errorPrint. id errorPrint. ' -------' errorPrintCR.
-	    self printBacktraceFrom:(proc suspendedContext)
-	] ifFalse:[
-	    id notNil ifTrue:[
-		'no process with id: ' errorPrint. id errorPrintCR.
-	    ] ifFalse:[
-		'-------- walkback of current process -------' errorPrintCR.
-		self printBacktraceFrom:(self getContext)
-	    ]
-	].
-	^ false
+        proc notNil ifTrue:[
+            '-------- walkback of process ' errorPrint. id errorPrint. ' -------' errorPrintCR.
+            self printBacktraceFrom:(proc suspendedContext)
+        ] ifFalse:[
+            id notNil ifTrue:[
+                'no process with id: ' errorPrint. id errorPrintCR.
+            ] ifFalse:[
+                '-------- walkback of current process -------' errorPrintCR.
+                self printBacktraceFrom:(self getContext)
+            ]
+        ].
+        ^ false
     ].
 
     (cmd == $b) ifTrue:[
-	proc notNil ifTrue:[
-	    '-------- VM walkback of process ' errorPrint. id errorPrint. ' -------' errorPrintCR.
-	    ObjectMemory printStackBacktraceFrom:(proc suspendedContext)
-	] ifFalse:[
-	    id notNil ifTrue:[
-		'no process with id: ' errorPrint. id errorPrintCR.
-	    ] ifFalse:[
-		'-------- VM walkback of current process -------' errorPrintCR.
-		ObjectMemory printStackBacktrace
-	    ]
-	].
-	^ false
+        proc notNil ifTrue:[
+            '-------- VM walkback of process ' errorPrint. id errorPrint. ' -------' errorPrintCR.
+            ObjectMemory printStackBacktraceFrom:(proc suspendedContext)
+        ] ifFalse:[
+            id notNil ifTrue:[
+                'no process with id: ' errorPrint. id errorPrintCR.
+            ] ifFalse:[
+                '-------- VM walkback of current process -------' errorPrintCR.
+                ObjectMemory printStackBacktrace
+            ]
+        ].
+        ^ false
     ].
 
     (cmd == $S) ifTrue:[
-	'saving "crash.img"...' errorPrint.
-	ObjectMemory writeCrashImage.
-	'done.' errorPrintCR.
-	^ false
+        'saving "crash.img"...' errorPrint.
+        ObjectMemory writeCrashImage.
+        'done.' errorPrintCR.
+        ^ false
     ].
     (cmd == $C) ifTrue:[
-	|changesFilename|
+        |changesFilename|
 
-	changesFilename := Timestamp now
-	     printStringFormat:'changes_%(year)-%(month)-%(day)__%h:%m:%s.chg'.
-	OperatingSystem isMSWINDOWSlike ifTrue:[ changesFilename replaceAll:$: with:$_ ].
+        changesFilename := Timestamp now
+             printStringFormat:'changes_%(year)-%(month)-%(day)__%h:%m:%s.chg'.
+        OperatingSystem isMSWINDOWSlike ifTrue:[ changesFilename replaceAll:$: with:$_ ].
 
-	ChangeSet current fileOutAs: changesFilename.
-	('saved session changes to "',changesFilename,'".') errorPrintCR.
-	^ false
+        ChangeSet current fileOutAs: changesFilename.
+        ('saved session changes to "',changesFilename,'".') errorPrintCR.
+        ^ false
     ].
 
     (cmd == $B) ifTrue:[
-	self printAllBacktraces.
-	^ false
+        self printAllBacktraces.
+        ^ false
     ].
 
     (cmd == $P) ifTrue:[
-	self showProcesses:#all.
-	^ false
+        self showProcesses:#all.
+        ^ false
     ].
     (cmd == $p) ifTrue:[
-	self showProcesses:#live.
-	^ false
+        self showProcesses:#live.
+        ^ false
     ].
 
     (cmd == $r) ifTrue:[
-	dot receiver errorPrintCR.
-	^ false
+        dot receiver errorPrintCR.
+        ^ false
     ].
 
     (cmd == $i) ifTrue:[
-	(commandArg ? '') withoutSeparators notEmpty ifTrue:[
-	    MiniInspector openOn:(Parser evaluate:commandArg).
-	] ifFalse:[
-	    MiniInspector openOn:(dot receiver).
-	].
-	^ false
+        (commandArg ? '') withoutSeparators notEmpty ifTrue:[
+            MiniInspector openOn:(Parser evaluate:commandArg).
+        ] ifFalse:[
+            MiniInspector openOn:(dot receiver).
+        ].
+        ^ false
     ].
 
     (cmd == $I) ifTrue:[
-	self interpreterLoopWith:nil.
-	^ false
+        self interpreterLoopWith:nil.
+        ^ false
     ].
     (cmd == $E) ifTrue:[
-	Parser evaluate:commandArg.
-	^ false
+        Parser evaluate:commandArg.
+        ^ false
     ].
     (cmd == $e) ifTrue:[
-	(Parser evaluate:commandArg) errorPrintCR.
-	^ false
+        (Parser evaluate:commandArg) errorPrintCR.
+        ^ false
     ].
 
     (cmd == $c) ifTrue:[^ true].
@@ -688,96 +688,101 @@
     (cmd == $a) ifTrue:[^ true].
 
     (cmd == $u) ifTrue:[
-	stepping := false.
-	tracing := false.
-	Processor activeProcess vmTrace:false.
-	^ false
+        stepping := false.
+        tracing := false.
+        Processor activeProcess vmTrace:false.
+        ^ false
     ].
 
     (cmd == $h) ifTrue:[
-	(bool notNil) ifTrue:[
-	    Smalltalk ignoreHalt:bool not.
-	].
-	'halts are ' errorPrint. (Smalltalk ignoreHalt ifTrue:['disabled'] ifFalse:['enabled']) errorPrintCR.
-	^ false
+        (bool notNil) ifTrue:[
+            Smalltalk ignoreHalt:bool not.
+        ].
+        'halts are ' errorPrint. (Smalltalk ignoreHalt ifTrue:['disabled'] ifFalse:['enabled']) errorPrintCR.
+        ^ false
     ].
 
     (cmd == $R) ifTrue:[
-	proc notNil ifTrue:[
-	    proc resume.
-	].
-	^ false
+        proc notNil ifTrue:[
+            proc resume.
+        ].
+        ^ false
     ].
 
     (cmd == $T) ifTrue:[
-	proc notNil ifTrue:[
-	    proc terminate.
-	] ifFalse:[
-	    id notNil ifTrue:[
-		'no process with id: ' errorPrint. id errorPrintCR.
-	    ] ifFalse:[
-		Processor terminateActive
-	    ]
-	].
-	^ false
+        proc notNil ifTrue:[
+            proc terminate.
+        ] ifFalse:[
+            id notNil ifTrue:[
+                'no process with id: ' errorPrint. id errorPrintCR.
+            ] ifFalse:[
+                Processor terminateActive
+            ]
+        ].
+        ^ false
     ].
 
     (cmd == $W) ifTrue:[
-	proc notNil ifTrue:[
-	    'stopping process id: ' errorPrint. id errorPrintCR.
-	    proc stop.
-	] ifFalse:[
-	    'invalid process id: ' errorPrint. id errorPrintCR.
-	].
-	^ false
+        proc notNil ifTrue:[
+            'stopping process id: ' errorPrint. id errorPrintCR.
+            proc stop.
+        ] ifFalse:[
+            'invalid process id: ' errorPrint. id errorPrintCR.
+        ].
+        ^ false
     ].
 
     (cmd == $a) ifTrue:[
-	"without id-arg, this is handled by caller"
-	proc notNil ifTrue:[
-	    'aborting process id: ' errorPrint. id errorPrintCR.
-	    proc interruptWith:[AbortOperationRequest raise]
-	] ifFalse:[
-	    'aborting' errorPrintCR.
-	].
-	^ false
+        "without id-arg, this is handled by caller"
+        proc notNil ifTrue:[
+            'aborting process id: ' errorPrint. id errorPrintCR.
+            proc interruptWith:[AbortOperationRequest raise]
+        ] ifFalse:[
+            'aborting' errorPrintCR.
+        ].
+        ^ false
     ].
 
     (cmd == $Q) ifTrue:[
-	proc notNil ifTrue:[
-	    proc terminateNoSignal.
-	] ifFalse:[
-	    id notNil ifTrue:[
-		'no process with id: ' errorPrint. id errorPrintCR.
-	    ] ifFalse:[
-		Processor terminateActiveNoSignal
-	    ]
-	].
-	^ false
+        proc notNil ifTrue:[
+            proc terminateNoSignal.
+        ] ifFalse:[
+            id notNil ifTrue:[
+                'no process with id: ' errorPrint. id errorPrintCR.
+            ] ifFalse:[
+                Processor terminateActiveNoSignal
+            ]
+        ].
+        ^ false
     ].
 
     (cmd == $g) ifTrue:[
-	self garbageCollectCommand:id.
-	^ false
+        self garbageCollectCommand:id.
+        ^ false
     ].
 
     (cmd == $U) ifTrue:[
-	MessageTracer unwrapAllMethods.
-	^ false
+        MessageTracer unwrapAllMethods.
+        ^ false
     ].
     (cmd == $D) ifTrue:[
-	Breakpoint disableAllBreakpoints.
-	^ false
+        Breakpoint disableAllBreakpoints.
+        ^ false
     ].
     (cmd == $X) ifTrue:[
-	Smalltalk fatalAbort.
-	"/ not reached
-	^ false
+        Smalltalk fatalAbort.
+        "/ not reached
+        ^ false
     ].
     (cmd == $x) ifTrue:[
-	OperatingSystem exit.
-	"/ not reached
-	^ false
+        OperatingSystem exit.
+        "/ not reached
+        ^ false
+    ].
+    (cmd == $R) ifTrue:[
+        Smalltalk start.
+        "/ not reached
+        ^ false
     ].
 
     (cmd == $.) ifTrue:[self printDot. ^ false ].
@@ -786,9 +791,9 @@
     (cmd == $-) ifTrue:[self moveDotUp. self printDot. ^ false ].
     (cmd == $+) ifTrue:[self moveDotDown. self printDot. ^ false ].
     (cmd == $?) ifTrue:[
-	commandArg notEmpty ifTrue:[
-	    self helpOn:commandArg. ^ false
-	]
+        commandArg notEmpty ifTrue:[
+            self helpOn:commandArg. ^ false
+        ]
     ].
 
     "/ avoid usage print if return was typed ...
@@ -1032,6 +1037,7 @@
    S ........ save snapshot into "crash.img"
    C ........ save session changes to a separate change file
    x ........ exit Smalltalk ("X" to exit with core dump)
+   R ........ restart Smalltalk (reopen display, reopen launcher)
 
    . ........ print dot (the current context)
    - ........ move dot up (sender)