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