MiniDebugger.st
author Claus Gittinger <cg@exept.de>
Wed, 13 May 1998 23:38:30 +0200
changeset 3443 d57ea75d3ac5
parent 3126 e37ccb66f1b0
child 3700 95530aec6e0b
permissions -rw-r--r--
oops - must send #initialize to all privateClasses.
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
720
f31e0e5ab6e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
    13
Object subclass:#MiniDebugger
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    14
	instanceVariableNames:'tracing stepping traceBlock'
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    15
	classVariableNames:'TheOneAndOnlyDebugger'
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    16
	poolDictionaries:''
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    17
	category:'System-Debugging-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    20
!MiniDebugger class methodsFor:'documentation'!
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    21
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    22
copyright
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    23
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    24
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
    25
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    27
 This software is furnished under a license and may be used
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    28
 only in accordance with the terms of that license and with the
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    30
 be provided or otherwise made available to, or used by, any
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    31
 other person.  No title to or ownership of the software is
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    32
 hereby transferred.
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    33
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    34
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    35
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    36
documentation
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    37
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    38
    a primitive (non graphical) debugger for use on systems without
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    39
    graphics or when the real debugger dies (i.e. an error occurs in
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    40
    the graphical debugger).
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
    41
    Also, if an interrupt occurs within the debuger, this one is called
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
    42
    for.
1297
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    43
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    44
    [author:]
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    45
        Claus Gittinger
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    46
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    47
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    48
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    49
!MiniDebugger class methodsFor:'instance creation'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    50
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    51
enter
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    52
    ^ self enterWithMessage:'MiniDebugger'
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    53
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    54
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    55
enter:aContext
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    56
    ^ self enterWithMessage:'MiniDebugger'
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    57
!
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
enter:aContext withMessage:aString
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    60
    ^ self enterWithMessage:aString
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    61
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    62
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    63
enterWithMessage:aString
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    64
    |active|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    65
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    66
    StepInterruptPending := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    67
