MiniDebugger.st
author Claus Gittinger <cg@exept.de>
Sat, 08 Feb 2020 19:15:19 +0100
changeset 25254 41d6e0766006
parent 25253 c0422fc32176
child 25293 037a1af56749
permissions -rw-r--r--
#FEATURE by exept class: MeasurementValue changed: #+/- class: MeasurementValue class added: #value:absoluteError: comment/format in: #value:error:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
     1
"{ Encoding: utf8 }"
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
     2
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     3
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
     5
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
"
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
    14
"{ Package: 'stx:libbasic' }"
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
    15
19144
2f3d50c4e256 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18681
diff changeset
    16
"{ NameSpace: Smalltalk }"
2f3d50c4e256 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18681
diff changeset
    17
720
f31e0e5ab6e0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
    18
Object subclass:#MiniDebugger
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
    19
	instanceVariableNames:'tracing stepping traceBlock command commandArg commandCount
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
    20
		enteringContext dotProcess dot nesting inputStream'
16626
bbf6b95f092f class: MiniDebugger
Stefan Vogel <sv@exept.de>
parents: 16557
diff changeset
    21
	classVariableNames:'NotFirstTimeEntered'
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    22
	poolDictionaries:''
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
    23
	category:'System-Debugging-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    24
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    25
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    26
!MiniDebugger class methodsFor:'documentation'!
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    27
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    28
copyright
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    29
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    30
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
    31
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    32
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    33
 This software is furnished under a license and may be used
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    34
 only in accordance with the terms of that license and with the
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    36
 be provided or otherwise made available to, or used by, any
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    37
 other person.  No title to or ownership of the software is
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    38
 hereby transferred.
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    39
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    40
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    41
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    42
documentation
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    43
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    44
    a primitive (non graphical) debugger for use on systems without
20501
b9160741f140 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20500
diff changeset
    45
    graphics or when the real debugger dies 
b9160741f140 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20500
diff changeset
    46
    (i.e. an error occurs in the graphical debugger or the UI/event handler is broken).
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
    47
20501
b9160741f140 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20500
diff changeset
    48
    This one is also called for, if an interrupt occurs within the debuger, 
b9160741f140 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20500
diff changeset
    49
    or if CTRL-C is pressed in the controlling tty/console.
15927
65b8082c8e68 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15861
diff changeset
    50
    Needs a console.
1297
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    51
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
    52
    You can also enter it explicitly with:
20846
69db65101d7e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20843
diff changeset
    53
        MiniDebugger enter
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
    54
20500
4767585b42c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20499
diff changeset
    55
    Attention:
20846
69db65101d7e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20843
diff changeset
    56
        all printing is done via lowLevel _errorPrint messages,
69db65101d7e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20843
diff changeset
    57
        to ensure that output is to stderr, even if a logger is present, 
69db65101d7e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20843
diff changeset
    58
        or Stderr has been set to some other stream (Transcript).
20500
4767585b42c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20499
diff changeset
    59
        Also to avoid the logger's interfering and adding imestamp information.
4767585b42c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20499
diff changeset
    60
        
1297
073d4d41ba0f documentation
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
    61
    [author:]
20500
4767585b42c5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20499
diff changeset
    62
        Claus Gittinger
89
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    63
"
7be0b86ef80f *** empty log message ***
claus
parents: 74
diff changeset
    64
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    66
!MiniDebugger class methodsFor:'instance creation'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    67
11534
feb71ed68875 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11235
diff changeset
    68
enter
feb71ed68875 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11235
diff changeset
    69
    "enter a miniDebugger"
feb71ed68875 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11235
diff changeset
    70
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
    71
    ^ self
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    72
        enter:thisContext sender
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    73
        withMessage:'MiniDebugger'
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    74
        mayProceed:true
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    75
        input:nil
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
    76
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
    77
    "
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
    78
     MiniDebugger enter
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
    79
    "
11534
feb71ed68875 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11235
diff changeset
    80
!
feb71ed68875 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11235
diff changeset
    81
4572
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
    82
enter:aContext withMessage:aString mayProceed:mayProceed
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    83
    "enter a miniDebugger"
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    84
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    85
    ^ self 
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    86
        enter:aContext 
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    87
        withMessage:aString 
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    88
        mayProceed:mayProceed 
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    89
        input:nil
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    90
!
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    91
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    92
enter:aContext withMessage:aString mayProceed:mayProceed input:inputStreamOrNil
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    93
    "enter a miniDebugger"
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
    94
7839
d6d9fac8b4db skip recursive contexts when shwing backtrace
Claus Gittinger <cg@exept.de>
parents: 7706
diff changeset
    95
    |active con sender|
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    96
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    97
    StepInterruptPending := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    98
7093
60bad14d38fc Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 6938
diff changeset
    99
    Error handle:[:ex |
23443
405ef3cf813b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 22830
diff changeset
   100
        'MiniDebugger caught (& ignored): ' _errorPrintCR.
405ef3cf813b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 22830
diff changeset
   101
        ex _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   102
        ex return
2661
fea131f9f062 care for recursive errors in MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
   103
    ] do:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   104
        thisContext isRecursive ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   105
            "/ 'recursive _error in debugger ignored' _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   106
            ^ self
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   107
        ].
14798
a31ff766419e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14797
diff changeset
   108
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   109
        aString _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   110
        Processor notNil ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   111
            active := Processor activeProcess.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   112
            'process: id=' _errorPrint. active id _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   113
            ' name=' _errorPrint. active name _errorPrintCR.
4960
a047d70c18f6 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 4572
diff changeset
   114
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   115
            'context: ' _errorPrint. aContext printString _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   116
            (con := aContext) notNil ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   117
                con := con sender.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   118
                ' ......: ' _errorPrint. con printString _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   119
                [con notNil] whileTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   120
                    sender := con sender.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   121
                    (sender notNil and:[sender selector == con selector]) ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   122
                        ' ......: ' _errorPrint. sender printString _errorPrintCR.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   123
                        ' ......:  [** intermediate recursive contexts skipped **]' _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   124
                        [sender notNil
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   125
                         and:[sender selector == con selector
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   126
                         and:[sender method == con method]]] whileTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   127
                            con := sender.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   128
                            sender := con sender.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   129
                        ].
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   130
                    ].
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   131
                    con := sender.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   132
                    ' ......: ' _errorPrint. con printString _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   133
                ]
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   134
            ]
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   135
        ].
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   136
        NotFirstTimeEntered ~~ true ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   137
            NotFirstTimeEntered := true.
