MiniDebug.st
author Claus Gittinger <cg@exept.de>
Fri, 18 Apr 1997 21:05:22 +0200
changeset 2568 9b7a3a08b8ca
parent 2118 2b1d0b19484c
child 2661 fea131f9f062
permissions -rw-r--r--
added #rootsOfTheWorld for ST-80 compatibility
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
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    68
    aString printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    69
    Processor notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    70
        active := Processor activeProcess.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    71
        'process: id=' print. active id print. ' name=' print. active name printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    72
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    73
    self new enter.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    74
    ^ nil
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    75
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    76
    "Modified: 20.5.1996 / 10:28:31 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    77
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    78
a27a279701f8 Initial revision
claus
parents:
diff changeset
    79
new
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    80
    TheOneAndOnlyDebugger printCR.
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 5
diff changeset
    81
    TheOneAndOnlyDebugger isNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    82
        TheOneAndOnlyDebugger := self basicNew initialize
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    83
    ].
33
50cf0f6bc0ad *** empty log message ***
claus
parents: 5
diff changeset
    84
    ^ TheOneAndOnlyDebugger
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    85
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
    86
    "Modified: 20.5.1996 / 10:28:35 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    88
a27a279701f8 Initial revision
claus
parents:
diff changeset
    89
singleStep:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
    90
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
    91
a27a279701f8 Initial revision
claus
parents:
diff changeset
    92
    aDebugger := self new stepping.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
    93
    ObjectMemory stepInterruptHandler:aDebugger.
2
claus
parents: 1
diff changeset
    94
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
    95
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
    96
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    97
    aBlock value.
2
claus
parents: 1
diff changeset
    98
    StepInterruptPending := nil.
claus
parents: 1
diff changeset
    99
    ObjectMemory stepInterruptHandler:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   100
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   101
a27a279701f8 Initial revision
claus
parents:
diff changeset
   102
trace:aBlock
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   103
    self trace:aBlock with:[:where | where printCR]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   104
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   105
    "Modified: 20.5.1996 / 10:27:37 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   106
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   107
a27a279701f8 Initial revision
claus
parents:
diff changeset
   108
trace:aBlock on:aStream
a27a279701f8 Initial revision
claus
parents:
diff changeset
   109
    self trace:aBlock with:[:where | where printString printOn:aStream.
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   110
				     aStream cr]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   111
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   112
a27a279701f8 Initial revision
claus
parents:
diff changeset
   113
trace:aBlock with:aTraceBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   114
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   115
a27a279701f8 Initial revision
claus
parents:
diff changeset
   116
    aDebugger := self new tracingWith:aTraceBlock.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   117
    ObjectMemory stepInterruptHandler:aDebugger.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   118
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   119
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   120
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   121
    aBlock value.
2
claus
parents: 1
diff changeset
   122
    ObjectMemory stepInterruptHandler:nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   123
    StepInterruptPending := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   124
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
   125
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   126
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   127
!MiniDebugger methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   128
a27a279701f8 Initial revision
claus
parents:
diff changeset
   129
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   130
    traceBlock := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   131
    tracing := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   132
    stepping := false
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:'interrupt handling'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   136
a27a279701f8 Initial revision
claus
parents:
diff changeset
   137
enter
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   138
    |leaveCmd stillHere|
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   139
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   140
    stillHere := true.
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   141
    [stillHere] whileTrue:[
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   142
	leaveCmd := self commandLoop.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   143
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   144
	(leaveCmd == $s) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   145
	    self stepping.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   146
	    ObjectMemory flushInlineCaches.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   147
	    ObjectMemory stepInterruptHandler:self.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   148
	    stillHere := false.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   149
	    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   150
	    InterruptPending := 1
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   151
	].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   152
	(leaveCmd == $t) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   153
	    traceBlock := [:where | where fullPrint].
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 == $c) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   161
	    stillHere := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   162
	    stepping := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   163
	    tracing := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   164
	    StepInterruptPending := nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   165
	    InterruptPending := nil
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   166
	].
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   167
	(leaveCmd == $a) ifTrue: [
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   168
	    "abort"
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   169
	    stepping := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   170
	    tracing := false.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   171
	    StepInterruptPending := nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   172
	    InterruptPending := nil.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   173
	    self doAbort.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   174
	    stillHere := true.
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   175
	    "failed abort"
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   176
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   177
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   178
    ^ nil
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   179
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   180
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   181
stepInterrupt
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   182
    |where|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   183
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   184
    where := thisContext.        "where is stepInterrupt context"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   185
    where notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   186
        where := where sender    "where is now interrupted methods context"
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
    stepping ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   189
        where notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   190
            where fullPrint
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   191
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   192
            'stepInterrupt: no context' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   193
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   194
        self enter
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   195
    ] ifFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   196
        where notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   197
            traceBlock notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   198
                traceBlock value:where
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   199
            ]
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   200
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   201
            'traceInterrupt: no context' errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   202
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   203
        ObjectMemory flushInlineCaches.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   204
        StepInterruptPending := 1.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   205
        InterruptPending := 1
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   206
    ]
