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