22733
088282c8f9f2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 22256
diff changeset
   138
            'Type "c" to proceed, "a" to abort, "?" for help' _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   139
        ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   140
    ].
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   141
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   142
    OperatingSystem hasConsole ifFalse:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   143
        Error handle:[:ex |
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   144
            ex return
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   145
        ] do:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   146
            self warn:('Unexpected _error:\' , aString , '\\No MiniDebugger functionality available') withCRs .
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   147
        ].
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   148
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   149
        Error handle:[:ex |
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   150
            'cannot raise Abort - exiting ...' _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   151
            OperatingSystem exit:10.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   152
        ] do:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   153
            AbortOperationRequest raise.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   154
        ]
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   155
    ] ifTrue:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   156
        self new 
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   157
            inputStream:inputStreamOrNil;
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   158
            enter:aContext mayProceed:mayProceed.
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   159
    ].
4961
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
   160
    mayProceed ifFalse:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   161
        AbortOperationRequest raise
4961
5419c9a32316 abort after unproceedable error
Stefan Vogel <sv@exept.de>
parents: 4960
diff changeset
   162
    ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   163
    ^ nil
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   164
4209
7c1b4df9e555 care for noConsole present (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 4003
diff changeset
   165
    "Modified: / 19.5.1999 / 18:14:33 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   166
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   167
11235
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   168
enterException:ex
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   169
    "enter a debugger; if this is a recursive invocation, enter
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   170
     a MiniDebugger instead.
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   171
     This is the standard way of entering the debugger;
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   172
     sent from error- and halt messages."
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   173
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   174
    ^ self
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   175
        enter:ex returnableSuspendedContext
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   176
        withMessage:(ex creator name,': ',ex descriptionForDebugger)
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   177
        mayProceed:(ex mayProceed)
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   178
        input:nil
11235
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   179
!
48c4b0d76bad +enterException
Claus Gittinger <cg@exept.de>
parents: 11060
diff changeset
   180
4572
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   181
enterWithMessage:aString mayProceed:mayProceed
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   182
    "enter a miniDebugger"
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   183
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   184
    ^ self
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   185
        enter:thisContext sender
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   186
        withMessage:aString
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   187
        mayProceed:mayProceed
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   188
        input:nil
4572
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   189
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   190
    "Modified: / 19.5.1999 / 18:14:33 / cg"
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   191
!
79f02c7c9b75 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
   192
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   193
new
3814
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   194
    "redefined to make certain that there is only one miniDebugger
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   195
     in the system"
1227e4690753 allow aborting other threads
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   196
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   197
    ^ self basicNew initialize.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   198
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   199
"/    TheOneAndOnlyDebugger isNil ifTrue:[
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   200
"/        TheOneAndOnlyDebugger := self basicNew initialize
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   201
"/    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   202
"/    ^ TheOneAndOnlyDebugger
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   203
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   204
    "
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   205
     TheOneAndOnlyDebugger := nil
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   206
    "
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
   207
3701
0842b63bac1d renamed p command to l.
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   208
    "Modified: / 31.7.1998 / 17:08:07 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   209
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   210
4966
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   211
openOn:aProcess
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   212
    "enter a miniDebugger"
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   213
8840
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   214
    ^ self
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   215
        enter:thisContext sender
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   216
        withMessage:'MiniDebugger [info]: Attention - process debugging not possible.'
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   217
        mayProceed:true
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   218
        input:nil
4966
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   219
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   220
    "Modified: / 19.5.1999 / 18:14:33 / cg"
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   221
!
1dd6c30ad297 Implement #openOn:
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
   222
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   223
singleStep:aBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   224
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   225
a27a279701f8 Initial revision
claus
parents:
diff changeset
   226
    aDebugger := self new stepping.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   227
    ObjectMemory stepInterruptHandler:aDebugger.
2
claus
parents: 1
diff changeset
   228
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   229
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   230
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   231
    aBlock value.
2
claus
parents: 1
diff changeset
   232
    StepInterruptPending := nil.
claus
parents: 1
diff changeset
   233
    ObjectMemory stepInterruptHandler:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   234
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   235
a27a279701f8 Initial revision
claus
parents:
diff changeset
   236
trace:aBlock
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   237
    self trace:aBlock with:[:where | where _errorPrintCR]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   238
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   239
    "Modified: 20.5.1996 / 10:27:37 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   240
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   241
a27a279701f8 Initial revision
claus
parents:
diff changeset
   242
trace:aBlock on:aStream
a27a279701f8 Initial revision
claus
parents:
diff changeset
   243
    self trace:aBlock with:[:where | where printString printOn:aStream.
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
   244
				     aStream cr]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   245
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   246
a27a279701f8 Initial revision
claus
parents:
diff changeset
   247
trace:aBlock with:aTraceBlock
a27a279701f8 Initial revision
claus
parents:
diff changeset
   248
    |aDebugger|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   249
a27a279701f8 Initial revision
claus
parents:
diff changeset
   250
    aDebugger := self new tracingWith:aTraceBlock.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   251
    ObjectMemory stepInterruptHandler:aDebugger.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   252
    ObjectMemory flushInlineCaches.
241
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   253
    StepInterruptPending := 1.
6f30be88e314 *** empty log message ***
claus
parents: 216
diff changeset
   254
    InterruptPending := 1.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   255
    aBlock value.
2
claus
parents: 1
diff changeset
   256
    ObjectMemory stepInterruptHandler:nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   257
    StepInterruptPending := nil.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   258
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
   259
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   260
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   261
!MiniDebugger methodsFor:'accessing'!
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   262
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   263
inputStream:aStream
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   264
    "if non-nil, the debugger will read its input from there.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   265
     This allows for a miniDebugger to be used in a telnet stream (scripting)"
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   266
     
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   267
    inputStream := aStream.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   268
! !
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   269
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   270
!MiniDebugger methodsFor:'entering'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   271
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   272
enter:aContext mayProceed:mayProceed
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   273
    "regular entry, via unhandled exception"
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   274
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   275
    |c leaveCmd stillHere yesNo|
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   276
20498
55a474a03da9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20497
diff changeset
   277
    Display notNil ifTrue:[
55a474a03da9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20497
diff changeset
   278
        Display ungrabKeyboard; ungrabPointer.
55a474a03da9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20497
diff changeset
   279
    ].
55a474a03da9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20497
diff changeset
   280
    
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   281
    enteringContext := dot := aContext.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   282
    nesting := 0.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   283
    c := aContext.
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   284
    [c notNil] whileTrue:[
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   285
        c selector == #enter:mayProceed: ifTrue:[
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   286
            nesting := nesting + 1.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   287
        ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   288
        c := c sender.
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   289
    ].
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   290
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   291
    stillHere := true.
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   292
    [stillHere] whileTrue:[
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   293
        AbortOperationRequest handle:[:ex |
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   294
            '** Abort caught - back in previous debugLevel' _errorPrintCR.
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   295
        ] do:[
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   296
            Error handle:[:ex |
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   297
                StreamError handle:[:ex|
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   298
                    "You won't see this probably - but you will see it when doing a syscall trace"
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   299
                    'Error while processing _error in MiniDebugger (Stdout closed?):' _errorPrintCR.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   300
                    ex description _errorPrintCR.
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   301
                    OperatingSystem exit:10.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   302
                ] do:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   303
                    'Error while executing MiniDebugger command: ' _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   304
                    ex description _errorPrintCR.
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   305
                    yesNo := self getCommand:'- (i)gnore / (p)roceed / (d)ebug / b(acktrace) ? '.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   306
                    yesNo == $d ifTrue:[
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   307
                        MiniDebugger enterWithMessage:'Debugging debugger' mayProceed:true.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   308
                        ex proceed
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   309
                    ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   310
                    yesNo == $p ifTrue:[
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   311
                        ex proceed
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   312
                    ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   313
                    yesNo == $b ifTrue:[
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   314
                        ex suspendedContext fullPrintAll.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   315
                        ex proceed
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   316
                    ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   317
                ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   318
            ] do:[
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   319
                [
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   320
                    leaveCmd := self commandLoop.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   321
                ] valueUnpreemptively.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   322
            ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   323
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   324
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   325
        (leaveCmd == $s) ifTrue: [
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   326
            self stepping.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   327
            ObjectMemory flushInlineCaches.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   328
            ObjectMemory stepInterruptHandler:self.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   329
            stillHere := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   330
            StepInterruptPending := 1.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   331
            InterruptPending := 1
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   332
        ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   333
        (leaveCmd == $t) ifTrue: [
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   334
            traceBlock := [:where | self printContext:where].
19148
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   335
            ObjectMemory flushInlineCaches.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   336
            ObjectMemory stepInterruptHandler:self.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   337
            stillHere := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   338
            StepInterruptPending := 1.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   339
            InterruptPending := 1
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   340
        ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   341
        (leaveCmd == $c) ifTrue: [
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   342
            traceBlock := nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   343
            ObjectMemory flushInlineCaches.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   344
            ObjectMemory stepInterruptHandler:nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   345
            stillHere := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   346
            stepping := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   347
            tracing := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   348
            StepInterruptPending := nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   349
            InterruptPending := nil
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   350
        ].
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   351
        ((leaveCmd == $a) or:[(leaveCmd == $Y)]) ifTrue: [
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   352
            "abort"
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   353
            traceBlock := nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   354
            ObjectMemory flushInlineCaches.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   355
            ObjectMemory stepInterruptHandler:nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   356
            stepping := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   357
            tracing := false.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   358
            StepInterruptPending := nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   359
            InterruptPending := nil.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   360
            self doAbort.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   361
            stillHere := true.
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   362
            "failed abort"
705da493d1e9 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19147
diff changeset
   363
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   364
    ].
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   365
    enteringContext := dot := nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   366
    ^ nil
3769
e165c2b17d28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3701
diff changeset
   367
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   368
    "Modified (comment): / 29-09-2011 / 09:05:57 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   369
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   370
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   371
stepInterrupt
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   372
    "entry via single stepinterrupt"
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   373
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   374
    |where|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   375
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   376
    where := thisContext.        "where is stepInterrupt context"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   377
    where notNil ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   378
        where := where sender    "where is now interrupted methods context"
618
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
    stepping ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   381
        where notNil ifTrue:[
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   382
            self printContext:where
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   383
        ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   384
            'stepInterrupt: no context' _errorPrintCR
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   385
        ].
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   386
        self enter:where mayProceed:true
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   387
    ] ifFalse:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   388
        where notNil ifTrue:[
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   389
            traceBlock notNil ifTrue:[
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   390
                traceBlock value:where
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   391
            ]
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   392
        ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   393
            'traceInterrupt: no context' _errorPrintCR
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   394
        ].
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   395
        ObjectMemory flushInlineCaches.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   396
        StepInterruptPending := 1.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   397
        InterruptPending := 1
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   398
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   399
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   400
    "Modified: / 20-05-1996 / 10:23:11 / cg"
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   401
    "Modified (comment): / 29-09-2011 / 09:06:29 / cg"
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   402
! !
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   403
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   404
!MiniDebugger methodsFor:'initialization'!
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   405
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   406
initialize
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   407
    traceBlock := nil.
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   408
    tracing := false.
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   409
    stepping := false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   410
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   411
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   412
!MiniDebugger methodsFor:'private'!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   413
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   414
findContext:aSelector
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   415
    |con|
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   416
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   417
    con := thisContext sender.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   418
    [con notNil] whileTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   419
	(con isBlockContext not and:[con selector == aSelector]) ifTrue:[
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   420
	    "got it"
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   421
	    ^ con
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   422
	].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   423
	con := con sender
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   424
    ].
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   425
    ^ nil
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   426
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   427
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
   428
garbageCollectCommand:id
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
   429
    id == 3 ifTrue:[
8840
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   430
	ObjectMemory reclaimSymbols.
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   431
	ObjectMemory compressOldSpace.
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
   432
    ] ifFalse:[
8840
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   433
	id == 2 ifTrue:[
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   434
	    ObjectMemory reclaimSymbols.
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   435
	] ifFalse:[
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   436
	    ObjectMemory garbageCollect.
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   437
	]
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
   438
    ]
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
   439
!
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
   440
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   441
getCharacter
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   442
    inputStream isNil ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   443
        "/ globally blocking
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   444
        ^ Character fromUser
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   445
    ].
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   446
    ^ inputStream next
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   447
!
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   448
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   449
getContext
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   450
    |backtrace|
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   451
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   452
    backtrace := thisContext.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   453
    (backtrace notNil) ifTrue: [
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   454
	[backtrace selector ~~ #commandLoop] whileTrue:[
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   455
	    backtrace := backtrace sender.
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   456
	].
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   457
	"remove Debugger commandLoop frame"
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   458
	backtrace := backtrace sender.
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   459
	"remove Debugger enter frame"
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   460
	backtrace := backtrace sender
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
    ^ backtrace
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   463
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   464
    "Modified: / 29-09-2011 / 09:00:14 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   465
!
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   466
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   467
moveDotDown
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   468
    "/ sigh - must search
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   469
    |c|
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   470
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   471
    dotProcess isNil ifTrue:[ 
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   472
        c := enteringContext
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   473
    ] ifFalse:[ 
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   474
        c := dotProcess suspendedContext.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   475
        c isNil ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   476
            '** process is not suspended' _errorPrintCR.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   477
        ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   478
    ].
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   479
    [ c notNil and:[ c sender ~~ dot ] ] whileTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   480
        c := c sender.
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   481
    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   482
    c notNil ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   483
        dot := c.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   484
        "/ dot fullPrint.
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   485
    ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   486
        '** dot is the bottom of the calling chain' _errorPrintCR.
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   487
    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   488
!
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   489
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   490
moveDotUp
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   491
    |sender|
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   492
    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   493
    (sender := dot sender) notNil ifTrue:[
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   494
        dot := sender.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   495
        "/ dot fullPrint.
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   496
    ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   497
        '** dot is the top of the calling chain' _errorPrintCR.
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   498
    ].
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   499
!
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   500
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   501
printBacktraceFrom:aContext
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   502
    |context n|
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   503
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   504
    aContext isNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   505
        'no context' _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   506
        ^ self
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   507
    ].
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   508
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   509
    context := aContext.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   510
    n := commandCount.
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
   511
    [context notNil] whileTrue: [
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   512
        self printContext:context.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   513
        context := context sender.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   514
        n notNil ifTrue:[
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   515
            n := n - 1.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   516
            n <= 0 ifTrue:[
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   517
                ^ self
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   518
            ]
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   519
        ]
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   520
    ]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   521
!
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
   522
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   523
printContext:aContext
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   524
    "print the receiver, selector and args of the context"
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   525
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   526
    "/ aContext fullPrint.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   527
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   528
    aContext receiverPrintString _errorPrint. ' ' _errorPrint. 
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   529
    aContext selector asString _errorPrint.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   530
    aContext argumentCount ~~ 0 ifTrue: [
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   531
        ' ' _errorPrint. aContext argsDisplayString _errorPrint
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   532
    ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   533
    ' [' _errorPrint. 
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   534
    aContext lineNumber asString _errorPrint. 
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   535
    ']' _errorPrintCR
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   536
!
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   537
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   538
printDot
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   539
    |mthd argNames varNames|
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   540
    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   541
    '' _errorPrintCR.
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   542
    
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   543
    self printContext:dot.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   544
    '  receiver: ' _errorPrint. dot receiver printString _errorPrintCR.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   545
    '  selector: ' _errorPrint. dot selector _errorPrintCR.
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   546
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   547
    dot isBlockContext ifFalse:[
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   548
        (mthd := dot method) notNil ifTrue:[
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   549
            Error ignoreIn:[    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   550
                argNames := mthd methodArgNames.
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   551
            ].
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   552
            Error ignoreIn:[
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   553
                varNames := mthd methodVarNames
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   554
            ].    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   555
        ].
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   556
    ].
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   557
    "/ '  args: ' _errorPrint. (argNames ? #() asStringWith:$;) _errorPrintCR.
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   558
    "/ '  vars: ' _errorPrint. (varNames ? #() asStringWith:$;) _errorPrintCR.
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   559
    
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   560
    '  args: ' _errorPrintCR.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   561
    dot args keysAndValuesDo:[:idx :eachArg |
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   562
        '    ' _errorPrint. 
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   563
        argNames notNil ifTrue:[
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   564
            (argNames at:idx) _errorPrint.
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   565
        ] ifFalse:[    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   566
            'arg' _errorPrint. idx _errorPrint. 
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   567
        ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   568
        ': ' _errorPrint. eachArg printString _errorPrintCR.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   569
    ].
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   570
    
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   571
    '  vars: ' _errorPrintCR.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   572
    dot vars keysAndValuesDo:[:idx :eachVar |
23881
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   573
        |varName|
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   574
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   575
        varNames notNil ifTrue:[
23881
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   576
            varName := varNames at:idx ifAbsent:nil
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   577
        ].
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   578
        
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   579
        '    ' _errorPrint. 
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   580
        varName notNil ifTrue:[
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   581
            varName _errorPrint.
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   582
        ] ifFalse:[    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   583
            'var' _errorPrint. idx _errorPrint. 
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   584
        ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   585
        ': ' _errorPrint. eachVar printString _errorPrintCR.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   586
    ].
20908
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   587
    
f7abc669164a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20904
diff changeset
   588
    '' _errorPrintCR.
23881
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   589
6a516cb11eba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23519
diff changeset
   590
    "Modified: / 12-03-2019 / 22:36:26 / Claus Gittinger"
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   591
!
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   592
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   593
printDotsMethodSource
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   594
    self printDotsMethodSource:false
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   595
!
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   596
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   597
printDotsMethodSource:full
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   598
    |home mthd src pcLineNr startLnr stopLnr|
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   599
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   600
    home := dot methodHome.
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   601
    mthd := home method.
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   602
    mthd isNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   603
        '** no source **' _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   604
        ^ self.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   605
    ].
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   606
    src := mthd source.
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   607
    src isNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   608
        '** no source **' _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   609
        ^ self.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   610
    ].
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   611
    pcLineNr := dot lineNumber.
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   612
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   613
    src := src asCollectionOfLines.
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   614
    full ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   615
        startLnr := 1.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   616
        stopLnr := src size.
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   617
    ] ifFalse:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   618
        startLnr := pcLineNr-10 max:1.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   619
        stopLnr := pcLineNr+10 min:src size.
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   620
    ].
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   621
    startLnr to:stopLnr do:[:lNr |
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   622
        lNr == pcLineNr ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   623
            '>> ' _errorPrint.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   624
        ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   625
            '   ' _errorPrint.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   626
        ].
20904
6452a9e1bae3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20903
diff changeset
   627
        (lNr printStringLeftPaddedTo:3) _errorPrint. '| ' _errorPrint.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   628
        (src at:lNr) asString _errorPrintCR.
8717
b1d4786a1e2f more functions
Claus Gittinger <cg@exept.de>
parents: 8389
diff changeset
   629
    ]
5942
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   630
!
e3431a2c33f1 avoid statements after return
Claus Gittinger <cg@exept.de>
parents: 5921
diff changeset
   631
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   632
stepping
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   633
    traceBlock := nil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   634
    tracing := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   635
    stepping := true
74
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   636
!
5fb970c7cb96 *** empty log message ***
claus
parents: 33
diff changeset
   637
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   638
tracingWith:aBlockOrNil
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   639
    traceBlock := aBlockOrNil.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   640
    stepping := false.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   641
    tracing := true
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   642
! !
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   643
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   644
!MiniDebugger methodsFor:'user commands'!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   645
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   646
commandLoop
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   647
    "read-eval commands, until one of the continue, abort or single step commands is entered;
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   648
     return the last command character"
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   649
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   650
    |cmd done|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   651
a27a279701f8 Initial revision
claus
parents:
diff changeset
   652
    done := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   653
    [done] whileFalse:[
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   654
	cmd := self getCommand:nil.
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   655
	cmd isNil ifTrue:[   "/ EOF is treated like continue command
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   656
	    cmd := $c
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   657
	].
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   658
	done := self doCommand:cmd.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   659
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   660
    ^ cmd
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   661
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   662
    "Modified (comment): / 29-09-2011 / 09:02:24 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   663
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   664
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   665
doAbort
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   666
    |con sig|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   667
6204
2bafef9151dd class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
   668
    (sig := AbortOperationRequest) isHandled ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   669
        sig raise.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   670
        'abort raise failed' _errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   671
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   672
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   673
    "TEMPORARY kludge - find event handler context
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   674
     this will be removed, once real debugging is possible
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   675
    "
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   676
    con := self findContext:#processEvent.
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   677
    con isNil ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   678
        con := self findContext:#dispatch.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   679
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   680
    con notNil ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   681
        "got it"
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
   682
        con return.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   683
        'return failed' _errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   684
    ].
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   685
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   686
    'found no context to resume' _errorPrintCR.
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
   687
6204
2bafef9151dd class based exceptions - abortSignal;
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
   688
    "Modified: / 16.11.2001 / 17:39:14 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   689
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   690
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   691
doCommand:cmd
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
   692
    "a single command;
14797
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
   693
     return true, if command loop should be finished"
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   694
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   695
    |id proc bool retVal|
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   696
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   697
    "/ care for argument after command character (pid or '+' or '-')
15860
7952d944b767 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15859
diff changeset
   698
    commandArg notEmptyOrNil ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   699
        id := Number readFrom:commandArg onError:nil.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   700
        id notNil ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   701
            proc := Process allSubInstances detect:[:p | p id == id] ifNone:nil.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   702
            proc == Processor activeProcess ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   703
                id := proc := nil
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   704
            ]
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   705
        ] ifFalse:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   706
            commandArg = '-' ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   707
                bool := false
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   708
            ] ifFalse:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   709
                commandArg = '+' ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   710
                    bool := true
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   711
                ]
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   712
            ]
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   713
        ]
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   714
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   715
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   716
    "/ S -> save
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   717
    (cmd == $S) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   718
        'saving "crash.img"...' _errorPrint.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   719
        ObjectMemory writeCrashImage.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   720
        'done.' _errorPrintCR.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   721
        ^ false
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   722
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   723
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   724
    "/ C -> save session changes
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   725
    (cmd == $C) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   726
        |changesFilename|
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   727
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   728
        changesFilename := Timestamp now
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   729
             printStringFormat:'changes_%(year)-%(month)-%(day)__%h:%m:%s.chg'.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   730
        OperatingSystem isMSWINDOWSlike ifTrue:[ changesFilename replaceAll:$: with:$_ ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   731
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   732
        ('saving session changes to "',changesFilename,'"...') _errorPrintCR.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   733
        ChangeSet current fileOutAs: changesFilename.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   734
        'done.' _errorPrintCR.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   735
        ^ false
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   736
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   737
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   738
    "/ B -> print backtrace of all processes
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   739
    (cmd == $B) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   740
        self printAllBacktraces.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   741
        ^ false
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   742
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   743
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   744
    "/ P -> print all processes
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   745
    (cmd == $P) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   746
        self showProcesses:#all.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   747
        ^ false
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   748
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   749
    "/ c -> continue
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   750
    (cmd == $c) ifTrue:[^ true].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   751
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   752
    "/ s -> single step
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   753
    (cmd == $s) ifTrue:[^ true].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   754
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   755
    "/ t -> continue with trace
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   756
    (cmd == $t) ifTrue:[^ true].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   757
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   758
    "/ a -> abort
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   759
    (cmd == $a) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   760
        id isNil ifTrue:[^ true].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   761
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   762
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   763
    "/ p -> list (alive) processes
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   764
    (cmd == $p) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   765
        self showProcesses:#live.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   766
        ^ false
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   767
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   768
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   769
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   770
    ('wbTQa=' includes:cmd) ifTrue:[
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   771
        (id notNil and:[proc isNil]) ifTrue:[
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   772
            'no process with id: ' _errorPrint. id _errorPrintCR.
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   773
            ^ false.
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   774
        ].
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   775
    ].
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   776
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   777
    "/ = id -> set current process for dot (to inspect chain/receiver of another thread)
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   778
    (cmd == $=) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   779
        (dotProcess == proc) ifFalse:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   780
            dotProcess := proc.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   781
            proc isNil ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   782
                dot := enteringContext.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   783
                'switched back to interrupted process (for dot commands): ' _errorPrint. Processor activeProcess _errorPrintCR.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   784
            ] ifFalse:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   785
                dot := proc suspendedContext.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   786
                'switched to process (for dot commands): ' _errorPrint. proc _errorPrintCR.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   787
            ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   788
        ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   789
        ^ false.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   790
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   791
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   792
    (cmd == $a) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   793
        "/ here a with id-arg
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   794
        proc == Processor activeProcess ifTrue:[^ true].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   795
        proc interruptWith:[ AbortOperationRequest raise ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   796
        ^ false.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   797
    ].
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   798
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   799
    (cmd == $w) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   800
        proc notNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   801
            '-------- walkback of process ' _errorPrint. id _errorPrint. ' -------' _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   802
            self printBacktraceFrom:(proc suspendedContext)
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   803
        ] ifFalse:[
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   804
            '-------- walkback of current process -------' _errorPrintCR.
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   805
            self printBacktraceFrom:(self getContext)
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   806
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   807
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   808
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   809
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   810
    (cmd == $b) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   811
        proc notNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   812
            '-------- VM walkback of process ' _errorPrint. id _errorPrint. ' -------' _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   813
            (Processor activeProcess environmentAt:#Stderr ifAbsent:Stderr) == Stderr ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   814
                ObjectMemory printStackBacktraceFrom:(proc suspendedContext)
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   815
            ] ifFalse:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   816
                self printBacktraceFrom:(proc suspendedContext)
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   817
                "/ proc suspendedContext fullPrintAllOn:(Processor activeProcess environmentAt:#Stderr)
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   818
            ].    
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   819
        ] ifFalse:[
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   820
            '-------- VM walkback of current process -------' _errorPrintCR.
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   821
            (Processor activeProcess environmentAt:#Stderr ifAbsent:Stderr) == Stderr ifTrue:[
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   822
                ObjectMemory printStackBacktrace
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   823
            ] ifFalse:[
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   824
                "/ self printBacktraceFrom:(self getContext)
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   825
                thisContext fullPrintAllOn:(Processor activeProcess environmentAt:#Stderr)
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   826
            ]
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   827
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   828
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   829
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   830
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   831
    (cmd == $r) ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   832
        dot receiver _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   833
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   834
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   835
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   836
    (cmd == $i) ifTrue:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   837
        |inspectedObject|
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   838
        
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   839
        (commandArg ? '') withoutSeparators notEmpty ifTrue:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   840
            inspectedObject := (Parser evaluate:commandArg).
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   841
        ] ifFalse:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   842
            inspectedObject := (dot receiver).
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   843
        ].
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   844
        MiniInspector openOn:inspectedObject input:inputStream.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   845
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   846
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   847
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   848
    (cmd == $I) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   849
        self interpreterLoopWith:nil.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   850
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   851
    ].
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   852
    ((cmd == $E) or:[(cmd == $e)]) ifTrue:[
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   853
        retVal := Parser evaluate:commandArg in:dot receiver:(dot receiver) notifying:nil ifFail:nil.
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
   854
        (cmd == $e) ifTrue:[ retVal _errorPrintCR ].
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   855
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   856
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   857
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   858
    (cmd == $u) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   859
        stepping := false.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   860
        tracing := false.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   861
        Processor activeProcess vmTrace:false.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   862
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   863
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   864
14797
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
   865
    (cmd == $h) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   866
        (bool notNil) ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   867
            Smalltalk ignoreHalt:bool not.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   868
        ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   869
        'halts are ' _errorPrint. (Smalltalk ignoreHalt ifTrue:['disabled'] ifFalse:['enabled']) _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   870
        ^ false
14797
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
   871
    ].
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
   872
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   873
    (cmd == $R) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   874
        proc notNil ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   875
            proc resume.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   876
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   877
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   878
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   879
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   880
    (cmd == $T) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   881
        proc notNil ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   882
            proc terminate.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   883
        ] ifFalse:[
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   884
            Processor terminateActive
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   885
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   886
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   887
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   888
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   889
    (cmd == $W) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   890
        proc notNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   891
            'stopping process id: ' _errorPrint. id _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   892
            proc stop.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   893
        ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   894
            'invalid process id: ' _errorPrint. id _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   895
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   896
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   897
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   898
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   899
    (cmd == $a) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   900
        "without id-arg, this is handled by caller"
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   901
        proc notNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   902
            'aborting process id: ' _errorPrint. id _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   903
            proc interruptWith:[AbortOperationRequest raise]
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   904
        ] ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   905
            'aborting' _errorPrintCR.
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   906
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   907
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   908
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   909
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   910
    (cmd == $Q) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   911
        proc notNil ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   912
            proc terminateNoSignal.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   913
        ] ifFalse:[
25251
61b643937051 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25245
diff changeset
   914
            Processor terminateActiveNoSignal
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   915
        ].
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   916
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   917
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   918
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   919
    (cmd == $g) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   920
        self garbageCollectCommand:id.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   921
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   922
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   923
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   924
    (cmd == $U) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   925
        MessageTracer unwrapAllMethods.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   926
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   927
    ].