2661
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    68
    Object errorSignal handle:[:ex |
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    69
	ex return
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    70
    ] do:[
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    71
	thisContext isRecursive ifTrue:[
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    72
	    "/ 'recursive error in debugger ignored' errorPrintCR.
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    73
	    ^ self
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    74
	].
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    75
        aString printCR.
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    76
        Processor notNil ifTrue:[
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    77
            active := Processor activeProcess.
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    78
            'process: id=' print. active id print. ' name=' print. active name printCR.
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
    79
        ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    80
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    81
    self new enter.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    82
    ^ nil
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    83
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    84
    "Modified: 20.5.1996 / 10:28:31 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    85
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    86
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
new
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    88
    TheOneAndOnlyDebugger printCR.
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 5
diff changeset
    89
    TheOneAndOnlyDebugger isNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    90
        TheOneAndOnlyDebugger := self basicNew initialize
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    91
    ].
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 5
diff changeset
    92
    ^ TheOneAndOnlyDebugger
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    93
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    94
    "Modified: 20.5.1996 / 10:28:35 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    95
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    96
a27a279701f8 Initial revision
claus
parents:
diff changeset
    97
singleStep:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
    98
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
    99
a27a279701f8 Initial revision
claus
parents:
diff changeset
   100
    aDebugger := self new stepping.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   101
    ObjectMemory stepInterruptHandler:aDebugger.
2
claus
parents: 1
diff changeset
   102
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   103
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   104
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   105
    aBlock value.
2
claus
parents: 1
diff changeset
   106
    StepInterruptPending := nil.
claus
parents: 1
diff changeset
   107
    ObjectMemory stepInterruptHandler:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   108
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   109
a27a279701f8 Initial revision
claus
parents:
diff changeset
   110
trace:aBlock
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   111
    self trace:aBlock with:[:where | where printCR]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   112
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   113
    "Modified: 20.5.1996 / 10:27:37 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   114
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   115
a27a279701f8 Initial revision
claus
parents:
diff changeset
   116
trace:aBlock on:aStream
a27a279701f8 Initial revision
claus
parents:
diff changeset
   117
    self trace:aBlock with:[:where | where printString printOn:aStream.
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   118
				     aStream cr]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   119
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   120
a27a279701f8 Initial revision
claus
parents:
diff changeset
   121
trace:aBlock with:aTraceBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   122
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   123
a27a279701f8 Initial revision
claus
parents:
diff changeset
   124
    aDebugger := self new tracingWith:aTraceBlock.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   125
    ObjectMemory stepInterruptHandler:aDebugger.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   126
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   127
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   128
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   129
    aBlock value.
2
claus
parents: 1
diff changeset
   130
    ObjectMemory stepInterruptHandler:nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   131
    StepInterruptPending := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   132
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
   133
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   135
!MiniDebugger methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   136
a27a279701f8 Initial revision
claus
parents:
diff changeset
   137
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   138
    traceBlock := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   139
    tracing := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   140
    stepping := false
a27a279701f8 Initial revision
claus
parents:
diff changeset
   141
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   142
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   143
!MiniDebugger methodsFor:'interrupt handling'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   144
a27a279701f8 Initial revision
claus
parents:
diff changeset
   145
enter
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   146
    |leaveCmd stillHere|
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   147
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   148
    stillHere := true.
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   149
    [stillHere] whileTrue:[
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   150
	leaveCmd := self commandLoop.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   151
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   152
	(leaveCmd == $s) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   153
	    self stepping.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   154
	    ObjectMemory flushInlineCaches.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   155
	    ObjectMemory stepInterruptHandler:self.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   156
	    stillHere := false.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   157
	    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   158
	    InterruptPending := 1
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   159
	].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   160
	(leaveCmd == $t) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   161
	    traceBlock := [:where | where fullPrint].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   162
	    ObjectMemory flushInlineCaches.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   163
	    ObjectMemory stepInterruptHandler:self.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   164
	    stillHere := false.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   165
	    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   166
	    InterruptPending := 1
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   167
	].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   168
	(leaveCmd == $c) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   169
	    stillHere := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   170
	    stepping := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   171
	    tracing := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   172
	    StepInterruptPending := nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   173
	    InterruptPending := nil
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   174
	].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   175
	(leaveCmd == $a) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   176
	    "abort"
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   177
	    stepping := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   178
	    tracing := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   179
	    StepInterruptPending := nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   180
	    InterruptPending := nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   181
	    self doAbort.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   182
	    stillHere := true.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   183
	    "failed abort"
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   184
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   185
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   186
    ^ nil
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   187
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   188
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   189
stepInterrupt
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   190
    |where|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   191
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   192
    where := thisContext.        "where is stepInterrupt context"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   193
    where notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   194
        where := where sender    "where is now interrupted methods context"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   195
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   196
    stepping ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   197
        where notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   198
            where fullPrint
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   199
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   200
            'stepInterrupt: no context' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   201
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   202
        self enter
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   203
    ] ifFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   204
        where notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   205
            traceBlock notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   206
                traceBlock value:where
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   207
            ]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   208
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   209
            'traceInterrupt: no context' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   210
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   211
        ObjectMemory flushInlineCaches.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   212
        StepInterruptPending := 1.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   213
        InterruptPending := 1
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   214
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   215
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   216
    "Modified: 20.5.1996 / 10:23:11 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   217
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   218
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   219
!MiniDebugger methodsFor:'private'!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   220
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   221
findContext:aSelector
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   222
    |con|
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   223
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   224
    con := thisContext sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   225
    [con notNil] whileTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   226
	(con isBlockContext not and:[con selector == aSelector]) ifTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   227
	    "got it"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   228
	    ^ con
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   229
	].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   230
	con := con sender
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   231
    ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   232
    ^ nil
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   233
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   234
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   235
getContext
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   236
    |backtrace|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   237
    backtrace := thisContext.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   238
    (backtrace notNil) ifTrue: [
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   239
	"remove Context getContext frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   240
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   241
	"remove Debugger showContext frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   242
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   243
	"remove Debugger commandLoop frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   244
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   245
	"remove Debugger enter frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   246
	backtrace := backtrace sender
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   247
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   248
    ^ backtrace
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   249
!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   250
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   251
printBacktraceFrom:aContext
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   252
    aContext notNil ifTrue:[
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   253
	aContext fullPrintAll
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   254
    ] ifFalse:[
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   255
	'no context' errorPrintCR
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   256
    ]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   257
!
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   258
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   259
stepping
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   260
    traceBlock := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   261
    tracing := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   262
    stepping := true
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   263
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   264
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   265
tracingWith:aBlockOrNil
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   266
    traceBlock := aBlockOrNil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   267
    stepping := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   268
    tracing := true
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   269
! !
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   270
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   271
!MiniDebugger methodsFor:'user commands'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   272
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   273
commandLoop
a27a279701f8 Initial revision
claus
parents:
diff changeset
   274
    |cmd done valid context|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   275
a27a279701f8 Initial revision
claus
parents:
diff changeset
   276
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   277
    [done] whileFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   278
        valid := false.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   279
        cmd := self getCommand.
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   280
        cmd isNil ifTrue:[   "/ EOF -> continue
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   281
            cmd := $c
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   282
        ].
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   283
        (cmd == $p) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   284
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   285
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   286
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   287
            ].
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   288
            self printBacktraceFrom:context
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   289
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   290
        (cmd == $b) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   291
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   292
            Smalltalk printStackBacktrace
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   293
        ].
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   294
        (cmd == $B) ifTrue:[
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   295
            valid := true.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   296
            self printAllBacktraces
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   297
        ].
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   298
        (cmd == $P) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   299
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   300
            self showProcesses.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   301
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   302
        (cmd == $r) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   303
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   304
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   305
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   306
            ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   307
            context notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   308
                "remove Debugger stepinterrupt/halt frame"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   309
                context sender receiver printCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   310
            ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   311
                'no context - dont know receiver' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   312
            ]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   313
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   314
        (cmd == $R) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   315
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   316
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   317
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   318
            ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   319
            context notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   320
                "remove Debugger stepinterrupt/halt frame"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   321
                context sender receiver storeOn:Stdout
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   322
            ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   323
                'no context - dont know receiver' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   324
            ]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   325
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   326
        (cmd == $i) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   327
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   328
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   329
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   330
            ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   331
            context notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   332
                "remove Debugger stepinterrupt/halt frame"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   333
                MiniInspector openOn:(context sender receiver)
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   334
            ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   335
                'no context - dont know receiver' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   336
            ]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   337
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   338
        (cmd == $I) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   339
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   340
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   341
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   342
            ].
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   343
"/          context notNil ifTrue:[
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   344
"/              "remove Debugger stepinterrupt/halt frame"
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   345
"/              self interpreterLoopWith:(context sender receiver)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   346
"/          ] ifFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   347
"/              'no context - dont know receiver' errorPrintCR.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   348
                self interpreterLoopWith:nil
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   349
"/          ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   350
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   351
        context := nil.
