MiniDebugger.st
author Claus Gittinger <cg@exept.de>
Mon, 03 Sep 2001 18:16:10 +0200
changeset 5942 e3431a2c33f1
parent 5921 1c57ce7ad684
child 6204 2bafef9151dd
permissions -rw-r--r--
avoid statements after return
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
    13
"{ Package: 'stx:libbasic' }"
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
    14
720
f31e0e5ab6e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
    15
Object subclass:#MiniDebugger
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    16
	instanceVariableNames:'tracing stepping traceBlock command commandArg commandCount
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
    17
		enteringContext dot nesting'
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    18
	classVariableNames:'TheOneAndOnlyDebugger'
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    19
	poolDictionaries:''
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    20
	category:'System-Debugging-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    22
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    23
!MiniDebugger class methodsFor:'documentation'!
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    24
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    25
copyright
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    26
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    27
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
    28
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    29
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    30
 This software is furnished under a license and may be used
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    31
 only in accordance with the terms of that license and with the
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    33
 be provided or otherwise made available to, or used by, any
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    34
 other person.  No title to or ownership of the software is
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    35
 hereby transferred.
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    36
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    37
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    38
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    39
documentation
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    40
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    41
    a primitive (non graphical) debugger for use on systems without
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    42
    graphics or when the real debugger dies (i.e. an error occurs in
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    43
    the graphical debugger).
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
    44
    Also, if an interrupt occurs within the debuger, this one is called
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
    45
    for.
1297
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    46
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    47
    [author:]
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    48
        Claus Gittinger
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    49
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    50
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    51
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    52
!MiniDebugger class methodsFor:'instance creation'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    53
4572
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
    54
enter:aContext withMessage:aString mayProceed:mayProceed
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    55
    "enter a miniDebugger"
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    56
4960
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    57
    |active con|
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    58
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    59
    StepInterruptPending := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    60