15929
84483f64a975 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15927
diff changeset
   928
    (cmd == $D) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   929
        Breakpoint disableAllBreakpoints.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   930
        ^ false
15929
84483f64a975 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15927
diff changeset
   931
    ].
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   932
    (cmd == $X) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   933
        Smalltalk fatalAbort.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   934
        "/ not reached
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   935
        ^ false
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   936
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   937
    (cmd == $x) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   938
        OperatingSystem exit.
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   939
        "/ not reached
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   940
        ^ false
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   941
    ].
19146
29102aa35885 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19145
diff changeset
   942
    (cmd == $Y) ifTrue:[
19925
a587d23acfc7 #BUGFIX by mawalch
mawalch
parents: 19389
diff changeset
   943
        Display := nil.
19147
dc16eac48a43 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19146
diff changeset
   944
        Smalltalk openDisplay.
dc16eac48a43 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19146
diff changeset
   945
        NewLauncher open.
dc16eac48a43 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19146
diff changeset
   946
        ^ true
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   947
    ].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   948
14737
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   949
    (cmd == $l) ifTrue:[self printDotsMethodSource:false. ^ false ].
e00cd7ab5db3 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 13740
diff changeset
   950
    (cmd == $L) ifTrue:[self printDotsMethodSource:true. ^ false ].
