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