1424
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
    "Modified: 20.5.1996 / 10:23:11 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   209
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   210
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   211
!MiniDebugger methodsFor:'private'!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   212
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   213
findContext:aSelector
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   214
    |con|
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   215
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   216
    con := thisContext sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   217
    [con notNil] whileTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   218
	(con isBlockContext not and:[con selector == aSelector]) ifTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   219
	    "got it"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   220
	    ^ con
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   221
	].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   222
	con := con sender
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
    ^ nil
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   225
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   226
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   227
getContext
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   228
    |backtrace|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   229
    backtrace := thisContext.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   230
    (backtrace notNil) ifTrue: [
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   231
	"remove Context getContext frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   232
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   233
	"remove Debugger showContext frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   234
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   235
	"remove Debugger commandLoop frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   236
	backtrace := backtrace sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   237
	"remove Debugger enter frame"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   238
	backtrace := backtrace sender
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   239
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   240
    ^ backtrace
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   241
!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   242
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   243
stepping
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   244
    traceBlock := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   245
    tracing := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   246
    stepping := true
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   247
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   248
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   249
tracingWith:aBlockOrNil
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   250
    traceBlock := aBlockOrNil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   251
    stepping := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   252
    tracing := true
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   253
!
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   254
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   255
printBacktraceFrom:aContext
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   256
    aContext notNil ifTrue:[
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   257
	aContext fullPrintAll
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   258
    ] ifFalse:[
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   259
	'no context' errorPrintCR
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   260
    ]
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   261
! !
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   262
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   263
!MiniDebugger methodsFor:'user commands'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   264
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   265
commandLoop
a27a279701f8 Initial revision
claus
parents:
diff changeset
   266
    |cmd done valid context|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   267
a27a279701f8 Initial revision
claus
parents:
diff changeset
   268
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   269
    [done] whileFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   270
        valid := false.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   271
        cmd := self getCommand.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   272
        (cmd == $p) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   273
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   274
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   275
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   276
            ].
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   277
	    self printBacktraceFrom:context
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   278
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   279
        (cmd == $b) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   280
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   281
            Smalltalk printStackBacktrace
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   282
        ].
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   283
        (cmd == $B) ifTrue:[
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   284
            valid := true.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   285
            self printAllBacktraces
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   286
        ].
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   287
        (cmd == $P) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   288
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   289
            self showProcesses.
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
        (cmd == $r) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   292
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   293
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   294
                context := self getContext
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
            context notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   297
                "remove Debugger stepinterrupt/halt frame"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   298
                context sender receiver printCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   299
            ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   300
                'no context - dont know receiver' errorPrintCR
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
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   303
        (cmd == $R) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   304
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   305
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   306
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   307
            ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   308
            context notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   309
                "remove Debugger stepinterrupt/halt frame"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   310
                context sender receiver storeOn:Stdout
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   311
            ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   312
                'no context - dont know receiver' errorPrintCR
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
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   315
        (cmd == $i) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   316
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   317
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   318
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   319
            ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   320
            context notNil ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   321
                "remove Debugger stepinterrupt/halt frame"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   322
                MiniInspector openOn:(context sender receiver)
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   323
            ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   324
                'no context - dont know receiver' errorPrintCR
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
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   327
        (cmd == $I) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   328
            valid := true.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   329
            context isNil ifTrue: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   330
                context := self getContext
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   331
            ].
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   332
"/          context notNil ifTrue:[
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   333
"/              "remove Debugger stepinterrupt/halt frame"
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   334
"/              self interpreterLoopWith:(context sender receiver)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   335
"/          ] ifFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   336
"/              'no context - dont know receiver' errorPrintCR.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   337
                self interpreterLoopWith:nil
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   338
"/          ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   339
        ].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   340
        context := nil.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   341
        (cmd == $c) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   342
        (cmd == $s) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   343
        (cmd == $t) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   344
        (cmd == $a) ifTrue:[valid := true. done := true].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   345
        (cmd == $T) ifTrue:[valid := true. Processor terminateActive].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   346
        (cmd == $Q) ifTrue:[valid := true. Processor terminateActiveNoSignal].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   347
        (cmd == $U) ifTrue:[MessageTracer unwrapAllMethods].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   348
        (cmd == $X) ifTrue:[Smalltalk fatalAbort].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   349
        (cmd == $x) ifTrue:[OperatingSystem exit].
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   350
        valid ifFalse: [
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   351
            'valid commands:
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   352
   (c)ontinue
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   353
   (s)tep
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   354
   (t)race (continue with trace)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   355
   (p)rint context chain
940
6aa0f4b6fafc added low-level b-command
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   356
   (b)full backtrace
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   357
   (B)backtrace of all other processes
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   358
   (r)eceiver printString
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   359
   (R)eceiver storeString
216
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   360
   (i)nspect (enter inspector on receiver)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   361
   (I)nterpreter (expression evaluator)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   362
   (a)bort (raise abort signal)
a8abff749575 *** empty log message ***
claus
parents: 159
diff changeset
   363
   (P)rocess list
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   364
   (T)terminate current process
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   365
   (Q)uick terminate current process (no unwinds)
360
claus
parents: 308
diff changeset
   366
   (U)nwrap all traced/breakpointed methods
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   367
   (X)exit (+core)
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   368
   (x)exit Smalltalk'  errorPrintCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   369
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   370
    ].
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   371
    context := nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   372
    ^ cmd
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   373
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   374
    "Modified: 20.5.1996 / 10:22:50 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   375
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   376
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   377
doAbort
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   378
    |con sig|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   379
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   380
    (sig := Object abortSignal) isHandled ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   381
        sig raise.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   382
        'abort raise failed' errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   383
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   384
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   385
    "TEMPORARY kludge - find event handler context
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   386
     this will be removed, once real debugging is possible
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   387
    "
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   388
    con := self findContext:#processEvent.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   389
    con isNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   390
        con := self findContext:#dispatch.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   391
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   392
    con notNil ifTrue:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   393
        "got it"
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   394
        con return.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   395
        'return failed' errorPrintCR.