22256
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   951
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   952
    ('.+-' includes:cmd) ifTrue:[
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   953
        (id ? 1) timesRepeat:[
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   954
            (cmd == $-) ifTrue:[
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   955
                self moveDotUp].
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   956
            (cmd == $+) ifTrue:[
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   957
                self moveDotDown].
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   958
        ].        
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   959
        self printDot. 
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   960
        ^ false.
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   961
    ].
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   962
    
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
   963
    (cmd == $?) ifTrue:[
19145
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   964
        commandArg notEmpty ifTrue:[
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   965
            self helpOn:commandArg. ^ false
d67d8a5f23a0 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19144
diff changeset
   966
        ]
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
   967
    ].
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   968
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   969
    "/ avoid usage print if return was typed ...
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   970
    ((cmd == Character return)
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   971
    or:[cmd == Character linefeed]) ifTrue:[^ false].
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   972
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   973
    self showValidCommandHelp.
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   974
    ^ false.
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   975
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   976
    "Created: / 29-09-2011 / 08:58:47 / cg"
22256
8ceb4fec6903 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20908
diff changeset
   977
    "Modified: / 15-09-2017 / 14:30:48 / cg"
13740
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   978
!
7a20ba6d637f refactored
Claus Gittinger <cg@exept.de>
parents: 13113
diff changeset
   979