2661
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    61
    Object errorSignal handle:[:ex |
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    62
        ex return
2661
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    63
    ] do:[
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    64
        thisContext isRecursive ifTrue:[
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    65
            "/ 'recursive error in debugger ignored' errorPrintCR.
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    66
            ^ self
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
    67
        ].
2661
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    68
        aString printCR.
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    69
        Processor notNil ifTrue:[
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    70
            active := Processor activeProcess.
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    71
            'process: id=' print. active id print. 
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    72
            ' name=' print. active name printCR.
4960
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    73
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    74
	    'context: ' print. aContext printString printCR.
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    75
	    (con := aContext) notNil ifTrue:[
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    76
		con := con sender.
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    77
		' ......: ' print. con printString printCR.
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    78
	        [con notNil] whileTrue:[
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    79
		    con := con sender.
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    80
		    ' ......: ' print. con printString printCR.
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    81
	        ]
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
    82
	    ]
2661
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    83
        ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    84
    ].
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    85
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    86
    OperatingSystem hasConsole ifFalse:[
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    87
        Object errorSignal handle:[:ex |
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    88
            ex return
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    89
        ] do:[
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    90
            self warn:('Unexpected error:\' , aString , '\\No MiniDebugger functionality available') withCRs .
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    91
        ].
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    92
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    93
        Object errorSignal handle:[:ex |
4961
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
    94
	    'cannot raise AbortSignal - exiting ...' errorPrintCR.
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
    95
            Smalltalk exit.
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    96
        ] do:[
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    97
            AbortSignal raise.
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    98
        ]
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
    99
    ] ifTrue:[
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   100
        self new enter:aContext mayProceed:mayProceed.
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   101
    ].
4961
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
   102
    mayProceed ifFalse:[
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
   103
	AbortSignal raise
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
   104
    ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   105
    ^ nil
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   106
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   107
    "Modified: / 19.5.1999 / 18:14:33 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   108
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   109
4572
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   110
enterWithMessage:aString mayProceed:mayProceed
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   111
    "enter a miniDebugger"
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   112
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   113
    self enter:thisContext sender withMessage:aString mayProceed:mayProceed
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   114
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   115
    "Modified: / 19.5.1999 / 18:14:33 / cg"
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   116
!
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   117
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   118
new
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   119
    "redefined to make certain that there is only one miniDebugger
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   120
     in the system"
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   121
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   122
    ^ self basicNew initialize.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   123
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   124
"/    TheOneAndOnlyDebugger isNil ifTrue:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   125
"/        TheOneAndOnlyDebugger := self basicNew initialize
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   126
"/    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   127
"/    ^ TheOneAndOnlyDebugger
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   128
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   129
    "
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   130
     TheOneAndOnlyDebugger := nil
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   131
    "
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   132
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   133
    "Modified: / 31.7.1998 / 17:08:07 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   135
4966
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   136
openOn:aProcess
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   137
    "enter a miniDebugger"
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   138
5054
496c424af40a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4966
diff changeset
   139
    self 
496c424af40a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4966
diff changeset
   140
        enter:thisContext sender 
496c424af40a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4966
diff changeset
   141
        withMessage:'MiniDebugger [info]: Attention - process debugging not possible.' 
496c424af40a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4966
diff changeset
   142
        mayProceed:true
4966
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   143
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   144
    "Modified: / 19.5.1999 / 18:14:33 / cg"
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   145
!
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   146
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   147
singleStep:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   148
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   149
a27a279701f8 Initial revision
claus
parents:
diff changeset
   150
    aDebugger := self new stepping.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   151
    ObjectMemory stepInterruptHandler:aDebugger.
2
claus
parents: 1
diff changeset
   152
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   153
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   154
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   155
    aBlock value.
2
claus
parents: 1
diff changeset
   156
    StepInterruptPending := nil.
claus
parents: 1
diff changeset
   157
    ObjectMemory stepInterruptHandler:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   158
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   159
a27a279701f8 Initial revision
claus
parents:
diff changeset
   160
trace:aBlock
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   161
    self trace:aBlock with:[:where | where printCR]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   162
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   163
    "Modified: 20.5.1996 / 10:27:37 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   164
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   165
a27a279701f8 Initial revision
claus
parents:
diff changeset
   166
trace:aBlock on:aStream
a27a279701f8 Initial revision
claus
parents:
diff changeset
   167
    self trace:aBlock with:[:where | where printString printOn:aStream.
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   168
				     aStream cr]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   169
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
trace:aBlock with:aTraceBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   173
a27a279701f8 Initial revision
claus
parents:
diff changeset
   174
    aDebugger := self new tracingWith:aTraceBlock.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   175
    ObjectMemory stepInterruptHandler:aDebugger.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   176
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   177
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   178
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   179
    aBlock value.
2
claus
parents: 1
diff changeset
   180
    ObjectMemory stepInterruptHandler:nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   181
    StepInterruptPending := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   182
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
   183
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   184
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   185
!MiniDebugger methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   186
a27a279701f8 Initial revision
claus
parents:
diff changeset
   187
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   188
    traceBlock := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   189
    tracing := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   190
    stepping := false
a27a279701f8 Initial revision
claus
parents:
diff changeset
   191
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   192
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   193
!MiniDebugger methodsFor:'interrupt handling'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   194
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   195
enter:aContext mayProceed:mayProceed
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   196
    |c leaveCmd stillHere yesNo|
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   197
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   198
    enteringContext := dot := aContext.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   199
    nesting := 0.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   200
    c := aContext.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   201
    [c notNil] whileTrue:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   202
	c selector == #enter:mayProceed: ifTrue:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   203
	    nesting := nesting + 1.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   204
	].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   205
	c := c sender.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   206
    ].
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   207
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   208
    stillHere := true.
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   209
    [stillHere] whileTrue:[
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   210
	AbortSignal handle:[:ex |
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   211
	    '** Abort Signal cought - back in previous debugLevel' printCR.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   212
	] do:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   213
	    Object errorSignal handle:[:ex |
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   214
	        'Error while executing command: ' print.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   215
		ex description printCR.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   216
                yesNo := self getCommand:'- (i)gnore / (p)roceed / (d)ebug ? '.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   217
	        yesNo == $d ifTrue:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   218
		    ex reject
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   219
	        ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   220
	        yesNo == $p ifTrue:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   221
		    ex proceed
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   222
	        ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   223
	    ] do:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   224
                leaveCmd := self commandLoop.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   225
	    ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   226
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   227
3769
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   228
        (leaveCmd == $s) ifTrue: [
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   229
            self stepping.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   230
            ObjectMemory flushInlineCaches.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   231
            ObjectMemory stepInterruptHandler:self.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   232
            stillHere := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   233
            StepInterruptPending := 1.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   234
            InterruptPending := 1
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   235
        ].
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   236
        (leaveCmd == $t) ifTrue: [
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   237
            traceBlock := [:where | where fullPrint].
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   238
            ObjectMemory flushInlineCaches.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   239
            ObjectMemory stepInterruptHandler:self.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   240
            stillHere := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   241
            StepInterruptPending := 1.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   242
            InterruptPending := 1
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   243
        ].
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   244
        (leaveCmd == $c) ifTrue: [
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   245
            traceBlock := nil.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   246
            stillHere := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   247
            stepping := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   248
            tracing := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   249
            StepInterruptPending := nil.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   250
            InterruptPending := nil
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   251
        ].
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   252
        (leaveCmd == $a) ifTrue: [
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   253
            "abort"
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   254
            stepping := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   255
            tracing := false.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   256
            StepInterruptPending := nil.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   257
            InterruptPending := nil.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   258
            self doAbort.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   259
            stillHere := true.
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   260
            "failed abort"
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   261
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   262
    ].
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   263
    enteringContext := dot := nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   264
    ^ nil
3769
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   265
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   266
    "Modified: / 18.8.1998 / 18:10:29 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   267
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   268
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   269
stepInterrupt
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   270
    |where|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   271
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   272
    where := thisContext.        "where is stepInterrupt context"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   273
    where notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   274
        where := where sender    "where is now interrupted methods context"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   275
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   276
    stepping ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   277
        where notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   278
            where fullPrint
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   279
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   280
            'stepInterrupt: no context' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   281
        ].
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   282
        self enter:where mayProceed:true
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   283
    ] ifFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   284
        where notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   285
            traceBlock notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   286
                traceBlock value:where
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   287
            ]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   288
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   289
            'traceInterrupt: no context' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   290
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   291
        ObjectMemory flushInlineCaches.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   292
        StepInterruptPending := 1.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   293
        InterruptPending := 1
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   294
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   295
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   296
    "Modified: 20.5.1996 / 10:23:11 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   297
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   298
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   299
!MiniDebugger methodsFor:'private'!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   300
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   301
findContext:aSelector
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   302
    |con|
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   303
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   304
    con := thisContext sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   305
    [con notNil] whileTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   306
	(con isBlockContext not and:[con selector == aSelector]) ifTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   307
	    "got it"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   308
	    ^ con
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   309
	].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   310
	con := con sender
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   311
    ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   312
    ^ nil
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   313
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   314
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   315
getContext
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   316
    |backtrace|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   317
    backtrace := thisContext.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   318
    (backtrace notNil) ifTrue: [
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   319
	"remove Context getContext frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   320
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   321
	"remove Debugger showContext frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   322
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   323
	"remove Debugger commandLoop frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   324
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   325
	"remove Debugger enter frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   326
	backtrace := backtrace sender
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   327
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   328
    ^ backtrace
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   329
!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   330
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   331
moveDotDown
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   332
    "/ sigh - must search
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   333
    |c|
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   334
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   335
    c := enteringContext.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   336
    [ c notNil and:[ c sender ~~ dot ] ] whileTrue:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   337
	c := c sender.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   338
    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   339
    c notNil ifTrue:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   340
	dot := c.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   341
	self printDot.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   342
    ] ifFalse:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   343
	'** dot is the bottom of the calling chain' printCR. 
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   344
    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   345