618
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
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   398
    'found no context to resume' errorPrintCR.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   399
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   400
    "Modified: 20.5.1996 / 10:23:00 / cg"
618
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
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   403
getCommand
a27a279701f8 Initial revision
claus
parents:
diff changeset
   404
    |cmd c|
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   405
852
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   406
    Display notNil ifTrue:[
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   407
        Display ungrabPointer.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   408
        Display ungrabKeyboard.
852
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   409
    ].
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   410
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   411
    'MiniDebugger> ' print.
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   412
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   413
    UserInterruptSignal handle:[:ex |
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   414
        ex restart
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   415
    ] do:[
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   416
        cmd := Character fromUser.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   417
        cmd isNil ifTrue:[
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   418
            "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   419
             mhmh end-of-file;
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   420
             return a 'c' (for continue); hope thats ok.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   421
            "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   422
            cmd := $c
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   423
        ].
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   424
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   425
        "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   426
         ignore to end-of-line
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   427
        "
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   428
        c := cmd.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   429
        [c isNil or:[c isEndOfLineCharacter]] whileFalse: [
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   430
            c := Character fromUser.
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   431
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   432
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   433
    ^ cmd
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   434
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
   435
    "Modified: 20.2.1996 / 20:24:13 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   436
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   437
a27a279701f8 Initial revision
claus
parents:
diff changeset
   438
interpreterLoopWith:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   439
    |line done|
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   440
    'read-eval-print loop; exit with empty line' printCR.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   441
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   442
    [done] whileFalse:[
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   443
        line := Stdin nextLine.
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   444
        (line size == 0) ifTrue:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   445
            done := true
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   446
        ] ifFalse:[
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   447
            (Compiler evaluate:line 
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   448
                      receiver:anObject
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   449
                     notifying:nil) printCR
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   450
        ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   451
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   452
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   453
    "Modified: 20.5.1996 / 10:27:29 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   454
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   455
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   456
showProcesses
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   457
    |active|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   458
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   459
    active := Processor activeProcess.
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   460
    '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
   461
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   462
    Process allInstancesDo:[:p |
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   463
        'proc id=' print. p id print. 
2118
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   464
	' name=''' print. p name print. 
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   465
	''' createdBy: ' print. p creatorId print.
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   466
	' state=' print.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   467
        p state print. 
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   468
	' prio=' print. p priority printCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   469
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   470
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   471
    "Modified: 20.5.1996 / 10:28:25 / cg"
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   472
!
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   473
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   474
printAllBacktraces
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   475
    Process allInstancesDo:[:p |
2115
89639d395450 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   476
	(p ~~ Processor activeProcess
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   477
	and:[p isDead not]) ifTrue:[
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   478
	    '---------------------------------------------------------' printCR.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   479
	    '  proc id=' print. p id print. 
2118
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   480
	    ' name=''' print. p name print.
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   481
	    ''' createdBy: ' print. p creatorId print.
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   482
	    ' state=' print.  p state print. 
2113
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   483
	    ' prio=' print. p priority printCR.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   484
	    '' printCR. '' printCR.
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   485
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   486
	    self printBacktraceFrom:(p suspendedContext)
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   487
	]
6a310e15ad58 added print-other-stacks command
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
   488
    ]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   489
! !
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   490
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   491
!MiniDebugger class methodsFor:'documentation'!
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   492
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   493
version
2118
2b1d0b19484c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
   494
    ^ '$Header: /cvs/stx/stx/libbasic/Attic/MiniDebug.st,v 1.30 1997-01-10 11:21:02 cg Exp $'
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
   495
! !