5802
93748287026d better Mini- debugging tools (+/- context in debugger); interpreter in inspector.
Claus Gittinger <cg@exept.de>
parents: 5054
diff changeset
   980
getCommand:prompt
3126
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   981
"/    Screen notNil ifTrue:[
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   982
"/        Screen allScreens do:[:aScreen |
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   983
"/            aScreen ungrabPointer.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   984
"/            aScreen ungrabKeyboard.
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   985
"/        ].
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   986
"/    ].
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   987
e37ccb66f1b0 onlz ungrab the main Display (remote display could be inoperable)
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
   988
    Display notNil ifTrue:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   989
        Display ungrabPointer.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   990
        Display ungrabKeyboard.
852
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   991
    ].
5c4a0585ba0b ungrab pointer for every input
Claus Gittinger <cg@exept.de>
parents: 720
diff changeset
   992
8840
c1de163feeb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8721
diff changeset
   993
    (prompt
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   994
        ? (nesting == 0 ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   995
            'MiniDebugger> '
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   996
          ] ifFalse:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
   997
            'MiniDebugger' , nesting printString , '>'
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
   998
          ])) _errorPrint.
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
   999
7706
69afbbcd7033 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7705
diff changeset
  1000
    UserInterrupt handle:[:ex |
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1001
        ex restart
159
514c749165c3 *** empty log message ***
claus
parents: 93
diff changeset
  1002
    ] do:[
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1003
        |c cmd arg cnt|
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  1004
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1005
        cmd := self getCharacter.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1006
        cmd isNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1007
            '<EOF>' _errorPrintCR.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1008
            "
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1009
             mhmh end-of-file;
20420
79810aad4d09 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19925
diff changeset
  1010
             return a 'c' (for continue); hope that's ok.
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1011
            "
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1012
            cmd := $c
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1013
        ].