!
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   346
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   347
moveDotUp
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   348
    dot sender notNil ifTrue:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   349
	dot := dot sender.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   350
	self printDot.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   351
    ] ifFalse:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   352
	'** dot is the top of the calling chain' printCR.
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   353
    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   354
!
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   355
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   356
printBacktraceFrom:aContext
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   357
    |context n|
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   358
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   359
    aContext isNil ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   360
        'no context' errorPrintCR.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   361
        ^ self
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   362
    ].
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   363
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   364
    context := aContext.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   365
    n := commandCount.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   366
    [context notNil] whileTrue: [
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   367
        context fullPrint.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   368
        context := context sender.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   369
        n notNil ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   370
            n := n - 1.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   371
            n <= 0 ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   372
                ^ self
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   373
            ]
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   374
        ]
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   375
    ]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   376
!
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   377
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   378
printDot
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   379
    dot fullPrint
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   380
!
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   381
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   382
stepping
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   383
    traceBlock := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   384
    tracing := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   385
    stepping := true
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   386
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   387
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   388
tracingWith:aBlockOrNil
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   389
    traceBlock := aBlockOrNil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   390
    stepping := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   391
    tracing := true
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   392
! !
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   393
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   394
!MiniDebugger methodsFor:'user commands'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   395
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   396
commandLoop
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   397
    |cmd done valid context id proc|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   398