3009
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   352
	(cmd == $u) ifTrue:[
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   353
            stepping := false.
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   354
            tracing := false.
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   355
	    Processor activeProcess vmTrace:false.
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   356
	].
d74b118b1d70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2852
diff changeset
   357
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   358
        (cmd == $c) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   359
        (cmd == $s) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   360
        (cmd == $t) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   361
        (cmd == $a) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   362
        (cmd == $T) ifTrue:[valid := true. Processor terminateActive].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   363
        (cmd == $Q) ifTrue:[valid := true. Processor terminateActiveNoSignal].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   364
        (cmd == $U) ifTrue:[MessageTracer unwrapAllMethods].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   365
        (cmd == $X) ifTrue:[Smalltalk fatalAbort].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   366
        (cmd == $x) ifTrue:[OperatingSystem exit].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   367
        valid ifFalse: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   368
            'valid commands:
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   369
   (c)ontinue
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   370
   (s)tep
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   371
   (t)race (continue with trace)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   372
   (p)rint context chain
940
6aa0f4b6fafc added low-level b-command
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   373
   (b)full backtrace
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   374
   (B)backtrace of all other processes
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   375
   (r)eceiver printString
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   376
   (R)eceiver storeString
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   377
   (i)nspect (enter inspector on receiver)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   378
   (I)nterpreter (expression evaluator)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   379
   (a)bort (raise abort signal)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   380
   (P)rocess list
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   381
   (T)terminate current process
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   382
   (Q)uick terminate current process (no unwinds)