93
e31220cb391f *** empty log message ***
claus
parents: 89
diff changeset
  1014
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1015
        cnt := nil.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1016
        (cmd isDigit) ifTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1017
            cnt := 0.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1018
            [
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1019
                cnt := (cnt * 10) + cmd digitValue.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1020
                cmd := self getCharacter
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1021
            ] doWhile:[cmd notNil and:[cmd isDigit]].
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1022
            [cmd notNil and:[cmd == Character space]] whileTrue:[
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1023
                cmd := self getCharacter
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1024
            ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1025
            cmd isNil ifTrue:[ '<EOF>' _errorPrintCR ].
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1026
        ].
4003
d0f97b9cd4de added 'S' -> stopp a process
Claus Gittinger <cg@exept.de>
parents: 3814
diff changeset
  1027
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1028
        "
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1029
         collect to end-of-line in arg
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1030
        "
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1031
        c := cmd.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1032
        arg := ''.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1033
        [c isNil or:[c isEndOfLineCharacter]] whileFalse: [
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1034
            arg := arg copyWith:c.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1035
            c := self getCharacter.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1036
            c isNil ifTrue:[ '<EOF>' _errorPrintCR ].
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1037
        ].
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1038
        commandArg := (arg copyFrom:2) withoutSeparators.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1039
        command := cmd.
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1040
        commandCount := cnt.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1041
    ].
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  1042
    ^ command