a27a279701f8 Initial revision
claus
parents:
diff changeset
   399
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   400
    [done] whileFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   401
        valid := false.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   402
        cmd := self getCommand:nil.
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   403
        cmd isNil ifTrue:[   "/ EOF -> continue
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   404
            cmd := $c
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   405
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   406
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   407
        commandArg notEmpty ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   408
            id := Number readFrom:commandArg onError:nil.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   409
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   410
            id notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   411
                proc := Process allSubInstances detect:[:p | p id == id] ifNone:nil.
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   412
                proc == Processor activeProcess ifTrue:[
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   413
                    id := proc := nil
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   414
                ]
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   415
            ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   416
        ].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   417
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   418
        (cmd == $l) ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   419
            valid := true.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   420
            proc notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   421
                '-------- walkback of process ' print. id print. ' -------' printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   422
                self printBacktraceFrom:(proc suspendedContext)
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   423
            ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   424
                id notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   425
                    'no process with id: ' print. id printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   426
                ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   427
                    context isNil ifTrue: [
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   428
                        context := self getContext
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   429
                    ].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   430
                    '-------- walkback of current process -------' printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   431
                    self printBacktraceFrom:context
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   432
                ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   433
            ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   434
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   435
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   436
        (cmd == $b) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   437
            valid := true.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   438
            proc notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   439
                '-------- VM walkback of process ' print. id print. ' -------' printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   440
                ObjectMemory printStackBacktraceFrom:(proc suspendedContext)
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   441
            ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   442
                id notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   443
                    'no process with id: ' print. id printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   444
                ] ifFalse:[
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   445
                    '-------- VM walkback of current process -------' printCR.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   446
                    ObjectMemory printStackBacktrace
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   447
                ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   448
            ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   449
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   450
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   451
	(cmd == $S) ifTrue:[
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   452
	    valid := true.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   453
	    ObjectMemory snapShotOn:'crash.img'.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   454
	].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   455
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   456
        (cmd == $B) ifTrue:[
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   457
            valid := true.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   458
            self printAllBacktraces
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   459
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   460
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   461
        (cmd == $P) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   462
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   463
            self showProcesses.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   464
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   465
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   466
        (cmd == $r) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   467
            valid := true.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   468
            dot receiver printCR
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   469
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   470
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   471
        (cmd == $i) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   472
            valid := true.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   473
            MiniInspector openOn:(dot receiver)
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   474
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   475
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   476
        (cmd == $I) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   477
            valid := true.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   478
            self interpreterLoopWith:nil
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   479
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   480
        context := nil.
3009
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   481
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   482
        (cmd == $c) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   483
        (cmd == $s) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   484
        (cmd == $t) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   485
        (cmd == $a) ifTrue:[valid := true. done := true].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   486
        (cmd == $u) ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   487
            stepping := false.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   488
            tracing := false.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   489
            Processor activeProcess vmTrace:false.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   490
        ].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   491
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   492
        (cmd == $T) ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   493
            valid := true. 
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   494
            proc notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   495
                proc terminate.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   496
            ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   497
                id notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   498
                    'no process with id: ' print. id printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   499
                ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   500
                    Processor terminateActive
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   501
                ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   502
            ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   503
        ].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   504
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   505
        (cmd == $S) ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   506
            valid := true. 
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   507
            proc notNil ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   508
                'stopping process id: ' print. id printCR.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   509
                proc stop.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   510
            ] ifFalse:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   511
                'invalid process id: ' print. id printCR.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   512
            ]
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   513
        ].
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   514
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   515
        (cmd == $a) ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   516
            "without id-arg, this is handled by caller"
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   517
            proc notNil ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   518
                valid := true.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   519
                proc interruptWith:[AbortSignal raise]
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   520
            ]
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   521
        ].
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   522
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   523
        (cmd == $Q) ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   524
            valid := true. 
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   525
            proc notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   526
                proc terminateNoSignal.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   527
            ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   528
                id notNil ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   529
                    'no process with id: ' print. id printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   530
                ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   531
                    Processor terminateActiveNoSignal
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   532
                ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   533
            ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   534
        ].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   535
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   536
        (cmd == $g) ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   537
            valid := true. 
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   538
            id == 3 ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   539
                ObjectMemory reclaimSymbols.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   540
                ObjectMemory compressOldSpace.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   541
            ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   542
                id == 2 ifTrue:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   543
                    ObjectMemory reclaimSymbols.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   544
                ] ifFalse:[
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   545
                    ObjectMemory garbageCollect.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   546
                ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   547
            ]
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   548
        ].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   549
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   550
        (cmd == $U) ifTrue:[valid := true. MessageTracer unwrapAllMethods].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   551
        (cmd == $X) ifTrue:[valid := true. Smalltalk fatalAbort].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   552
        (cmd == $x) ifTrue:[valid := true. OperatingSystem exit].
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   553
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   554
        (cmd == $.) ifTrue:[valid := true. self printDot ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   555
        (cmd == $-) ifTrue:[valid := true. self moveDotUp ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   556
        (cmd == $+) ifTrue:[valid := true. self moveDotDown ].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   557
4470
8b5faec7deef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
   558
        "/ avoid usage print if return was typed ...
8b5faec7deef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
   559
        ((cmd == Character return)
8b5faec7deef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
   560
        or:[cmd == Character linefeed]) ifTrue:[valid := true.].
8b5faec7deef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
   561
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   562
        valid ifFalse: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   563
            'valid commands:
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   564
   c ..... continue
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   565
   s ..... step
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   566
   t ..... trace (continue with trace)
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   567
   a [id]. abort (i.e. raise abort signal) in (current) process
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   568
   T [id]. terminate (current) process
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   569
   Q [id]. quick terminate (current) process - no unwinds or cleanup
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   570
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   571
   P ..... list processes
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   572
   l [id]. print context chain (of process with id)
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   573
   b [id]. full (VM) backtrace
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   574
   B ..... backtrace of all other processes
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   575
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   576
   U ..... unwrap all traced/breakpointed methods
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   577
   g ..... collect all garbage
4463
Claus Gittinger <cg@exept.de>
parents: 4209
diff changeset
   578
   g 2.... collect all garbage & reclaim symbols
Claus Gittinger <cg@exept.de>
parents: 4209
diff changeset
   579
   g 3.... collect all garbage, reclaim symbols and compress
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   580
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   581
   S ..... save snapshot into crash.img
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   582
   X ..... exit (+core)
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   583
   x ..... exit Smalltalk
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   584
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   585
   . ..... print dot (the current context)
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   586
   - ..... move dot up
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   587
   + ..... move dot down
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   588
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   589
   r ..... receiver (in dot) printString
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   590
   i ..... inspect receiver (in dot)
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   591
   I ..... interpreter (expression evaluator)
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   592
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   593
'  errorPrintCR
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   594
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   595
    ].
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   596
    context := nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   597
    ^ cmd
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   598
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   599
    "Modified: / 31.7.1998 / 17:10:23 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   600
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   601
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   602
doAbort
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   603
    |con sig|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   604
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   605
    (sig := Object abortSignal) isHandled ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   606
        sig raise.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   607
        'abort raise failed' errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   608
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   609
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   610
    "TEMPORARY kludge - find event handler context
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   611
     this will be removed, once real debugging is possible
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   612
    "
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   613
    con := self findContext:#processEvent.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   614
    con isNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   615
        con := self findContext:#dispatch.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   616
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   617
    con notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   618
        "got it"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   619
        con return.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   620
        'return failed' errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   621
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   622
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   623
    'found no context to resume' errorPrintCR.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   624
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   625
    "Modified: 20.5.1996 / 10:23:00 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   626
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   627
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   628
getCommand:prompt
3126
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   629
"/    Screen notNil ifTrue:[
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   630
"/        Screen allScreens do:[:aScreen |
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   631
"/            aScreen ungrabPointer.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   632
"/            aScreen ungrabKeyboard.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   633
"/        ].
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   634
"/    ].
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   635
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   636
    Display notNil ifTrue:[
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   637
        Display ungrabPointer.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   638
        Display ungrabKeyboard.
852
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   639
    ].
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   640
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   641
    (prompt 
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   642
	? (nesting == 0 ifTrue:[ 
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   643
	    'MiniDebugger> ' 
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   644
	  ] ifFalse:[ 
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   645
	    'MiniDebugger' , nesting printString , '>'
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   646
	  ])) print.
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   647
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   648
    UserInterruptSignal handle:[:ex |
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   649
        ex restart
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   650
    ] do:[
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   651
        |c cmd arg cnt|
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   652
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   653
        cmd := Character fromUser.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   654
        cmd isNil ifTrue:[
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   655
            "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   656
             mhmh end-of-file;
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   657
             return a 'c' (for continue); hope thats ok.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   658
            "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   659
            cmd := $c
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   660
        ].
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   661
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   662
        cnt := nil.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   663
        (cmd isDigit) ifTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   664
            cnt := 0.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   665
            [cmd isDigit] whileTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   666
                cnt := cnt * 10 + cmd digitValue.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   667
                cmd := Character fromUser
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   668
            ].
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   669
            [cmd == Character space] whileTrue:[
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   670
                cmd := Character fromUser
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   671
            ].
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   672
        ].
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   673
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   674
        "
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   675
         collect to end-of-line in arg
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   676
        "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   677
        c := cmd.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   678
        arg := ''.
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   679
        [c isNil or:[c isEndOfLineCharacter]] whileFalse: [
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   680
            arg := arg copyWith:c.
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   681
            c := Character fromUser.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   682
        ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   683
        commandArg := arg copyFrom:2.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   684
        command := cmd.
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   685
        commandCount := cnt.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   686
    ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   687
    ^ command
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   688
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   689
    "Modified: / 31.7.1998 / 16:11:01 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   690
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   691
a27a279701f8 Initial revision
claus
parents:
diff changeset
   692
interpreterLoopWith:anObject
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   693
    |line done rslt|
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   694
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   695
    'read-eval-print loop; exit with empty line' printCR.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   696
    '' printCR.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   697
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   698
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   699
    [done] whileFalse:[
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   700
        '> ' print.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   701
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   702
        line := Stdin nextLine.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   703
        (line size == 0) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   704
            done := true
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   705
        ] ifFalse:[
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   706
            "/ rslt := Compiler evaluate:line 
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   707
            "/                  receiver:anObject
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   708
            "/                  notifying:nil.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   709
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   710
	    rslt := Compiler
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   711
		evaluate:line
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   712
		in:dot 
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   713
		receiver:dot receiver
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   714
		notifying:nil
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   715
		ifFail:[].
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   716
	    rslt printCR.
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   717
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   718
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   719
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   720
    "Modified: / 31.7.1998 / 16:01:47 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   721
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   722
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   723
printAllBacktraces
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   724
    Process allInstancesDo:[:p |
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   725
	(p ~~ Processor activeProcess
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   726
	and:[p isDead not]) ifTrue:[
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   727
	    '---------------------------------------------------------' printCR.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   728
	    '  proc id=' print. p id print. 
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   729
	    ' name=''' print. p name print.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   730
	    ''' createdBy: ' print. p creatorId print.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   731
	    ' state=' print.  p state print. 
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   732
	    ' prio=' print. p priority printCR.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   733
	    '' printCR. '' printCR.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   734
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   735
	    self printBacktraceFrom:(p suspendedContext)
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   736
	]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   737
    ]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   738
!
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   739
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   740
showProcesses
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   741
    |active|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   742
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   743
    active := Processor activeProcess.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   744
    'current id=' print. active id print. ' name=''' print. active name print. '''' printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   745
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   746
    Process allSubInstancesDo:[:p |
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   747
        'proc id=' print. (p id printStringPaddedTo:5) print. 
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   748
        (p state printStringPaddedTo:10) print. 
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   749
        ' pri=' print. (p priority printStringPaddedTo:2) print.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   750
        ' creator:' print. (p creatorId printStringPaddedTo:5) print.
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   751
        ' name=''' print. p name print. 
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   752
        '''' printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   753
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   754
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   755
    "Modified: / 31.7.1998 / 16:30:19 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   756
! !
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   757
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   758
!MiniDebugger class methodsFor:'documentation'!
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   759
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   760
version
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   761
    ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.54 2001-09-03 16:16:10 cg Exp $'
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   762
! !