360
claus
parents: 308
diff changeset
   383
   (U)nwrap all traced/breakpointed methods
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   384
   (X)exit (+core)
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   385
   (x)exit Smalltalk'  errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   386
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   387
    ].
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   388
    context := nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   389
    ^ cmd
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   390
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   391
    "Modified: 24.7.1997 / 10:00:43 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   392
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   393
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   394
doAbort
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   395
    |con sig|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   396
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   397
    (sig := Object abortSignal) isHandled ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   398
        sig raise.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   399
        'abort raise failed' errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   400
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   401
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   402
    "TEMPORARY kludge - find event handler context
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   403
     this will be removed, once real debugging is possible
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   404
    "
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   405
    con := self findContext:#processEvent.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   406
    con isNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   407
        con := self findContext:#dispatch.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   408
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   409
    con notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   410
        "got it"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   411
        con return.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   412
        'return failed' errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   413
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   414
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   415
    'found no context to resume' errorPrintCR.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   416
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   417
    "Modified: 20.5.1996 / 10:23:00 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   418
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   419
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   420
getCommand
a27a279701f8 Initial revision
claus
parents:
diff changeset
   421
    |cmd c|
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   422
2852
b92953bbb7ef ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   423
"/    Display notNil ifTrue:[
b92953bbb7ef ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   424
"/        Display ungrabPointer.
b92953bbb7ef ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   425
"/        Display ungrabKeyboard.
b92953bbb7ef ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   426
"/    ].
3126
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   427
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   428
"/    Screen notNil ifTrue:[
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   429
"/        Screen allScreens do:[:aScreen |
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   430
"/            aScreen ungrabPointer.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   431
"/            aScreen ungrabKeyboard.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   432
"/        ].
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   433
"/    ].
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   434
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   435
    Display notNil ifTrue:[
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   436
        Display ungrabPointer.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   437
        Display ungrabKeyboard.
852
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   438
    ].
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   439
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   440
    'MiniDebugger> ' print.
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   441
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   442
    UserInterruptSignal handle:[:ex |
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   443
        ex restart
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   444
    ] do:[
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   445
        cmd := Character fromUser.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   446
        cmd isNil ifTrue:[
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   447
            "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   448
             mhmh end-of-file;
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   449
             return a 'c' (for continue); hope thats ok.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   450
            "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   451
            cmd := $c
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   452
        ].
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   453
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   454
        "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   455
         ignore to end-of-line
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   456
        "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   457
        c := cmd.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   458
        [c isNil or:[c isEndOfLineCharacter]] whileFalse: [
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   459
            c := Character fromUser.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   460
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   461
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   462
    ^ cmd
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   463
2852
b92953bbb7ef ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   464
    "Modified: 11.8.1997 / 16:04:39 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   465
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   466
a27a279701f8 Initial revision
claus
parents:
diff changeset
   467
interpreterLoopWith:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   468
    |line done|
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   469
    'read-eval-print loop; exit with empty line' printCR.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   470
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   471
    [done] whileFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   472
        line := Stdin nextLine.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   473
        (line size == 0) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   474
            done := true
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   475
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   476
            (Compiler evaluate:line 
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   477
                      receiver:anObject
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   478
                     notifying:nil) printCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   479
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   480
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   481
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   482
    "Modified: 20.5.1996 / 10:27:29 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   483
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   484
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   485
printAllBacktraces
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   486
    Process allInstancesDo:[:p |
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   487
	(p ~~ Processor activeProcess
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   488
	and:[p isDead not]) ifTrue:[
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   489
	    '---------------------------------------------------------' printCR.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   490
	    '  proc id=' print. p id print. 
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   491
	    ' name=''' print. p name print.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   492
	    ''' createdBy: ' print. p creatorId print.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   493
	    ' state=' print.  p state print. 
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   494
	    ' prio=' print. p priority printCR.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   495
	    '' printCR. '' printCR.
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   496
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   497
	    self printBacktraceFrom:(p suspendedContext)
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   498
	]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   499
    ]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   500
!
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   501
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   502
showProcesses
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   503
    |active|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   504
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   505
    active := Processor activeProcess.
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   506
    'current id=' print. active id print. ' name=' print. active name printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   507
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   508
    Process allInstancesDo:[:p |
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   509
        'proc id=' print. p id print. 
2118
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   510
	' name=''' print. p name print. 
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   511
	''' createdBy: ' print. p creatorId print.
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   512
	' state=' print.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   513
        p state print. 
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   514
	' prio=' print. p priority printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   515
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   516
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   517
    "Modified: 20.5.1996 / 10:28:25 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   518
! !
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   519
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   520
!MiniDebugger class methodsFor:'documentation'!
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   521
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   522
version
3126
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   523
    ^ '$Header: /cvs/stx/stx/libbasic/MiniDebugger.st,v 1.35 1997-12-15 10:34:19 cg Exp $'
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   524
! !