976
d27628f54b71 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 940
diff changeset
  1043
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  1044
    "Modified: / 31.7.1998 / 16:11:01 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1045
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1046
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1047
helpOn:commandArg
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1048
    |args className sym val match showMethod|
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1049
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1050
    commandArg withoutSeparators isEmpty ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1051
        'usage: H className [methodPattern]' _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1052
        ^self
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1053
    ].
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1054
    args := commandArg asCollectionOfWords.
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1055
    className := args first.
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
  1056
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1057
    (sym := className asSymbolIfInterned) isNil ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1058
        'no such class' _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1059
        ^ self.
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1060
    ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1061
    val := Smalltalk at:sym ifAbsent:['no such class' _errorPrintCR. ^ self.].
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1062
    val isBehavior ifFalse:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1063
        'not a class: ' _errorPrint. className _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1064
        val := val class.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1065
        'showing help for ' _errorPrint. val name _errorPrintCR.
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1066
    ].
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1067
    args size > 1 ifTrue:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1068
        match := args at:2
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1069
    ] ifFalse:[
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1070
        match := '*'
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1071
    ].
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1072
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
  1073
    showMethod :=
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1074
        [:sel :cls |
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1075
            |mthd|
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1076
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1077
            ((match includesMatchCharacters and:[ sel matches:match caseSensitive:false])
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1078
            or:[ sel asLowercase startsWith:match asLowercase ]) ifTrue:[
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1079
                mthd := cls compiledMethodAt:sel.
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1080
                mthd category ~= 'documentation' ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1081
                    sel _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1082
                    (mthd comment ? '') asStringCollection do:[:l |
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1083
                        '    ' _errorPrint. l withoutSeparators _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1084
                    ].
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1085
                    '' _errorPrintCR
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1086
                ].
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1087
            ].
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1088
        ].
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1089
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1090
    val theMetaclass selectors copy sort do:[:sel |
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1091
        showMethod value:sel value:val theMetaclass
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1092
    ].
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1093
    val theNonMetaclass selectors copy sort do:[:sel |
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1094
        showMethod value:sel value:val theNonMetaclass
15195
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1095
    ].
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1096
!
e92dd9929b4f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15122
diff changeset
  1097
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1098
interpreterLoopWith:anObject
16079
3eb69d91d0e4 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15930
diff changeset
  1099
    'MinDebugger read-eval-print loop; exit with "#exit"; help with "?"' printCR.
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
  1100
    ReadEvalPrintLoop new
20826
1d49eb5d790f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20825
diff changeset
  1101
        prompt:'mDBG > ';
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1102
        doChunkFormat:false;
22830
00ba7fc7bdca #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22733
diff changeset
  1103
        errorStream:(Processor activeProcess stderr);
19389
a5eb4f53c2b4 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19149
diff changeset
  1104
        readEvalPrintLoop.
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  1105
10630
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1106
"/    |line done rslt|
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1107
"/
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1108
"/    'read-eval-print loop; exit with empty line' printCR.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1109
"/    '' printCR.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1110
"/
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1111
"/    done := false.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1112
"/    [done] whileFalse:[
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1113
"/        '> ' print.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1114
"/
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1115
"/        line := Stdin nextLine.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1116
"/        (line size == 0) ifTrue:[
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1117
"/            done := true
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1118
"/        ] ifFalse:[
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1119
"/            "/ rslt := Compiler evaluate:line
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1120
"/            "/                  receiver:anObject
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1121
"/            "/                  notifying:nil.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1122
"/
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1123
"/            rslt := Compiler
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1124
"/                evaluate:line
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1125
"/                in:dot
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1126
"/                receiver:dot receiver
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1127
"/                notifying:self "/ nil
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1128
"/                ifFail:[].
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1129
"/            rslt printCR.
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1130
"/        ]
ea09f0304075 use REPL
Claus Gittinger <cg@exept.de>
parents: 10554
diff changeset
  1131
"/    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
  1132
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  1133
    "Modified: / 31.7.1998 / 16:01:47 / cg"
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1134
!
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1135
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
  1136
printAllBacktraces
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
  1137
    Process allInstancesDo:[:p |
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1138
        (p isActive not
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1139
        and:[p isDead not]) ifTrue:[
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1140
            '---------------------------------------------------------' _errorPrintCR.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1141
            '  proc id=' _errorPrint. p id asString _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1142
            ' name=''' _errorPrint. p name asString _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1143
            ''' createdBy: ' _errorPrint. p creatorId asString _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1144
            ' state=' _errorPrint.  p state asString _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1145
            ' prio=' _errorPrint. p priority asString _errorPrintCR.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1146
            '' _errorPrintCR. '' _errorPrintCR.
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
  1147
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1148
            self printBacktraceFrom:(p suspendedContext)
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1149
        ]
2772
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
  1150
    ]
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
  1151
!
89f7289950b1 handle EOF input
Claus Gittinger <cg@exept.de>
parents: 2661
diff changeset
  1152
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1153
showProcesses
14797
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
  1154
    self showProcesses:#all
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
  1155
!
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
  1156
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
  1157
showProcesses:how
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1158
    |active|
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1159
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1160
    active := Processor activeProcess.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1161
    'current id=' _errorPrint. 
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1162
    active id printString _errorPrint. 
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1163
    ' name=''' _errorPrint. active name _errorPrint. '''' _errorPrintCR.
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1164
16094
b62b75e28f18 class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16093
diff changeset
  1165
    (Process allSubInstances sort:[:a :b | (a id ? -1)<(b id ? -1)]) do:[:p |
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1166
        |doShow|
14797
a648fe8b3c5e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14737
diff changeset
  1167
20849
4b91a44518c3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20846
diff changeset
  1168
        doShow := (how == #all) or:[ (how == #dead) == ( p isDead ) ]. 
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1169
        doShow ifTrue:[
20894
d87bb03e9619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20893
diff changeset
  1170
            'id=' _errorPrint. (p id printStringPaddedTo:6) _errorPrint.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1171
            (p state printStringPaddedTo:10) _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1172
            ' pri=' _errorPrint. (p priority printStringPaddedTo:2) _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1173
            ' creator:' _errorPrint. (p creatorId printStringPaddedTo:5) _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1174
            ' group:' _errorPrint. (p processGroupId printStringPaddedTo:5) _errorPrint.
20893
b8156b8d4067 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20849
diff changeset
  1175
            "/ ' sys:' _errorPrint. (p isSystemProcess ifTrue:'y' ifFalse:'n') _errorPrint.
20894
d87bb03e9619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20893
diff changeset
  1176
            "/ ' ui:' _errorPrint. (p isGUIProcess ifTrue:'y' ifFalse:'n') _errorPrint.
d87bb03e9619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20893
diff changeset
  1177
            (p isGUIProcess 
20895
0210e874e38b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20894
diff changeset
  1178
                ifTrue:[' ui']
20894
d87bb03e9619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20893
diff changeset
  1179
                ifFalse:[p isSystemProcess 
d87bb03e9619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20893
diff changeset
  1180
                    ifTrue:['sys'] 
d87bb03e9619 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20893
diff changeset
  1181
                    ifFalse:['usr']]) _errorPrint.
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1182
            ' name=''' _errorPrint. p name _errorPrint.
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1183
            '''' _errorPrintCR.
20496
0c25051acebd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20420
diff changeset
  1184
        ]
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1185
    ]
1424
4e56d48526c7 printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1297
diff changeset
  1186
3700
95530aec6e0b better process debugging.
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  1187
    "Modified: / 31.7.1998 / 16:30:19 / cg"
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1188
!
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1189
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1190
showValidCommandHelp
19144
2f3d50c4e256 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18681
diff changeset
  1191
        'valid commands:
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1192
   c ........ continue
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1193
   s ........ step
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1194
   t ........ trace (continue with trace)
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1195
   a [id] ... abort (i.e. raise abort signal) in (current) process
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1196
   W [id] ... stop (current) process
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1197
   R [id] ... resume (current) process
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
  1198
   T [id] ... terminate (current) process
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1199
   Q [id] ... quick terminate (current) process - no unwinds or cleanup
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1200
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1201
   p ........ list processes ("P" for full list)
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1202
   w [id] ... walkback (of current/process with id)
16557
f66c1022d93b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16249
diff changeset
  1203
   b [id] ... full (VM) backtrace with more detail
20825
38ca70e1c738 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20501
diff changeset
  1204
   B ........ backtrace for all processes
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1205
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1206
   U ........ unwrap all traced/breakpointed methods
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1207
   D ........ disable all line breakpoints
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1208
   h [-/+] .. disable/enable halts
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1209
   g ........ collect all garbage
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1210
   g 2 ...... collect all garbage & reclaim symbols
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1211
   g 3 ...... collect all garbage, reclaim symbols and compress
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1212
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1213
   S ........ save snapshot into "crash.img"
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1214
   C ........ save session changes to a separate change file
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1215
   x ........ exit Smalltalk ("X" to exit with core dump)
19149
e144119b2852 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19148
diff changeset
  1216
   Y ........ reopen display, reopen launcher
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1217
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
  1218
   = [id] ... set current process for dot commands below
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1219
   . ........ print dot (the current context)
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1220
   - ........ move dot up (sender)
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1221
   + ........ move dot down (called context)
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1222
   l ........ list dot''s method source around PC ("L" for full list)
25253
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
  1223
   r ........ print receiver (in dot)
c0422fc32176 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 25251
diff changeset
  1224
   i [expr] . inspect expression (or receiver in dot)
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1225
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1226
   I ........ interpreter (expression evaluator)
19144
2f3d50c4e256 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18681
diff changeset
  1227
   e expr ... evaluate expression & print result ("E" to not print)
2f3d50c4e256 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 18681
diff changeset
  1228
   ? c [p] .. help on class c (selectors matching p)
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1229
'  _errorPrintCR.
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1230
14798
a31ff766419e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14797
diff changeset
  1231
   (XWorkstation notNil and:[ Screen default isKindOf:XWorkstation ]) ifTrue:[
a31ff766419e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14797
diff changeset
  1232
'   To repair a broken X-Connection, enter an interpreter (enter "I") and evaluate:
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1233
      Display := XWorkstation new.
14798
a31ff766419e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14797
diff changeset
  1234
      Display initializeFor:''localhost:0''.
7701
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1235
      Display startDispatch.
81a948fdd026 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7477
diff changeset
  1236
      NewLauncher openOnDevice:Display.
16095
3ce0f0344fdc class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 16094
diff changeset
  1237
      #exit
14798
a31ff766419e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14797
diff changeset
  1238
    then enter "c" to continue; a NewLauncher should pop up soon.
23519
01b8a5b41a2f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23443
diff changeset
  1239
    To repair a frozen XQuartz display, enter the interpreter (with I)
01b8a5b41a2f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23443
diff changeset
  1240
    and execute the #qFix command. This is a hack around a race condition
01b8a5b41a2f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23443
diff changeset
  1241
    inside XQuartz and usually unlocks the deadlock (in its grab/ungrab code).
20843
e144b279147d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20826
diff changeset
  1242
'  _errorPrintCR
14798
a31ff766419e class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 14797
diff changeset
  1243
    ]
15859
15dc2dbf6e8f class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15738
diff changeset
  1244
15930
4e1fdd602add class: MiniDebugger
Claus Gittinger <cg@exept.de>
parents: 15929
diff changeset
  1245
    "Modified: / 03-02-2014 / 10:38:36 / cg"
23519
01b8a5b41a2f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23443
diff changeset
  1246
    "Modified: / 07-11-2018 / 19:55:17 / Claus Gittinger"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1247
! !
618
9048d43527d2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1248
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
  1249
!MiniDebugger class methodsFor:'documentation'!
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
  1250
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
  1251
version
18681
8844866e1a4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16626
diff changeset
  1252
    ^ '$Header$'
13113
803d470a0d28 changed:
Claus Gittinger <cg@exept.de>
parents: 11534
diff changeset
  1253
!
803d470a0d28 changed:
Claus Gittinger <cg@exept.de>
parents: 11534
diff changeset
  1254
803d470a0d28 changed:
Claus Gittinger <cg@exept.de>
parents: 11534
diff changeset
  1255
version_CVS
18681
8844866e1a4b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16626
diff changeset
  1256
    ^ '$Header$'
658
cf969399434d version at the end
Claus Gittinger <cg@exept.de>
parents: 618
diff changeset
  1257
! !
16626
bbf6b95f092f class: MiniDebugger
Stefan Vogel <sv@exept.de>
parents: 16557
diff changeset
  1258