author | Claus Gittinger <cg@exept.de> |
Wed, 22 Apr 1998 19:40:38 +0200 | |
changeset 663 | 41222ee0bfe9 |
parent 662 | 31b0122e8fe4 |
child 664 | 3412407a540f |
permissions | -rw-r--r-- |
8 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
11 | 3 |
All Rights Reserved |
8 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
120 | 13 |
Object subclass:#MessageTracer |
150
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
14 |
instanceVariableNames:'traceDetail' |
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
15 |
classVariableNames:'BreakpointSignal CallingLevel BreakBlock TraceSenderBlock |
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
16 |
LeaveBreakBlock LeaveTraceBlock MethodCounts MethodMemoryUsage |
660 | 17 |
MethodTiming TraceFullBlock ObjectWrittenBreakpointSignal |
18 |
ObjectCopyHolders' |
|
150
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
19 |
poolDictionaries:'' |
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
20 |
category:'System-Debugging-Support' |
8 | 21 |
! |
22 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
23 |
!MessageTracer class methodsFor:'documentation'! |
8 | 24 |
|
9 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
11 | 28 |
All Rights Reserved |
9 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
8 | 39 |
documentation |
40 |
" |
|
11 | 41 |
This class provides a common home for the tracing |
42 |
facilities (originally, they where in Object, but have been moved to |
|
8 | 43 |
allow easier separation of development vs. runtime configurations. |
44 |
||
11 | 45 |
tracing execution of a block: |
46 |
||
236 | 47 |
MessageTracer trace:[ ... ] |
11 | 48 |
|
236 | 49 |
MessageTracer traceFull:[ ... ] |
11 | 50 |
|
236 | 51 |
(for system developper only:) |
11 | 52 |
|
236 | 53 |
MessageTracer debugTrace:[ ... ] |
11 | 54 |
|
55 |
||
8 | 56 |
trapping sends to a specific object: |
57 |
||
236 | 58 |
MessageTracer trap:anObject selector:aSelector |
59 |
... |
|
60 |
MessageTracer untrap:anObject selector:aSelector |
|
61 |
or: |
|
62 |
MessageTracer untrap:anObject |
|
11 | 63 |
|
8 | 64 |
|
65 |
||
27 | 66 |
trapping some messages sent to a specific object: |
67 |
||
236 | 68 |
MessageTracer trap:anObject selectors:aCollectionOfSelectors |
69 |
... |
|
70 |
MessageTracer untrap:anObject |
|
27 | 71 |
|
72 |
||
73 |
||
74 |
trapping any message sent to a specific object: |
|
75 |
||
236 | 76 |
MessageTracer trapAll:anObject |
77 |
... |
|
78 |
MessageTracer untrap:anObject |
|
27 | 79 |
|
80 |
||
81 |
||
8 | 82 |
trapping evaluation of a specific method: |
83 |
||
236 | 84 |
MessageTracer trapMethod:aMethod |
85 |
... |
|
86 |
MessageTracer unwrapMethod:aMethod |
|
8 | 87 |
|
88 |
||
89 |
||
12 | 90 |
trapping evaluation of a specific method with |
91 |
receiver being an instance of some class: |
|
92 |
||
236 | 93 |
MessageTracer trapMethod:aMethod forInstancesOf:aClass |
94 |
... |
|
95 |
MessageTracer unwrapMethod:aMethod |
|
12 | 96 |
|
97 |
||
98 |
||
8 | 99 |
tracing sends to a specific object: |
100 |
||
236 | 101 |
MessageTracer trace:anObject selector:aSelector |
102 |
... |
|
103 |
MessageTracer untrace:anObject selector:aSelector |
|
104 |
or: |
|
105 |
MessageTracer untrace:anObject |
|
11 | 106 |
|
8 | 107 |
|
108 |
||
109 |
tracing sender only: |
|
110 |
||
236 | 111 |
MessageTracer traceSender:anObject selector:aSelector |
112 |
... |
|
113 |
MessageTracer untrace:anObject selector:aSelector |
|
114 |
or: |
|
115 |
MessageTracer untrace:anObject |
|
11 | 116 |
|
8 | 117 |
|
118 |
||
119 |
tracing evaluation of a specific method: |
|
120 |
||
236 | 121 |
MessageTracer traceMethod:aMethod |
122 |
... |
|
123 |
MessageTracer unwrapmethod:aMethod |
|
18 | 124 |
|
125 |
see more in examples and in method comments. |
|
236 | 126 |
|
127 |
[author:] |
|
128 |
Claus Gittinger |
|
8 | 129 |
" |
12 | 130 |
! |
131 |
||
132 |
examples |
|
133 |
" |
|
134 |
For the common cases, you will find a menu entry in the SystemBrowser. |
|
135 |
Howeever, more special cases (especially with condition checks) can be |
|
136 |
set up by evaluating the lower level entries. |
|
137 |
||
138 |
||
139 |
trapping specific methods: |
|
140 |
(by class/selector): |
|
244 | 141 |
[exBegin] |
12 | 142 |
MessageTracer trapClass:Collection selector:#select:. |
591 | 143 |
Dictionary new select:[:e | ]. 'not caught - Dictionary has its own select'. |
144 |
(Array new:10) select:[:e | ]. 'not caught - SeqColl has its own select'. |
|
145 |
Set new select:[:e | ]. 'caught - Set inherits this from Collection'. |
|
12 | 146 |
MessageTracer untrapClass:Collection |
244 | 147 |
[exEnd] |
12 | 148 |
|
149 |
(by method): |
|
244 | 150 |
[exBegin] |
12 | 151 |
MessageTracer trapMethod:(Collection compiledMethodAt:#select:). |
591 | 152 |
Dictionary new select:[:e | ]. 'not caught - Dictionary has its own select'. |
153 |
(Array new:10) select:[:e | ]. 'not caught - SeqColl has its own select'. |
|
154 |
Set new select:[:e | ]. 'caught - Set inherits this from Collection'. |
|
12 | 155 |
MessageTracer unwrapMethod:(Collection compiledMethodAt:#select:). |
244 | 156 |
[exEnd] |
12 | 157 |
|
27 | 158 |
(by method & instance class): |
244 | 159 |
[exBegin] |
27 | 160 |
MessageTracer trapMethod:(SequenceableCollection compiledMethodAt:#select:) |
244 | 161 |
forInstancesOf:SortedCollection. |
591 | 162 |
Dictionary new select:[:e | ]. 'not caught - Dictionary has its own select'. |
163 |
(Array new:10) select:[:e | ]. 'not caught - not a SortedCollection'. |
|
164 |
OrderedCollection new select:[:e | ]. 'not caught - not a SortedCollection'. |
|
165 |
SortedCollection new select:[:e | ]. 'caught - Set inherits this from Collection'. |
|
27 | 166 |
MessageTracer unwrapMethod:(SequenceableCollection compiledMethodAt:#select:). |
244 | 167 |
[exEnd] |
27 | 168 |
|
12 | 169 |
tracing specific methods: |
170 |
(by class/selector): |
|
244 | 171 |
[exBegin] |
12 | 172 |
MessageTracer traceClass:SequenceableCollection selector:#quickSortFrom:to:. |
173 |
#(6 1 9 66 2 17) copy sort. |
|
174 |
MessageTracer untraceClass:SequenceableCollection |
|
244 | 175 |
[exEnd] |
12 | 176 |
|
177 |
(by method): |
|
244 | 178 |
[exBegin] |
12 | 179 |
MessageTracer traceMethod:(SequenceableCollection compiledMethodAt:#quickSortFrom:to:). |
180 |
#(6 1 9 66 2 17) copy sort. |
|
181 |
MessageTracer unwrapMethod:(SequenceableCollection compiledMethodAt:#quickSortFrom:to:). |
|
244 | 182 |
[exEnd] |
27 | 183 |
|
184 |
object trapping: |
|
244 | 185 |
[exBegin] |
27 | 186 |
|o| |
187 |
||
188 |
o := OrderedCollection new. |
|
189 |
MessageTracer trapAll:o. |
|
190 |
o collect:[:el | el]. |
|
244 | 191 |
[exEnd] |
661 | 192 |
|
193 |
trapping modifications to an objects instVars: |
|
194 |
[exBegin] |
|
195 |
|o| |
|
196 |
||
197 |
o := Point new. |
|
198 |
MessageTracer trapModificationsIn:o. |
|
199 |
o x:1. |
|
200 |
o y:2. |
|
201 |
o x:1. |
|
202 |
o y:2. |
|
203 |
MessageTracer untrap:o |
|
204 |
[exEnd] |
|
205 |
||
206 |
trapping modifications of a particular instVar: |
|
207 |
[exBegin] |
|
208 |
|o| |
|
209 |
||
210 |
o := Point new. |
|
211 |
MessageTracer trapModificationsIn:o filter:[:old :new | old x ~~ new x]. |
|
212 |
o x:1. |
|
213 |
o y:2. |
|
214 |
o x:1. |
|
215 |
o y:2. |
|
216 |
MessageTracer untrap:o |
|
217 |
[exEnd] |
|
12 | 218 |
" |
8 | 219 |
! ! |
220 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
221 |
!MessageTracer class methodsFor:'initialization'! |
11 | 222 |
|
223 |
initialize |
|
224 |
BreakpointSignal isNil ifTrue:[ |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
225 |
BreakpointSignal := HaltSignal newSignalMayProceed:true. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
226 |
BreakpointSignal nameClass:self message:#breakpointSignal. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
227 |
BreakpointSignal notifierString:'breakpoint encountered'. |
27 | 228 |
|
660 | 229 |
ObjectWrittenBreakpointSignal := BreakpointSignal newSignalMayProceed:true. |
230 |
ObjectWrittenBreakpointSignal nameClass:self message:#objectWrittenBreakpointSignal. |
|
231 |
ObjectWrittenBreakpointSignal notifierString:'object modified'. |
|
232 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
233 |
BreakBlock := [:con | BreakpointSignal raiseIn:con]. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
234 |
TraceSenderBlock := [:con | MessageTracer printEntrySender:con]. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
235 |
TraceFullBlock := [:con | con fullPrintAll]. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
236 |
LeaveBreakBlock := [:con :retVal | ]. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
237 |
LeaveTraceBlock := [:con :retVal | ]. |
11 | 238 |
] |
156 | 239 |
|
240 |
" |
|
241 |
BreakpointSignal := nil. |
|
242 |
MessageTracer initialize |
|
243 |
" |
|
244 |
||
660 | 245 |
"Modified: / 21.4.1998 / 14:38:35 / cg" |
11 | 246 |
! ! |
247 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
248 |
!MessageTracer class methodsFor:'Signal constants'! |
88 | 249 |
|
250 |
breakpointSignal |
|
251 |
^ BreakpointSignal |
|
660 | 252 |
! |
253 |
||
254 |
objectWrittenBreakpointSignal |
|
255 |
^ ObjectWrittenBreakpointSignal |
|
256 |
||
257 |
"Created: / 21.4.1998 / 14:38:49 / cg" |
|
88 | 258 |
! ! |
259 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
260 |
!MessageTracer class methodsFor:'class tracing'! |
88 | 261 |
|
262 |
traceClass:aClass selector:aSelector |
|
263 |
"arrange for a trace message to be output on Stderr, when a message with aSelector is |
|
264 |
sent to instances of aClass (or subclass instances). Use untraceClass to remove this." |
|
265 |
||
266 |
self traceMethod:(aClass compiledMethodAt:aSelector) |
|
267 |
||
268 |
" |
|
269 |
MessageTracer traceClass:Integer selector:#factorial. |
|
270 |
5 factorial. |
|
271 |
MessageTracer untraceClass:Integer |
|
272 |
" |
|
273 |
" |
|
274 |
MessageTracer traceClass:SequenceableCollection selector:#quickSortFrom:to:. |
|
275 |
#(6 1 9 66 2 17) copy sort. |
|
276 |
MessageTracer untraceClass:SequenceableCollection |
|
277 |
" |
|
278 |
" |
|
279 |
MessageTracer traceClass:Array selector:#at:. |
|
280 |
MessageTracer traceClass:Array selector:#at:put:. |
|
281 |
#(6 1 9 66 2 17) copy sort. |
|
282 |
MessageTracer untraceClass:Array |
|
283 |
" |
|
284 |
! |
|
285 |
||
286 |
untraceAllClasses |
|
287 |
"remove all traces of messages sent to any class" |
|
288 |
||
289 |
"just a rename for your convenience - the same basic mechanism is used for all of these |
|
290 |
trace facilities ..." |
|
291 |
||
292 |
^ self untrapAllClasses |
|
293 |
! |
|
294 |
||
295 |
untraceClass:aClass |
|
296 |
"remove all traces of messages sent to instances of aClass" |
|
297 |
||
298 |
"just a rename for your convenience - the same basic mechanism is used for all of these |
|
299 |
trace facilities ..." |
|
300 |
||
301 |
^ self untrapClass:aClass |
|
302 |
! ! |
|
303 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
304 |
!MessageTracer class methodsFor:'class wrapping'! |
88 | 305 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
306 |
wrapClass:orgClass selector:aSelector onEntry:entryBlock onExit:exitBlock |
88 | 307 |
"arrange for the two blocks entryBlock and exitBlock to be evaluated whenever |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
308 |
aSelector is sent to instances of orgClass or subclasses. |
88 | 309 |
EntryBlock will be called on entry, and get the current context passed as argument. |
310 |
ExitBlock will be called, when the method is left, and get context and the methods return value as arguments. |
|
311 |
" |
|
312 |
||
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
313 |
|myMetaclass trapMethod s spec implClass newClass save dict| |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
314 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
315 |
WrappedMethod autoload. "/ just to make sure ... |
88 | 316 |
|
317 |
" |
|
318 |
create a new method, which calls the original one, |
|
319 |
but only if not already being trapped. |
|
320 |
" |
|
321 |
spec := Parser methodSpecificationForSelector:aSelector. |
|
322 |
||
323 |
s := WriteStream on:String new. |
|
324 |
s nextPutAll:spec. |
|
325 |
s cr. |
|
326 |
s nextPutAll:'|retVal stubClass|'; cr. |
|
327 |
entryBlock notNil ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
328 |
s nextPutAll:'#literal1 yourself value:thisContext.'; cr. |
88 | 329 |
]. |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
330 |
s nextPutAll:('retVal := #originalMethod. '). "/ just to get a literal to be replaced by theoriginal method |
88 | 331 |
s nextPutAll:('retVal := super ' , spec , '.'); cr. |
332 |
exitBlock notNil ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
333 |
s nextPutAll:'#literal2 yourself value:thisContext value:retVal.'; cr. |
88 | 334 |
]. |
335 |
s nextPutAll:'^ retVal'; cr. |
|
336 |
||
337 |
save := Compiler stcCompilation. |
|
338 |
Compiler stcCompilation:#never. |
|
339 |
[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
340 |
Class withoutUpdatingChangesDo:[ |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
341 |
trapMethod := Compiler compile:s contents |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
342 |
forClass:orgClass |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
343 |
inCategory:'trapping' |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
344 |
notifying:nil |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
345 |
install:false |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
346 |
skipIfSame:false |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
347 |
silent:true. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
348 |
] |
88 | 349 |
] valueNowOrOnUnwindDo:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
350 |
Compiler stcCompilation:save |
88 | 351 |
]. |
352 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
353 |
implClass := orgClass whichClassIncludesSelector:aSelector. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
354 |
implClass isNil ifTrue:[ |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
355 |
Transcript showCR:aSelector , ' is not understood by ' , orgClass name. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
356 |
] ifFalse:[ |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
357 |
trapMethod changeLiteral:#originalMethod to:(implClass compiledMethodAt:aSelector). |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
358 |
]. |
88 | 359 |
entryBlock notNil ifTrue:[ |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
360 |
trapMethod changeLiteral:#literal1 to:entryBlock. |
88 | 361 |
]. |
362 |
exitBlock notNil ifTrue:[ |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
363 |
trapMethod changeLiteral:#literal2 to:exitBlock. |
88 | 364 |
]. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
365 |
|
88 | 366 |
" |
367 |
change the source of this new method |
|
368 |
(to avoid confusion in the debugger ...) |
|
369 |
" |
|
370 |
trapMethod source:'this is a wrapper method - not the real one'. |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
371 |
trapMethod changeClassTo:WrappedMethod. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
372 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
373 |
dict := orgClass methodDictionary. |
88 | 374 |
|
375 |
" |
|
376 |
if not already trapping, create a new class |
|
377 |
" |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
378 |
orgClass category == #'* trapping *' ifTrue:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
379 |
dict at:aSelector put:trapMethod. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
380 |
orgClass methodDictionary:dict. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
381 |
newClass := orgClass superclass. |
88 | 382 |
] ifFalse:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
383 |
myMetaclass := orgClass class. |
88 | 384 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
385 |
newClass := myMetaclass copy new. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
386 |
newClass setSuperclass:orgClass superclass. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
387 |
newClass instSize:orgClass instSize. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
388 |
newClass flags:orgClass flags. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
389 |
newClass setClassVariableString:orgClass classVariableString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
390 |
newClass setInstanceVariableString:orgClass instanceVariableString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
391 |
newClass setName:orgClass name. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
392 |
newClass category:orgClass category. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
393 |
newClass methodDictionary:dict. |
88 | 394 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
395 |
orgClass setSuperclass:newClass. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
396 |
orgClass setClassVariableString:''. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
397 |
orgClass setInstanceVariableString:''. |
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
398 |
orgClass category:#'* trapping *'. |
88 | 399 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
400 |
dict := MethodDictionary new:1. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
401 |
dict at:aSelector put:trapMethod. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
402 |
orgClass methodDictionary:dict. |
88 | 403 |
]. |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
404 |
trapMethod changeLiteral:(newClass superclass) to:newClass. |
88 | 405 |
|
406 |
ObjectMemory flushCaches. |
|
407 |
||
408 |
" |
|
409 |
MessageTracer |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
410 |
wrapClass:Point |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
411 |
selector:#scaleBy: |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
412 |
onEntry:nil |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
413 |
onExit:[:con :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
414 |
Transcript show:'leave Point>>scaleBy:; returning:'. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
415 |
Transcript showCR:retVal printString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
416 |
Transcript endEntry |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
417 |
]. |
88 | 418 |
(1@2) scaleBy:5. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
419 |
MessageTracer untrapClass:Point selector:#scaleBy:. |
88 | 420 |
(1@2) scaleBy:5. |
421 |
" |
|
422 |
" |
|
423 |
MessageTracer |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
424 |
wrapClass:Integer |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
425 |
selector:#factorial |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
426 |
onEntry:[:con | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
427 |
Transcript showCR:('entering ' , con receiver printString , '>>factorial'). |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
428 |
] |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
429 |
onExit:[:con :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
430 |
Transcript show:'leave Integer>>factorial; returning:'. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
431 |
Transcript showCR:retVal printString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
432 |
Transcript endEntry |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
433 |
]. |
258 | 434 |
Transcript showCR:'5 factorial traced'. |
88 | 435 |
5 factorial. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
436 |
MessageTracer untrapClass:Integer selector:#factorial. |
258 | 437 |
Transcript showCR:'5 factorial normal'. |
88 | 438 |
5 factorial. |
439 |
" |
|
440 |
" |
|
441 |
|lvl| |
|
442 |
||
443 |
lvl := 0. |
|
444 |
MessageTracer |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
445 |
wrapClass:Integer |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
446 |
selector:#factorial |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
447 |
onEntry:[:con | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
448 |
Transcript spaces:lvl. lvl := lvl + 2. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
449 |
Transcript showCR:('entering ' , con receiver printString , '>>factorial'). |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
450 |
] |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
451 |
onExit:[:con :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
452 |
lvl := lvl - 2. Transcript spaces:lvl. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
453 |
Transcript show:('leave ' , con receiver printString , '>>factorial; returning:'). |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
454 |
Transcript showCR:retVal printString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
455 |
Transcript endEntry |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
456 |
]. |
258 | 457 |
Transcript showCR:'5 factorial traced'. |
88 | 458 |
5 factorial. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
459 |
MessageTracer untrapClass:Integer selector:#factorial. |
258 | 460 |
Transcript showCR:'5 factorial normal'. |
88 | 461 |
5 factorial. |
462 |
" |
|
150
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
463 |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
464 |
"Modified: 25.6.1996 / 22:01:05 / stefan" |
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
465 |
"Modified: 10.9.1996 / 20:07:01 / cg" |
88 | 466 |
! ! |
467 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
468 |
!MessageTracer class methodsFor:'cleanup'! |
27 | 469 |
|
470 |
cleanup |
|
471 |
"if you forgot which classes/methods where wrapped and/or trapped, |
|
472 |
this cleans up everything ..." |
|
473 |
||
474 |
self untrapAllClasses. |
|
475 |
self unwrapAllMethods |
|
476 |
||
477 |
" |
|
478 |
MessageTracer cleanup |
|
479 |
" |
|
480 |
! ! |
|
481 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
482 |
!MessageTracer class methodsFor:'execution trace '! |
88 | 483 |
|
484 |
debugTrace:aBlock |
|
485 |
"trace execution of aBlock. This is for system debugging only" |
|
11 | 486 |
|
196
330cc5c849de
debugOn/Off is now called sendTraceOn/Off
Claus Gittinger <cg@exept.de>
parents:
172
diff
changeset
|
487 |
Smalltalk sendTraceOn. |
88 | 488 |
^ aBlock valueNowOrOnUnwindDo:[ |
196
330cc5c849de
debugOn/Off is now called sendTraceOn/Off
Claus Gittinger <cg@exept.de>
parents:
172
diff
changeset
|
489 |
Smalltalk sendTraceOff. |
88 | 490 |
] |
11 | 491 |
|
88 | 492 |
" |
493 |
MessageTracer debugTrace:[#(6 5 4 3 2 1) sort] |
|
494 |
" |
|
196
330cc5c849de
debugOn/Off is now called sendTraceOn/Off
Claus Gittinger <cg@exept.de>
parents:
172
diff
changeset
|
495 |
|
330cc5c849de
debugOn/Off is now called sendTraceOn/Off
Claus Gittinger <cg@exept.de>
parents:
172
diff
changeset
|
496 |
"Modified: 18.3.1996 / 19:49:36 / cg" |
88 | 497 |
! |
11 | 498 |
|
499 |
trace:aBlock |
|
500 |
"evaluate aBlock sending trace information to stdout. |
|
27 | 501 |
Return the value of the block." |
11 | 502 |
|
17 | 503 |
^ self new trace:aBlock detail:false. |
11 | 504 |
|
505 |
" |
|
506 |
MessageTracer trace:[#(6 5 4 3 2 1) sort] |
|
507 |
" |
|
508 |
! |
|
509 |
||
510 |
traceFull:aBlock |
|
511 |
"evaluate aBlock sending trace information to stdout. |
|
512 |
Return the value of the block. |
|
27 | 513 |
The trace information is more detailed." |
11 | 514 |
|
17 | 515 |
^ self new trace:aBlock detail:true. |
11 | 516 |
|
517 |
" |
|
518 |
MessageTracer traceFull:[#(6 5 4 3 2 1) sort] |
|
519 |
" |
|
88 | 520 |
! ! |
521 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
522 |
!MessageTracer class methodsFor:'method breakpointing'! |
88 | 523 |
|
524 |
trapClass:aClass selector:aSelector |
|
525 |
"arrange for the debugger to be entered when a message with aSelector is |
|
526 |
sent to instances of aClass (or subclass instances). Use untrapClass to remove this trap. |
|
527 |
Be careful, to not place a trap on code needed in the debugger (i.e. on scrollBars etc.); |
|
528 |
if there is a need to trap those, use the low-level wrap-methods, and put a check into the |
|
529 |
entry/leave blocks." |
|
530 |
||
531 |
self trapMethod:(aClass compiledMethodAt:aSelector) |
|
532 |
||
533 |
" |
|
534 |
MessageTracer trapClass:Collection selector:#select:. |
|
591 | 535 |
Dictionary new select:[:e | ]. 'not caught - Dictionary has its own select'. |
536 |
(Array new:10) select:[:e | ]. 'not caught - SeqColl has its own select'. |
|
537 |
Set new select:[:e | ]. 'caught - Set inherits this from Collection'. |
|
88 | 538 |
MessageTracer untrapClass:Collection |
539 |
" |
|
11 | 540 |
! |
541 |
||
88 | 542 |
trapMethod:aMethod |
543 |
"arrange for the debugger to be entered when aMethod is about to be executed. |
|
495 | 544 |
The trap is enabled for any process - see #trapMethodInCurrentProcess: for a more |
545 |
selective breakPoint. |
|
88 | 546 |
Use unwrapMethod or untrapClass to remove this trap. |
547 |
Be careful, to not place a trap on code needed in the debugger (i.e. on scrollBars etc.); |
|
548 |
if there is a need to trap those, use the low-level wrap-methods, and put a check into the |
|
549 |
entry/leave blocks." |
|
550 |
||
551 |
^ self wrapMethod:aMethod |
|
495 | 552 |
onEntry:BreakBlock |
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
553 |
onExit:LeaveBreakBlock. |
88 | 554 |
|
555 |
" |
|
556 |
MessageTracer trapMethod:(Collection compiledMethodAt:#select:). |
|
591 | 557 |
Dictionary new select:[:e | ]. 'not caught - Dictionary has its own select'. |
558 |
(Array new:10) select:[:e | ]. 'not caught - SeqColl has its own select'. |
|
559 |
Set new select:[:e | ]. 'caught - Set inherits this from Collection'. |
|
88 | 560 |
MessageTracer unwrapMethod:(Collection compiledMethodAt:#select:). |
561 |
" |
|
495 | 562 |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
563 |
"Modified: 22.10.1996 / 17:39:58 / cg" |
88 | 564 |
! |
11 | 565 |
|
88 | 566 |
trapMethod:aMethod forInstancesOf:aClass |
567 |
"arrange for the debugger to be entered when aMethod is about to be executed |
|
568 |
for an instance of aClass. |
|
569 |
Use unwrapMethod or untrapClass to remove this trap. |
|
570 |
Be careful, to not place a trap on code needed in the debugger (i.e. on scrollBars etc.); |
|
571 |
if there is a need to trap those, use the low-level wrap-methods, and put a check into the |
|
572 |
entry/leave blocks." |
|
573 |
||
574 |
^ self wrapMethod:aMethod |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
575 |
onEntry:[:context | |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
576 |
(context receiver isMemberOf:aClass) ifTrue:[ |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
577 |
BreakpointSignal raiseIn:context |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
578 |
] |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
579 |
] |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
580 |
onExit:LeaveBreakBlock. |
88 | 581 |
|
582 |
" |
|
583 |
MessageTracer trapMethod:(View compiledMethodAt:#redraw) forInstancesOf:myView. |
|
584 |
" |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
585 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
586 |
"Modified: 22.10.1996 / 17:40:03 / cg" |
88 | 587 |
! |
588 |
||
496 | 589 |
trapMethod:aMethod inProcess:aProcess |
495 | 590 |
"arrange for the debugger to be entered when aMethod is about to be executed, |
591 |
but only, if executed in the current process. |
|
592 |
This allows for breakpoints to be set on system-critical code. |
|
593 |
The trap is enabled for any process. |
|
594 |
Use unwrapMethod or untrapClass to remove this trap. |
|
595 |
Be careful, to not place a trap on code needed in the debugger (i.e. on scrollBars etc.); |
|
596 |
if there is a need to trap those, use the low-level wrap-methods, and put a check into the |
|
597 |
entry/leave blocks." |
|
598 |
||
599 |
^ self wrapMethod:aMethod |
|
496 | 600 |
onEntry:[:con | (Processor activeProcess == aProcess) |
495 | 601 |
ifTrue:[ |
602 |
BreakpointSignal raiseIn:con |
|
603 |
] |
|
604 |
] |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
605 |
onExit:LeaveBreakBlock. |
495 | 606 |
|
496 | 607 |
"Created: 14.10.1996 / 15:38:46 / cg" |
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
608 |
"Modified: 22.10.1996 / 17:40:06 / cg" |
495 | 609 |
! |
610 |
||
88 | 611 |
untrapAllClasses |
612 |
"remove any traps on any class" |
|
613 |
||
614 |
Smalltalk allBehaviorsDo:[:aClass | |
|
615 |
self untrapClass:aClass |
|
11 | 616 |
] |
617 |
||
618 |
" |
|
88 | 619 |
MessageTracer untrapAllClasses |
620 |
" |
|
621 |
! |
|
622 |
||
623 |
untrapClass:aClass |
|
624 |
"remove any traps on aClass" |
|
625 |
||
626 |
"this is done by just patching the class back to the original" |
|
627 |
||
628 |
|orgClass| |
|
629 |
||
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
630 |
aClass category == #'* trapping *' ifFalse:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
631 |
^ self |
88 | 632 |
]. |
633 |
orgClass := aClass superclass. |
|
634 |
||
635 |
aClass setSuperclass:orgClass superclass. |
|
636 |
aClass setClassVariableString:orgClass classVariableString. |
|
637 |
aClass setInstanceVariableString:orgClass instanceVariableString. |
|
638 |
aClass category:orgClass category. |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
639 |
aClass methodDictionary:orgClass methodDictionary. |
88 | 640 |
|
641 |
ObjectMemory flushCaches. |
|
642 |
||
643 |
" |
|
644 |
MessageTracer untrapClass:Point |
|
11 | 645 |
" |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
646 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
647 |
"Modified: 5.6.1996 / 13:57:39 / stefan" |
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
648 |
"Modified: 10.9.1996 / 20:06:23 / cg" |
88 | 649 |
! |
650 |
||
651 |
untrapClass:aClass selector:aSelector |
|
652 |
"remove trap of aSelector sent to aClass" |
|
653 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
654 |
|dict| |
88 | 655 |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
656 |
aClass category == #'* trapping *' ifFalse:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
657 |
^ self |
88 | 658 |
]. |
659 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
660 |
dict := aClass methodDictionary. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
661 |
dict at:aSelector ifAbsent:[^ self]. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
662 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
663 |
ObjectMemory flushCaches. "avoid calling the old trap method" |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
664 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
665 |
dict size == 1 ifTrue:[ |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
666 |
"the last trapped method" |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
667 |
^ self untrapClass:aClass |
88 | 668 |
]. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
669 |
dict removeKey:aSelector. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
670 |
aClass methodDictionary:dict. |
88 | 671 |
|
672 |
" |
|
673 |
MessageTracer trapClass:Point selector:#copy. |
|
674 |
(1@2) copy. |
|
675 |
(1@2) deepCopy. |
|
676 |
MessageTracer trapClass:Point selector:#deepCopy. |
|
677 |
(1@2) copy. |
|
678 |
(1@2) deepCopy. |
|
679 |
MessageTracer untrapClass:Point selector:#copy. |
|
680 |
(1@2) copy. |
|
681 |
(1@2) deepCopy. |
|
682 |
MessageTracer untrapClass:Point selector:#deepCopy. |
|
683 |
(1@2) copy. |
|
684 |
(1@2) deepCopy. |
|
685 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
686 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
687 |
"Modified: 5.6.1996 / 14:00:55 / stefan" |
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
688 |
"Modified: 10.9.1996 / 20:06:29 / cg" |
88 | 689 |
! |
690 |
||
691 |
untrapMethod:aMethod |
|
692 |
"remove break on aMethod" |
|
693 |
||
694 |
"just a rename for your convenience - the same basic mechanism is used for all of these |
|
695 |
trace facilities ..." |
|
696 |
||
697 |
^ self unwrapMethod:aMethod |
|
11 | 698 |
! ! |
699 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
700 |
!MessageTracer class methodsFor:'method counting'! |
155 | 701 |
|
702 |
countMethod:aMethod |
|
703 |
"arrange for a aMethods execution to be counted. |
|
704 |
Use unwrapMethod to remove this." |
|
705 |
||
706 |
MethodCounts isNil ifTrue:[ |
|
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
707 |
MethodCounts := IdentityDictionary new. |
155 | 708 |
]. |
709 |
MethodCounts at:aMethod put:0. |
|
710 |
||
711 |
^ self wrapMethod:aMethod |
|
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
712 |
onEntry:[:con | |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
713 |
|cnt| |
155 | 714 |
|
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
715 |
cnt := MethodCounts at:aMethod ifAbsent:0. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
716 |
MethodCounts at:aMethod put:(cnt + 1). |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
717 |
] |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
718 |
onExit:[:con :retVal | |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
719 |
] |
155 | 720 |
|
721 |
" |
|
722 |
MessageTracer countMethod:(Integer compiledMethodAt:#factorial). |
|
723 |
5 factorial. |
|
724 |
MessageTracer executionCountOf:(Integer compiledMethodAt:#factorial) printNL. |
|
725 |
MessageTracer stopCountingMethod:(Integer compiledMethodAt:#factorial) |
|
726 |
" |
|
727 |
||
728 |
"Created: 15.12.1995 / 10:57:49 / cg" |
|
729 |
"Modified: 15.12.1995 / 15:46:41 / cg" |
|
730 |
! |
|
731 |
||
732 |
executionCountOfMethod:aMethod |
|
733 |
"return the current count" |
|
734 |
||
735 |
|count| |
|
736 |
||
737 |
MethodCounts isNil ifTrue:[^ 0]. |
|
738 |
aMethod isWrapped ifTrue:[ |
|
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
739 |
count := MethodCounts at:aMethod originalMethod ifAbsent:nil. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
740 |
count notNil ifTrue:[^ count]. |
155 | 741 |
]. |
742 |
^ MethodCounts at:aMethod ifAbsent:0 |
|
743 |
||
744 |
"Created: 15.12.1995 / 11:01:56 / cg" |
|
745 |
"Modified: 15.12.1995 / 15:45:15 / cg" |
|
746 |
! |
|
747 |
||
748 |
stopCountingMethod:aMethod |
|
749 |
"remove counting of aMethod" |
|
750 |
||
751 |
^ self unwrapMethod:aMethod |
|
752 |
||
753 |
"Modified: 15.12.1995 / 15:43:53 / cg" |
|
754 |
! ! |
|
755 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
756 |
!MessageTracer class methodsFor:'method memory usage'! |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
757 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
758 |
countMemoryUsageOfMethod:aMethod |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
759 |
"arrange for aMethods memory usage to be counted. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
760 |
Use unwrapMethod to remove this." |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
761 |
|
501 | 762 |
|oldPriority oldScavengeCount oldNewUsed| |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
763 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
764 |
MethodCounts isNil ifTrue:[ |
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
765 |
MethodCounts := IdentityDictionary new. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
766 |
]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
767 |
MethodMemoryUsage isNil ifTrue:[ |
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
768 |
MethodMemoryUsage := IdentityDictionary new. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
769 |
]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
770 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
771 |
MethodCounts at:aMethod put:0. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
772 |
MethodMemoryUsage at:aMethod put:0. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
773 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
774 |
^ self wrapMethod:aMethod |
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
775 |
onEntry:[:con | |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
776 |
oldPriority := Processor activeProcess changePriority:(Processor userInterruptPriority). |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
777 |
oldNewUsed := ObjectMemory newSpaceUsed. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
778 |
oldScavengeCount := ObjectMemory scavengeCount. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
779 |
] |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
780 |
onExit:[:con :retVal | |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
781 |
|cnt memUse scavenges| |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
782 |
|
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
783 |
memUse := ObjectMemory newSpaceUsed - oldNewUsed. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
784 |
scavenges := ObjectMemory scavengeCount - oldScavengeCount. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
785 |
scavenges ~= 0 ifTrue:[ |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
786 |
memUse := memUse + (ObjectMemory newSpaceSize * scavenges) |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
787 |
]. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
788 |
|
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
789 |
MethodCounts notNil ifTrue:[ |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
790 |
cnt := MethodCounts at:aMethod ifAbsent:0. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
791 |
MethodCounts at:aMethod put:(cnt + 1). |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
792 |
]. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
793 |
MethodMemoryUsage notNil ifTrue:[ |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
794 |
cnt := MethodMemoryUsage at:aMethod ifAbsent:0. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
795 |
MethodMemoryUsage at:aMethod put:(cnt + memUse). |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
796 |
]. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
797 |
Processor activeProcess priority:oldPriority |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
798 |
] |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
799 |
onUnwind:[ |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
800 |
oldPriority notNil ifTrue:[ |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
801 |
Processor activeProcess priority:oldPriority |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
802 |
] |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
803 |
] |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
804 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
805 |
" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
806 |
MessageTracer countMemoryUsageOfMethod:(Integer compiledMethodAt:#factorial). |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
807 |
3 factorial. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
808 |
(MessageTracer memoryUsageOfMethod:(Integer compiledMethodAt:#factorial)) printNL. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
809 |
MessageTracer stopCountingMemoryUsageOfMethod:(Integer compiledMethodAt:#factorial) |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
810 |
" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
811 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
812 |
"Created: 18.12.1995 / 15:41:27 / stefan" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
813 |
"Modified: 18.12.1995 / 21:46:48 / stefan" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
814 |
! |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
815 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
816 |
isCountingMemoryUsage:aMethod |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
817 |
"return true if aMethod is counting memoryUsage" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
818 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
819 |
MethodMemoryUsage isNil ifTrue:[^ false]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
820 |
(MethodMemoryUsage includesKey:aMethod) ifTrue:[^ true]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
821 |
aMethod isWrapped ifTrue:[ |
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
822 |
^ MethodMemoryUsage includesKey:aMethod originalMethod |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
823 |
]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
824 |
^ false |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
825 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
826 |
"Created: 18.12.1995 / 15:51:49 / stefan" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
827 |
! |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
828 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
829 |
memoryUsageOfMethod:aMethod |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
830 |
"return the current count" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
831 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
832 |
|count memUse| |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
833 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
834 |
(MethodCounts isNil or:[MethodMemoryUsage isNil]) ifTrue:[^ 0]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
835 |
aMethod isWrapped ifTrue:[ |
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
836 |
count := MethodCounts at:aMethod originalMethod ifAbsent:nil. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
837 |
memUse := MethodMemoryUsage at:aMethod originalMethod ifAbsent:nil. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
838 |
]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
839 |
memUse isNil ifTrue:[ |
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
840 |
count := MethodCounts at:aMethod ifAbsent:0. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
841 |
memUse := MethodMemoryUsage at:aMethod ifAbsent:0. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
842 |
]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
843 |
count = 0 ifTrue:[^ 0]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
844 |
^ memUse//count |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
845 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
846 |
"Modified: 18.12.1995 / 16:25:51 / stefan" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
847 |
! |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
848 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
849 |
stopCountingMemoryUsageOfMethod:aMethod |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
850 |
"remove counting memory of aMethod" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
851 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
852 |
^ self unwrapMethod:aMethod |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
853 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
854 |
"Modified: 18.12.1995 / 21:54:36 / stefan" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
855 |
! ! |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
856 |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
857 |
!MessageTracer class methodsFor:'method timing'! |
327 | 858 |
|
859 |
executionTimesOfMethod:aMethod |
|
860 |
"return the current times" |
|
861 |
||
862 |
|count info min max avg ret| |
|
863 |
||
864 |
count := min := max := avg := 0. |
|
865 |
MethodTiming notNil ifTrue:[ |
|
866 |
aMethod isWrapped ifTrue:[ |
|
867 |
info := MethodTiming at:aMethod originalMethod ifAbsent:nil. |
|
868 |
info notNil ifTrue:[ |
|
869 |
count := info at:1. |
|
579 | 870 |
count ~~ 0 ifTrue:[ |
871 |
min := info at:2. |
|
872 |
max := info at:3. |
|
873 |
avg := ((info at:4) / count) roundTo:0.01 |
|
874 |
] |
|
327 | 875 |
]. |
876 |
]. |
|
877 |
]. |
|
878 |
||
879 |
ret := IdentityDictionary new. |
|
880 |
ret at:#count put:count. |
|
881 |
ret at:#minTime put:min. |
|
882 |
ret at:#maxTime put:max. |
|
883 |
ret at:#avgTime put:avg. |
|
884 |
^ ret |
|
885 |
||
886 |
"Created: 17.6.1996 / 17:07:30 / cg" |
|
579 | 887 |
"Modified: 11.4.1997 / 17:16:11 / cg" |
327 | 888 |
! |
889 |
||
890 |
stopTimingMethod:aMethod |
|
891 |
"remove timing of aMethod" |
|
892 |
||
893 |
^ self unwrapMethod:aMethod |
|
894 |
||
895 |
"Modified: 15.12.1995 / 15:43:53 / cg" |
|
896 |
"Created: 17.6.1996 / 17:04:03 / cg" |
|
897 |
! |
|
898 |
||
899 |
timeMethod:aMethod |
|
900 |
"arrange for a aMethods execution time to be measured. |
|
901 |
Use unwrapMethod to remove this." |
|
902 |
||
501 | 903 |
|t0| |
327 | 904 |
|
905 |
MethodTiming isNil ifTrue:[ |
|
906 |
MethodTiming := IdentityDictionary new. |
|
907 |
]. |
|
908 |
MethodTiming removeKey:aMethod ifAbsent:nil. |
|
579 | 909 |
MethodTiming at:aMethod put:(Array with:0 |
910 |
with:0 |
|
911 |
with:0 |
|
912 |
with:0). |
|
327 | 913 |
|
914 |
^ self wrapMethod:aMethod |
|
915 |
onEntry:[:con | |
|
916 |
t0 := OperatingSystem getMillisecondTime. |
|
917 |
] |
|
918 |
onExit:[:con :retVal | |
|
919 |
|info t cnt min max sumTimes| |
|
920 |
||
921 |
t := OperatingSystem getMillisecondTime - t0. |
|
922 |
info := MethodTiming at:aMethod ifAbsent:nil. |
|
923 |
info isNil ifTrue:[ |
|
924 |
MethodTiming at:aMethod put:(Array with:1 |
|
925 |
with:t |
|
926 |
with:t |
|
927 |
with:t) |
|
928 |
] ifFalse:[ |
|
929 |
cnt := info at:1. |
|
930 |
min := info at:2. |
|
931 |
max := info at:3. |
|
932 |
sumTimes := info at:4. |
|
933 |
t < min ifTrue:[ |
|
934 |
info at:2 put:t |
|
935 |
] ifFalse:[ |
|
936 |
t > max ifTrue:[ |
|
937 |
info at:3 put:t |
|
938 |
] |
|
939 |
]. |
|
940 |
info at:4 put:(sumTimes + t). |
|
941 |
info at:1 put:cnt + 1 |
|
942 |
]. |
|
943 |
] |
|
944 |
||
945 |
" |
|
946 |
MessageTracer timeMethod:(Integer compiledMethodAt:#factorial). |
|
947 |
5 factorial. |
|
948 |
5 factorial. |
|
949 |
5 factorial. |
|
950 |
(MessageTracer executionTimesOfMethod:(Integer compiledMethodAt:#factorial)) printCR. |
|
951 |
MessageTracer stopTimingMethod:(Integer compiledMethodAt:#factorial) |
|
952 |
" |
|
953 |
||
954 |
"Created: 17.6.1996 / 17:03:50 / cg" |
|
579 | 955 |
"Modified: 11.4.1997 / 17:15:29 / cg" |
327 | 956 |
! ! |
957 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
958 |
!MessageTracer class methodsFor:'method tracing'! |
11 | 959 |
|
88 | 960 |
traceMethod:aMethod |
961 |
"arrange for a trace message to be output on Stderr, when aMethod is executed. |
|
962 |
Use unwrapMethod to remove this." |
|
963 |
||
964 |
|lvl inside| |
|
11 | 965 |
|
88 | 966 |
^ self wrapMethod:aMethod |
967 |
onEntry:[:con | |
|
968 |
inside isNil ifTrue:[ |
|
969 |
inside := true. |
|
970 |
CallingLevel isNil ifTrue:[ |
|
971 |
CallingLevel := 0. |
|
972 |
]. |
|
973 |
lvl notNil ifTrue:[ |
|
974 |
lvl := lvl + 1 |
|
975 |
] ifFalse:[ |
|
976 |
CallingLevel := lvl := CallingLevel + 1. |
|
977 |
]. |
|
978 |
MessageTracer printEntryFull:con level:lvl. |
|
979 |
inside := nil |
|
980 |
] |
|
981 |
] |
|
982 |
onExit:[:con :retVal | |
|
983 |
inside isNil ifTrue:[ |
|
984 |
inside := true. |
|
985 |
MessageTracer printExit:con with:retVal level:lvl. |
|
986 |
CallingLevel := lvl := lvl - 1. |
|
987 |
inside := nil |
|
988 |
] |
|
989 |
] |
|
11 | 990 |
|
991 |
" |
|
88 | 992 |
MessageTracer traceMethod:(Integer compiledMethodAt:#factorial). |
993 |
5 factorial. |
|
994 |
MessageTracer untraceMethod:(Integer compiledMethodAt:#factorial) |
|
995 |
" |
|
996 |
" |
|
997 |
MessageTracer traceMethod:(SequenceableCollection compiledMethodAt:#quickSortFrom:to:). |
|
998 |
#(6 1 9 66 2 17) copy sort. |
|
999 |
MessageTracer untraceMethod:(SequenceableCollection compiledMethodAt:#quickSortFrom:to:). |
|
1000 |
" |
|
1001 |
" |
|
1002 |
dont do this: |
|
1003 |
" |
|
1004 |
" |
|
1005 |
MessageTracer traceMethod:(Object compiledMethodAt:#at:). |
|
1006 |
MessageTracer traceMethod:(Object compiledMethodAt:#at:put:). |
|
1007 |
#(6 1 9 66 2 17) copy sort. |
|
1008 |
MessageTracer untraceMethod:(Object compiledMethodAt:#at:). |
|
1009 |
MessageTracer untraceMethod:(Object compiledMethodAt:#at:put:). |
|
11 | 1010 |
" |
1011 |
! |
|
1012 |
||
162
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1013 |
traceMethodAll:aMethod |
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1014 |
"arrange for a full trace message to be output on Stderr, when amethod is executed. |
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1015 |
Only the sender is traced on entry. |
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1016 |
Use untraceMethod to remove this trace." |
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1017 |
|
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1018 |
^ self wrapMethod:aMethod |
572 | 1019 |
onEntry:[:con | ObjectMemory flushCaches. Smalltalk sendTraceOn.] |
1020 |
onExit:[:con :val | Smalltalk sendTraceOff.] |
|
162
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1021 |
|
572 | 1022 |
"Modified: 22.3.1997 / 17:02:04 / cg" |
162
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1023 |
! |
ed6f37d2cc33
added traceAll (full trace - longish output)
Claus Gittinger <cg@exept.de>
parents:
161
diff
changeset
|
1024 |
|
156 | 1025 |
traceMethodFull:aMethod |
1026 |
"arrange for a full trace message to be output on Stderr, when amethod is executed. |
|
1027 |
Only the sender is traced on entry. |
|
1028 |
Use untraceMethod to remove this trace." |
|
1029 |
||
1030 |
^ self wrapMethod:aMethod |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1031 |
onEntry:TraceFullBlock |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1032 |
onExit:LeaveTraceBlock. |
156 | 1033 |
|
1034 |
"Created: 15.12.1995 / 18:19:31 / cg" |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1035 |
"Modified: 22.10.1996 / 17:39:28 / cg" |
156 | 1036 |
! |
1037 |
||
88 | 1038 |
traceMethodSender:aMethod |
1039 |
"arrange for a trace message to be output on Stderr, when amethod is executed. |
|
1040 |
Only the sender is traced on entry. |
|
1041 |
Use untraceMethod to remove this trace." |
|
35 | 1042 |
|
88 | 1043 |
^ self wrapMethod:aMethod |
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1044 |
onEntry:TraceSenderBlock |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1045 |
onExit:LeaveTraceBlock. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1046 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1047 |
"Modified: 22.10.1996 / 17:39:33 / cg" |
88 | 1048 |
! |
1049 |
||
1050 |
untraceMethod:aMethod |
|
1051 |
"remove tracing of aMethod" |
|
1052 |
||
1053 |
"just a rename for your convenience - the same basic mechanism is used for all of these |
|
1054 |
trace facilities ..." |
|
1055 |
||
1056 |
^ self unwrapMethod:aMethod |
|
11 | 1057 |
! ! |
1058 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1059 |
!MessageTracer class methodsFor:'method wrapping'! |
11 | 1060 |
|
88 | 1061 |
unwrapAllMethods |
1062 |
"just in case you dont know what methods have break/trace-points |
|
1063 |
on them; this removes them all" |
|
1064 |
||
1065 |
WrappedMethod allInstancesDo:[:aMethod | |
|
1066 |
self unwrapMethod:aMethod |
|
1067 |
] |
|
11 | 1068 |
! |
1069 |
||
88 | 1070 |
unwrapMethod:aMethod |
1071 |
"remove any wrapper on aMethod" |
|
1072 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1073 |
|selector class originalMethod dict mthd| |
88 | 1074 |
|
155 | 1075 |
MethodCounts notNil ifTrue:[ |
265 | 1076 |
aMethod isWrapped ifTrue:[ |
1077 |
MethodCounts removeKey:aMethod originalMethod ifAbsent:nil. |
|
1078 |
]. |
|
1079 |
MethodCounts removeKey:aMethod ifAbsent:nil. |
|
1080 |
MethodCounts isEmpty ifTrue:[MethodCounts := nil]. |
|
172
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
1081 |
]. |
cf44aece60d4
clear memoryUsage when unwrapping
Claus Gittinger <cg@exept.de>
parents:
164
diff
changeset
|
1082 |
MethodMemoryUsage notNil ifTrue:[ |
265 | 1083 |
aMethod isWrapped ifTrue:[ |
1084 |
MethodMemoryUsage removeKey:aMethod originalMethod ifAbsent:nil. |
|
1085 |
]. |
|
1086 |
MethodMemoryUsage removeKey:aMethod ifAbsent:nil. |
|
1087 |
MethodMemoryUsage isEmpty ifTrue:[MethodMemoryUsage := nil]. |
|
155 | 1088 |
]. |
327 | 1089 |
MethodTiming notNil ifTrue:[ |
1090 |
aMethod isWrapped ifTrue:[ |
|
1091 |
MethodTiming removeKey:aMethod originalMethod ifAbsent:nil. |
|
1092 |
]. |
|
1093 |
MethodTiming removeKey:aMethod ifAbsent:nil. |
|
1094 |
MethodTiming isEmpty ifTrue:[MethodTiming := nil]. |
|
1095 |
]. |
|
155 | 1096 |
|
88 | 1097 |
CallingLevel := 0. |
1098 |
||
1099 |
(aMethod isNil or:[aMethod isWrapped not]) ifTrue:[ |
|
265 | 1100 |
^ aMethod |
88 | 1101 |
]. |
1102 |
||
1103 |
" |
|
1104 |
get class/selector |
|
1105 |
" |
|
1106 |
class := aMethod containingClass. |
|
1107 |
class isNil ifTrue:[ |
|
536 | 1108 |
'MessageTracer [info]: no containing class for method found' infoPrintCR. |
265 | 1109 |
^ aMethod |
88 | 1110 |
]. |
1111 |
selector := class selectorAtMethod:aMethod. |
|
1112 |
||
1113 |
originalMethod := aMethod originalMethod. |
|
1114 |
originalMethod isNil ifTrue:[ |
|
265 | 1115 |
self error:'oops, could not find original method'. |
1116 |
^ aMethod |
|
88 | 1117 |
]. |
1118 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1119 |
dict := class methodDictionary. |
506 | 1120 |
mthd := dict at:selector ifAbsent:nil. |
1121 |
mthd notNil ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1122 |
dict at:selector put:originalMethod. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1123 |
class methodDictionary:dict. |
88 | 1124 |
] ifFalse:[ |
506 | 1125 |
self halt:'oops, unexpected error - cannot remove wrap'. |
265 | 1126 |
^ aMethod |
88 | 1127 |
]. |
1128 |
||
1129 |
ObjectMemory flushCaches. |
|
584
2da6bb2c8017
send out change notifications when a trap is removed
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1130 |
class changed:#methodTrap with:selector. "/ tell browsers |
88 | 1131 |
^ originalMethod |
265 | 1132 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1133 |
"Modified: 5.6.1996 / 14:08:08 / stefan" |
584
2da6bb2c8017
send out change notifications when a trap is removed
Claus Gittinger <cg@exept.de>
parents:
579
diff
changeset
|
1134 |
"Modified: 24.4.1997 / 18:20:49 / cg" |
13 | 1135 |
! |
1136 |
||
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1137 |
wrapMethod:aMethod onEntry:entryBlock onExit:exitBlock |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1138 |
^ self wrapMethod:aMethod onEntry:entryBlock onExit:exitBlock onUnwind:nil |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1139 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1140 |
"Modified: 18.12.1995 / 15:58:12 / stefan" |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1141 |
! |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1142 |
|
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1143 |
wrapMethod:aMethod onEntry:entryBlock onExit:exitBlock onUnwind:unwindBlock |
88 | 1144 |
"arrange for the two blocks entryBlock and exitBlock to be evaluated whenever |
1145 |
aMethod is evaluated. |
|
1146 |
EntryBlock will be called on entry, and gets the current context passed as argument. |
|
1147 |
ExitBlock will be called, when the method is left, and gets the context and |
|
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1148 |
the methods return value as arguments. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1149 |
UnwindBlock will be called when the contxt of aMethod is unwound. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1150 |
If there is an unwindBlock, the entry and exitBlocks will be called within the unwind block, |
572 | 1151 |
because allocating the unwindBlock uses memory and some users want to count allocated memory. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1152 |
" |
88 | 1153 |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1154 |
|selector class trapMethod s spec src dict sel save| |
88 | 1155 |
|
1156 |
CallingLevel := 0. |
|
1157 |
||
1158 |
" |
|
1159 |
create a new method, which calls the original one, |
|
1160 |
but only if not already being trapped. |
|
1161 |
" |
|
1162 |
(aMethod isNil or:[aMethod isWrapped]) ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1163 |
^ aMethod |
88 | 1164 |
]. |
1165 |
aMethod isLazyMethod ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1166 |
aMethod makeRealMethod |
88 | 1167 |
]. |
1168 |
||
1169 |
" |
|
1170 |
get class/selector |
|
1171 |
" |
|
1172 |
class := aMethod containingClass. |
|
1173 |
class isNil ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1174 |
self error:'cannot place trap (no containing class found)'. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1175 |
^ aMethod |
88 | 1176 |
]. |
1177 |
selector := class selectorAtMethod:aMethod. |
|
1178 |
||
1179 |
||
1180 |
WrappedMethod autoload. "/ for small systems |
|
1181 |
||
1182 |
" |
|
1183 |
get a new method-spec |
|
1184 |
" |
|
1185 |
spec := Parser methodSpecificationForSelector:selector. |
|
1186 |
||
1187 |
" |
|
1188 |
create a method, executing the trap-blocks and the original method via a direct call |
|
1189 |
" |
|
1190 |
s := WriteStream on:String new. |
|
1191 |
s nextPutAll:spec. |
|
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1192 |
s nextPutAll:' |retVal context| '. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1193 |
s nextPutAll:' context := thisContext.'. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1194 |
unwindBlock notNil ifTrue:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1195 |
s nextPutAll:'['. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1196 |
]. |
88 | 1197 |
entryBlock notNil ifTrue:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1198 |
s nextPutAll:'#entryBlock yourself value:context. '. |
88 | 1199 |
]. |
1200 |
s nextPutAll:'retVal := #originalMethod yourself'; |
|
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1201 |
nextPutAll: ' valueWithReceiver:(context receiver)'; |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1202 |
nextPutAll: ' arguments:(context args)'; |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1203 |
nextPutAll: ' selector:(context selector)'; |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1204 |
nextPutAll: ' search:(context searchClass)'; |
88 | 1205 |
nextPutAll: ' sender:nil. '. |
1206 |
||
1207 |
exitBlock notNil ifTrue:[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1208 |
s nextPutAll:'#exitBlock yourself value:context value:retVal.'. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1209 |
]. |
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1210 |
unwindBlock notNil ifTrue:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1211 |
s nextPutAll:'] valueOnUnwindDo:#unwindBlock yourself.'. |
88 | 1212 |
]. |
1213 |
s nextPutAll:'^ retVal'; cr. |
|
1214 |
||
1215 |
src := s contents. |
|
1216 |
save := Compiler stcCompilation. |
|
1217 |
Compiler stcCompilation:#never. |
|
1218 |
[ |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1219 |
Class withoutUpdatingChangesDo:[ |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1220 |
trapMethod := Compiler compile:src |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1221 |
forClass:UndefinedObject |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1222 |
inCategory:aMethod category |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1223 |
notifying:nil |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1224 |
install:false |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1225 |
skipIfSame:false |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1226 |
silent:true. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1227 |
] |
88 | 1228 |
] valueNowOrOnUnwindDo:[ |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1229 |
Compiler stcCompilation:save |
88 | 1230 |
]. |
1231 |
||
1232 |
trapMethod changeClassTo:WrappedMethod. |
|
1233 |
||
1234 |
" |
|
1235 |
raising our eyebrows here ... |
|
1236 |
" |
|
1237 |
entryBlock notNil ifTrue:[ |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1238 |
trapMethod changeLiteral:#entryBlock to:entryBlock. |
88 | 1239 |
]. |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1240 |
trapMethod changeLiteral:#originalMethod to:aMethod. |
88 | 1241 |
exitBlock notNil ifTrue:[ |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1242 |
trapMethod changeLiteral:#exitBlock to:exitBlock. |
88 | 1243 |
]. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1244 |
unwindBlock notNil ifTrue:[ |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1245 |
trapMethod changeLiteral:#unwindBlock to:unwindBlock. |
164
ea53c919343f
New method to wrap with unwind-actions.
Stefan Vogel <sv@exept.de>
parents:
162
diff
changeset
|
1246 |
]. |
88 | 1247 |
" |
1248 |
change the source of this new method |
|
1249 |
(to avoid confusion in the debugger ...) |
|
1250 |
" |
|
1251 |
trapMethod source:'this is a wrapper method - not the real one'. |
|
1252 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1253 |
dict := class methodDictionary. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1254 |
sel := dict at:selector ifAbsent:[0]. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1255 |
sel == 0 ifTrue:[ |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1256 |
self halt:'oops, unexpected error'. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1257 |
^ aMethod |
88 | 1258 |
]. |
1259 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1260 |
dict at:selector put:trapMethod. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1261 |
class methodDictionary:dict. |
88 | 1262 |
ObjectMemory flushCaches. |
1263 |
^ trapMethod |
|
1264 |
||
1265 |
" |
|
1266 |
MessageTracer |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1267 |
wrapMethod:(Point compiledMethodAt:#scaleBy:) |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1268 |
onEntry:nil |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1269 |
onExit:[:con :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1270 |
Transcript show:'leave Point>>scaleBy:; returning:'. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1271 |
Transcript showCR:retVal printString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1272 |
Transcript endEntry |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1273 |
]. |
88 | 1274 |
(1@2) scaleBy:5. |
1275 |
MessageTracer unwrapMethod:(Point compiledMethodAt:#scaleBy:). |
|
1276 |
(1@2) scaleBy:5. |
|
1277 |
" |
|
1278 |
" |
|
1279 |
MessageTracer |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1280 |
wrapMethod:(Integer compiledMethodAt:#factorial) |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1281 |
onEntry:[:con | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1282 |
Transcript showCR:('entering ' , con receiver printString , '>>factorial'). |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1283 |
] |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1284 |
onExit:[:con :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1285 |
Transcript show:'leave Integer>>factorial; returning:'. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1286 |
Transcript showCR:retVal printString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1287 |
Transcript endEntry |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1288 |
]. |
258 | 1289 |
Transcript showCR:'5 factorial traced'. |
88 | 1290 |
5 factorial. |
1291 |
MessageTracer unwrapMethod:(Integer compiledMethodAt:#factorial). |
|
258 | 1292 |
Transcript showCR:'5 factorial normal'. |
88 | 1293 |
5 factorial. |
1294 |
" |
|
1295 |
" |
|
1296 |
|lvl| |
|
1297 |
||
1298 |
lvl := 0. |
|
1299 |
MessageTracer |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1300 |
wrapMethod:(Integer compiledMethodAt:#factorial) |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1301 |
onEntry:[:con | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1302 |
Transcript spaces:lvl. lvl := lvl + 2. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1303 |
Transcript showCR:('entering ' , con receiver printString , '>>factorial'). |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1304 |
] |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1305 |
onExit:[:con :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1306 |
lvl := lvl - 2. Transcript spaces:lvl. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1307 |
Transcript show:('leave ' , con receiver printString , '>>factorial; returning:'). |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1308 |
Transcript showCR:retVal printString. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1309 |
Transcript endEntry |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1310 |
]. |
258 | 1311 |
Transcript showCR:'5 factorial traced'. |
88 | 1312 |
5 factorial. |
1313 |
MessageTracer unwrapMethod:(Integer compiledMethodAt:#factorial). |
|
258 | 1314 |
Transcript showCR:'5 factorial normal'. |
88 | 1315 |
5 factorial. |
1316 |
" |
|
150
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
1317 |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1318 |
"Modified: 25.6.1996 / 22:04:51 / stefan" |
572 | 1319 |
"Modified: 22.3.1997 / 17:00:43 / cg" |
88 | 1320 |
! ! |
1321 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1322 |
!MessageTracer class methodsFor:'object breakpointing'! |
88 | 1323 |
|
525 | 1324 |
objectHasWraps:anObject |
1325 |
"return true, if anObject has any wraps" |
|
1326 |
||
1327 |
^ anObject class category == #'* trapping *' |
|
1328 |
! |
|
1329 |
||
1330 |
realClassOf:anObject |
|
1331 |
"return anObjects real class" |
|
1332 |
||
1333 |
(anObject class category == #'* trapping *') ifFalse:[ |
|
1334 |
^ anObject class |
|
1335 |
]. |
|
1336 |
^ anObject class superclass |
|
1337 |
! |
|
1338 |
||
88 | 1339 |
trap:anObject selector:aSelector |
1340 |
"arrange for the debugger to be entered when a message with aSelector is |
|
1341 |
sent to anObject. Use untrap to remove this trap. |
|
1342 |
The current implementation does not allow integers or nil to be trapped." |
|
1343 |
||
1344 |
self wrap:anObject |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1345 |
selector:aSelector |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1346 |
onEntry:BreakBlock |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1347 |
onExit:LeaveBreakBlock. |
88 | 1348 |
|
1349 |
" |
|
1350 |
|p| |
|
1351 |
||
1352 |
p := Point new. |
|
1353 |
MessageTracer trap:p selector:#x:. |
|
1354 |
p x:5 |
|
1355 |
" |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1356 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1357 |
"Modified: 22.10.1996 / 17:39:41 / cg" |
11 | 1358 |
! |
1359 |
||
88 | 1360 |
trap:anObject selectors:aCollection |
1361 |
self wrap:anObject |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1362 |
selectors:aCollection |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1363 |
onEntry:BreakBlock |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1364 |
onExit:LeaveBreakBlock. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1365 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1366 |
"Modified: 22.10.1996 / 17:39:50 / cg" |
88 | 1367 |
! |
1368 |
||
1369 |
trapAll:anObject |
|
1370 |
"trap on all messages which are understood by anObject" |
|
1371 |
||
1372 |
self wrapAll:anObject |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1373 |
onEntry:BreakBlock |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1374 |
onExit:LeaveBreakBlock. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1375 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1376 |
"Modified: 22.10.1996 / 17:39:54 / cg" |
88 | 1377 |
! |
1378 |
||
1379 |
trapAll:anObject from:aClass |
|
1380 |
"trap on all messages defined in aClass sent to anObject" |
|
1381 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1382 |
self trap:anObject selectors:aClass selectors |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1383 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1384 |
"Modified: 5.6.1996 / 13:46:06 / stefan" |
88 | 1385 |
! |
1386 |
||
1387 |
untrap:anObject |
|
1388 |
"remove any traps on anObject" |
|
1389 |
||
1390 |
"this is done by just patching the objects class back to the original" |
|
1391 |
||
1392 |
|orgClass| |
|
1393 |
||
1394 |
orgClass := anObject class. |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
1395 |
orgClass category == #'* trapping *' ifFalse:[ |
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
1396 |
^ self |
88 | 1397 |
]. |
1398 |
||
660 | 1399 |
anObject changeClassTo:orgClass superclass. |
662 | 1400 |
ObjectCopyHolders notNil ifTrue:[ |
1401 |
ObjectCopyHolders removeKey:anObject ifAbsent:nil. |
|
1402 |
]. |
|
88 | 1403 |
|
1404 |
" |
|
1405 |
|p| |
|
1406 |
||
1407 |
p := Point new copy. |
|
1408 |
MessageTracer trace:p selector:#x:. |
|
1409 |
MessageTracer trace:p selector:#y:. |
|
1410 |
p y:1. |
|
1411 |
p x:2. |
|
1412 |
MessageTracer untrap:p |
|
1413 |
p y:2. |
|
1414 |
p x:1. |
|
1415 |
" |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
1416 |
|
660 | 1417 |
"Modified: / 21.4.1998 / 15:43:33 / cg" |
13 | 1418 |
! |
1419 |
||
88 | 1420 |
untrap:anObject selector:aSelector |
1421 |
"remove trap on aSelector from anObject" |
|
1422 |
||
501 | 1423 |
|orgClass dict| |
88 | 1424 |
|
1425 |
orgClass := anObject class. |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
1426 |
orgClass category == #'* trapping *' ifFalse:[^ self]. |
88 | 1427 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1428 |
dict := orgClass methodDictionary. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1429 |
dict at:aSelector ifAbsent:[^ self]. |
88 | 1430 |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1431 |
dict size == 1 ifTrue:[ |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1432 |
"the last trap got removed" |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1433 |
anObject changeClassTo:orgClass superclass. |
662 | 1434 |
ObjectCopyHolders notNil ifTrue:[ |
1435 |
ObjectCopyHolders removeKey:anObject ifAbsent:nil. |
|
1436 |
]. |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1437 |
^ self |
88 | 1438 |
]. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1439 |
dict removeKey:aSelector. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1440 |
orgClass methodDictionary:dict. |
88 | 1441 |
ObjectMemory flushCaches. "avoid calling the old trap method" |
1442 |
||
1443 |
" |
|
1444 |
|p| |
|
1445 |
||
1446 |
p := Point new copy. |
|
1447 |
MessageTracer trace:p selector:#x:. |
|
1448 |
MessageTracer trace:p selector:#y:. |
|
1449 |
'trace both ...' errorPrintNL. |
|
1450 |
p x:2. |
|
1451 |
p y:1. |
|
1452 |
'trace only y ...' errorPrintNL. |
|
1453 |
MessageTracer untrap:p selector:#x:. |
|
1454 |
p x:2. |
|
1455 |
p y:1. |
|
1456 |
'trace none ...' errorPrintNL. |
|
1457 |
MessageTracer untrap:p selector:#y:. |
|
1458 |
p x:2. |
|
1459 |
p y:1. |
|
1460 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1461 |
|
660 | 1462 |
"Modified: / 5.6.1996 / 13:56:08 / stefan" |
1463 |
"Modified: / 21.4.1998 / 15:43:55 / cg" |
|
525 | 1464 |
! |
1465 |
||
1466 |
wrappedSelectorsOf:anObject |
|
1467 |
"return the set of wrapped selectors (if any)" |
|
1468 |
||
1469 |
(anObject class category == #'* trapping *') ifFalse:[ |
|
1470 |
^ #() |
|
1471 |
]. |
|
1472 |
^ anObject class selectors |
|
11 | 1473 |
! ! |
1474 |
||
660 | 1475 |
!MessageTracer class methodsFor:'object modification traps'! |
1476 |
||
1477 |
trapModificationsIn:anObject |
|
1478 |
"trap modifications in anObject" |
|
1479 |
||
1480 |
self |
|
663 | 1481 |
trapModificationsIn:anObject filter:[:old :new | true] |
660 | 1482 |
|
1483 |
" |
|
1484 |
|a| |
|
1485 |
||
1486 |
a := Array new:10. |
|
1487 |
MessageTracer trapModificationsIn:a. |
|
1488 |
||
1489 |
a size. |
|
1490 |
a at:1. |
|
1491 |
a at:2 put:nil. |
|
1492 |
a at:2 put:2. |
|
1493 |
a at:2. |
|
1494 |
a at:3. |
|
1495 |
a at:2 put:2. |
|
1496 |
a at:2 put:3. |
|
1497 |
MessageTracer untrace:a. |
|
1498 |
a at:3 put:5. |
|
1499 |
" |
|
1500 |
||
1501 |
"Created: / 21.4.1998 / 14:32:34 / cg" |
|
1502 |
"Modified: / 21.4.1998 / 14:58:24 / cg" |
|
1503 |
! |
|
1504 |
||
1505 |
trapModificationsIn:anObject filter:aFilterBlock |
|
1506 |
"trap modifications in anObject" |
|
1507 |
||
1508 |
|allSelectors| |
|
1509 |
||
1510 |
allSelectors := IdentitySet new. |
|
1511 |
anObject class withAllSuperclasses do:[:aClass | |
|
1512 |
aClass methodDictionary keys addAllTo:allSelectors |
|
1513 |
]. |
|
1514 |
allSelectors remove:#class. |
|
1515 |
||
1516 |
self trapModificationsIn:anObject selectors:allSelectors filter:aFilterBlock |
|
1517 |
||
1518 |
"trap if arrays 5th slot is modified: |
|
1519 |
||
1520 |
|a| |
|
1521 |
||
1522 |
a := Array new:10. |
|
1523 |
MessageTracer trapModificationsIn:a filter:[:old :new | (old at:5) ~~ (new at:5)]. |
|
1524 |
||
1525 |
a size. |
|
1526 |
a at:1. |
|
1527 |
a at:2 put:nil. |
|
1528 |
a at:2 put:2. |
|
1529 |
a at:2. |
|
1530 |
a at:3. |
|
1531 |
a at:2 put:2. |
|
1532 |
a at:2 put:3. |
|
1533 |
a at:5 put:3. |
|
1534 |
a at:5 put:3. |
|
1535 |
MessageTracer untrace:a. |
|
1536 |
a at:3 put:5. |
|
1537 |
" |
|
1538 |
||
1539 |
"Modified: / 21.4.1998 / 15:53:38 / cg" |
|
1540 |
! |
|
1541 |
||
1542 |
trapModificationsIn:anObject selector:aSelector filter:aFilterBlock |
|
1543 |
"install a trap for modifications in anObject by aSelector-messages. |
|
1544 |
the filterBlock will be invoked (after a modification) with the old and |
|
1545 |
new values as arguments and should return true, |
|
1546 |
if the debugger is really wanted." |
|
1547 |
||
1548 |
self |
|
1549 |
trapModificationsIn:anObject |
|
1550 |
selectors:(Array with:aSelector) |
|
1551 |
filter:aFilterBlock |
|
1552 |
||
1553 |
"Modified: / 21.4.1998 / 15:34:44 / cg" |
|
1554 |
! |
|
1555 |
||
1556 |
trapModificationsIn:anObject selectors:aCollectionOfSelectors filter:aFilterBlock |
|
1557 |
"install a trap for modifications in anObject by aSelector-messages. |
|
1558 |
the filterBlock will be invoked (after a modification) with the old and |
|
1559 |
new values as arguments and should return true, |
|
1560 |
if the debugger is really wanted." |
|
1561 |
||
1562 |
|copyHolder| |
|
1563 |
||
1564 |
ObjectCopyHolders isNil ifTrue:[ |
|
1565 |
ObjectCopyHolders := IdentityDictionary new. |
|
1566 |
]. |
|
1567 |
copyHolder := ObjectCopyHolders at:anObject ifAbsent:nil. |
|
1568 |
copyHolder isNil ifTrue:[ |
|
1569 |
ObjectCopyHolders at:anObject put:(copyHolder := ValueHolder new). |
|
1570 |
]. |
|
1571 |
||
1572 |
copyHolder value:(anObject shallowCopy). |
|
1573 |
||
1574 |
aCollectionOfSelectors do:[:aSelector | |
|
1575 |
|methodName| |
|
1576 |
||
1577 |
methodName := anObject class name , '>>' , aSelector. |
|
1578 |
self |
|
1579 |
wrap:anObject |
|
1580 |
selector:aSelector |
|
1581 |
onEntry:[:con | ] |
|
1582 |
onExit:[:con :retVal | |
|
1583 |
|oldValue| |
|
1584 |
||
1585 |
oldValue := copyHolder value. |
|
1586 |
||
1587 |
"/ compare with copy ... |
|
1588 |
(anObject sameContentsAs:oldValue) ifFalse:[ |
|
1589 |
"/ see oldValue vs. anObject |
|
1590 |
(aFilterBlock value:oldValue value:anObject) ifTrue:[ |
|
1591 |
copyHolder value:(anObject shallowCopy). |
|
1592 |
ObjectWrittenBreakpointSignal |
|
1593 |
raiseRequestWith:(oldValue -> anObject) |
|
1594 |
errorString:('object was modififed in ' , methodName) |
|
1595 |
in:con sender |
|
1596 |
] |
|
1597 |
] |
|
1598 |
] |
|
1599 |
withOriginalClass:true |
|
1600 |
flushCaches:false. |
|
1601 |
]. |
|
1602 |
ObjectMemory flushCaches |
|
1603 |
||
1604 |
"Created: / 21.4.1998 / 15:34:05 / cg" |
|
1605 |
"Modified: / 21.4.1998 / 16:00:39 / cg" |
|
1606 |
! ! |
|
1607 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1608 |
!MessageTracer class methodsFor:'object tracing'! |
88 | 1609 |
|
1610 |
trace:anObject selector:aSelector |
|
1611 |
"arrange for a trace message to be output on Stderr, when a message with |
|
1612 |
aSelector is sent to anObject. Both entry and exit are traced. |
|
1613 |
Use untrap to remove this trace. |
|
1614 |
The current implementation does not allow integers or nil to be traced." |
|
1615 |
||
660 | 1616 |
self |
1617 |
trace:anObject |
|
1618 |
selectors:(Array with:aSelector) |
|
88 | 1619 |
|
1620 |
" |
|
1621 |
|p| |
|
8 | 1622 |
|
88 | 1623 |
p := Point new. |
1624 |
MessageTracer trace:p selector:#x:. |
|
1625 |
p x:5. |
|
1626 |
p y:1. |
|
1627 |
p x:10. |
|
1628 |
MessageTracer untrap:p. |
|
1629 |
p x:7 |
|
1630 |
" |
|
1631 |
" |
|
1632 |
|a| |
|
1633 |
||
1634 |
a := #(6 1 9 66 2 17) copy. |
|
1635 |
MessageTracer trace:a selector:#at:put:. |
|
1636 |
MessageTracer trace:a selector:#at:. |
|
1637 |
a sort. |
|
1638 |
" |
|
538
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
1639 |
|
660 | 1640 |
"Modified: / 21.4.1998 / 15:37:05 / cg" |
88 | 1641 |
! |
1642 |
||
660 | 1643 |
trace:anObject selectors:aCollectionOfSelectors |
1644 |
"arrange for a trace message to be output on Stderr, when any message |
|
1645 |
from aCollectionOfSelectors is sent to anObject. |
|
1646 |
Both entry and exit are traced. |
|
1647 |
Use untrap:/untrace: to remove this trace. |
|
1648 |
The current implementation does not allow integers or nil to be traced." |
|
1649 |
||
1650 |
|methodName| |
|
1651 |
||
1652 |
aCollectionOfSelectors do:[:aSelector | |
|
1653 |
methodName := anObject class name , '>>' , aSelector. |
|
1654 |
self |
|
1655 |
wrap:anObject |
|
1656 |
selector:aSelector |
|
1657 |
onEntry:[:con | |
|
1658 |
'enter ' errorPrint. methodName errorPrint. |
|
1659 |
' receiver=' errorPrint. con receiver printString errorPrint. |
|
1660 |
' args=' errorPrint. (con args) printString errorPrint. |
|
1661 |
' from:' errorPrint. con sender errorPrintCR. |
|
1662 |
] |
|
1663 |
onExit:[:con :retVal | |
|
1664 |
'leave ' errorPrint. methodName errorPrint. |
|
1665 |
' receiver=' errorPrint. con receiver printString errorPrint. |
|
1666 |
' returning:' errorPrint. retVal printString errorPrintCR. |
|
1667 |
] |
|
1668 |
withOriginalClass:true |
|
1669 |
flushCaches:false |
|
1670 |
]. |
|
1671 |
ObjectMemory flushCaches |
|
88 | 1672 |
|
1673 |
" |
|
660 | 1674 |
|p| |
1675 |
||
1676 |
p := Point new. |
|
1677 |
MessageTracer trace:p selector:#x:. |
|
1678 |
p x:5. |
|
1679 |
p y:1. |
|
1680 |
p x:10. |
|
1681 |
MessageTracer untrap:p. |
|
1682 |
p x:7 |
|
1683 |
" |
|
1684 |
" |
|
1685 |
|a| |
|
1686 |
||
1687 |
a := #(6 1 9 66 2 17) copy. |
|
1688 |
MessageTracer trace:a selector:#at:put:. |
|
1689 |
MessageTracer trace:a selector:#at:. |
|
1690 |
a sort. |
|
88 | 1691 |
" |
1692 |
||
660 | 1693 |
"Modified: / 21.4.1998 / 15:41:57 / cg" |
88 | 1694 |
! |
1695 |
||
1696 |
traceAll:anObject |
|
1697 |
"trace all messages which are understood by anObject" |
|
27 | 1698 |
|
1699 |
|allSelectors| |
|
1700 |
||
1701 |
allSelectors := IdentitySet new. |
|
1702 |
anObject class withAllSuperclasses do:[:aClass | |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1703 |
aClass methodDictionary keys addAllTo:allSelectors |
27 | 1704 |
]. |
88 | 1705 |
self trace:anObject selectors:allSelectors |
1706 |
||
1707 |
" |
|
1708 |
trace all (implemented) messages sent to Display |
|
1709 |
(other messages lead to an error, anyway) |
|
1710 |
" |
|
1711 |
||
1712 |
" |
|
1713 |
MessageTracer traceAll:Display |
|
1714 |
MessageTracer untrace:Display |
|
1715 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1716 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1717 |
"Modified: 5.6.1996 / 13:43:51 / stefan" |
88 | 1718 |
! |
1719 |
||
1720 |
traceAll:anObject from:aClass |
|
1721 |
"trace all messages defined in aClass sent to anObject" |
|
1722 |
||
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1723 |
self trace:anObject selectors:aClass selectors |
88 | 1724 |
|
1725 |
" |
|
1726 |
trace all methods in Display, which are implemented |
|
1727 |
in the DisplayWorkstation class. |
|
1728 |
" |
|
1729 |
||
1730 |
" |
|
1731 |
MessageTracer traceAll:Display from:XWorkstation |
|
1732 |
MessageTracer untrace:Display |
|
1733 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1734 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1735 |
"Modified: 5.6.1996 / 13:45:37 / stefan" |
27 | 1736 |
! |
1737 |
||
88 | 1738 |
traceSender:anObject selector:aSelector |
1739 |
"arrange for a trace message to be output on Stderr, when a message with |
|
1740 |
aSelector is sent to anObject. Only the sender is traced on entry. |
|
1741 |
Use untrap to remove this trace. |
|
1742 |
The current implementation does not allow integers or nil to be traced." |
|
1743 |
||
1744 |
|methodName| |
|
1745 |
||
1746 |
methodName := anObject class name , '>>' , aSelector. |
|
1747 |
self wrap:anObject |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1748 |
selector:aSelector |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1749 |
onEntry:[:con | |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1750 |
methodName errorPrint. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1751 |
' from ' errorPrint. |
538
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
1752 |
con sender errorPrintCR. |
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1753 |
] |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1754 |
onExit:LeaveTraceBlock. |
88 | 1755 |
|
1756 |
" |
|
1757 |
|p| |
|
27 | 1758 |
|
88 | 1759 |
p := Point new. |
1760 |
MessageTracer traceSender:p selector:#x:. |
|
1761 |
p x:5. |
|
1762 |
p y:1. |
|
1763 |
p x:10. |
|
1764 |
MessageTracer untrap:p. |
|
1765 |
p x:7 |
|
1766 |
" |
|
1767 |
" |
|
1768 |
|a| |
|
1769 |
||
1770 |
a := #(6 1 9 66 2 17) copy. |
|
1771 |
MessageTracer traceSender:a selector:#at:put:. |
|
1772 |
MessageTracer traceSender:a selector:#at:. |
|
1773 |
a sort. |
|
1774 |
" |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1775 |
|
538
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
1776 |
"Modified: 10.1.1997 / 17:54:53 / cg" |
11 | 1777 |
! |
1778 |
||
88 | 1779 |
untrace:anObject |
1780 |
"remove any traces on anObject" |
|
1781 |
||
1782 |
"just a rename for your convenience - the same basic mechanism is used for all of these |
|
1783 |
trace facilities ..." |
|
1784 |
||
1785 |
^ self untrap:anObject |
|
1786 |
! |
|
1787 |
||
1788 |
untrace:anObject selector:aSelector |
|
1789 |
"remove traces of aSelector sent to anObject" |
|
1790 |
||
1791 |
"just a rename for your convenience - the same basic mechanism is used for all of these |
|
1792 |
trace facilities ..." |
|
1793 |
||
1794 |
^ self untrap:anObject selector:aSelector |
|
1795 |
! ! |
|
1796 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
1797 |
!MessageTracer class methodsFor:'object wrapping'! |
88 | 1798 |
|
8 | 1799 |
wrap:anObject selector:aSelector onEntry:entryBlock onExit:exitBlock |
1800 |
"arrange for the two blocks entryBlock and exitBlock to be evaluated whenever |
|
1801 |
a message with aSelector is sent to anObject. EntryBlock will be called on |
|
1802 |
entry, and get the current context passed as argument. ExitBlock will be called, |
|
1803 |
when the method is left, and get the context and the methods return value as arguments. |
|
1804 |
The current implementation does not allow integers or nil to be wrapped." |
|
1805 |
||
1806 |
"I have not yet enough experience, if the wrapped original method should |
|
1807 |
run as an instance of the original, or of the catching class; |
|
1808 |
The latter has the advantage of catching recursive and other sends, while |
|
1809 |
it might lead into trouble when the message is sent from a debugger or a long |
|
1810 |
return is done out of the original method ... |
|
1811 |
Time will show, you can experiment by setting the withOriginalClass: flag to false |
|
1812 |
" |
|
660 | 1813 |
^ self |
1814 |
wrap:anObject |
|
1815 |
selector:aSelector |
|
1816 |
onEntry:entryBlock |
|
1817 |
onExit:exitBlock |
|
1818 |
withOriginalClass:true |
|
1819 |
flushCaches:true |
|
1820 |
||
1821 |
"Modified: / 21.4.1998 / 15:29:50 / cg" |
|
8 | 1822 |
! |
1823 |
||
660 | 1824 |
wrap:anObject selector:aSelector onEntry:entryBlock onExit:exitBlock withOriginalClass:withOriginalClass flushCaches:flushCaches |
8 | 1825 |
"arrange for the two blocks entryBlock and exitBlock to be evaluated whenever |
1826 |
a message with aSelector is sent to anObject. EntryBlock will be called on |
|
1827 |
entry, and get the current context passed as argument. ExitBlock will be called, |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1828 |
when the method is left, and get the current context and the methods return value as argument. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1829 |
If withOriginalClass is true, the class of anObject will be set to its original class |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1830 |
before the wrapped method will be called. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1831 |
NOTICE: The current implementation does not allow integers or nil to be wrapped." |
8 | 1832 |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1833 |
|newClass orgClass myMetaclass trapMethod s spec implClass save dict| |
8 | 1834 |
|
1835 |
" |
|
27 | 1836 |
some are not allowed (otherwise we get into trouble ...) |
1837 |
" |
|
660 | 1838 |
(aSelector == #class |
1839 |
or:[aSelector == #changeClassTo:]) ifTrue:[ |
|
256 | 1840 |
Transcript showCR:'sorry, cannot place trap on: ' , aSelector. |
1841 |
^ self |
|
27 | 1842 |
]. |
1843 |
||
1844 |
WrappedMethod autoload. "/ just to make sure ... |
|
1845 |
||
1846 |
" |
|
8 | 1847 |
create a new (anonymous) subclass of the receivers class |
1848 |
but only if not already being trapped. |
|
1849 |
" |
|
1850 |
orgClass := anObject class. |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
1851 |
orgClass category == #'* trapping *' ifTrue:[ |
256 | 1852 |
newClass := orgClass |
8 | 1853 |
] ifFalse:[ |
256 | 1854 |
myMetaclass := orgClass class. |
8 | 1855 |
|
256 | 1856 |
newClass := myMetaclass copy new. |
1857 |
newClass setSuperclass:orgClass. |
|
1858 |
newClass instSize:orgClass instSize. |
|
1859 |
newClass flags:orgClass flags. |
|
1860 |
newClass setClassVariableString:''. |
|
1861 |
newClass setInstanceVariableString:''. |
|
1862 |
newClass setName:orgClass name. |
|
457
8ba8e7ac735d
use #'* trapping *' instead of #trapping as category mark
Claus Gittinger <cg@exept.de>
parents:
352
diff
changeset
|
1863 |
newClass category:#'* trapping *'. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1864 |
newClass methodDictionary:MethodDictionary new. |
8 | 1865 |
]. |
1866 |
||
1867 |
" |
|
1868 |
create a method, executing the trap-blocks and the original method via a super-send |
|
1869 |
" |
|
1870 |
spec := Parser methodSpecificationForSelector:aSelector. |
|
1871 |
s := WriteStream on:String new. |
|
1872 |
s nextPutAll:spec. |
|
27 | 1873 |
s nextPutAll:' |retVal stubClass| '. |
8 | 1874 |
withOriginalClass ifTrue:[ |
256 | 1875 |
s nextPutAll:'stubClass := self class. '. |
1876 |
s nextPutAll:'self changeClassTo:(stubClass superclass). '. |
|
8 | 1877 |
]. |
1878 |
entryBlock notNil ifTrue:[ |
|
256 | 1879 |
s nextPutAll:'#literal1 yourself value:thisContext. '. |
8 | 1880 |
]. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1881 |
s nextPutAll:('retVal := #originalMethod. '). "/ just to get a place for the originalMethod |
27 | 1882 |
s nextPutAll:('retVal := super ' , spec , '. '). |
8 | 1883 |
exitBlock notNil ifTrue:[ |
256 | 1884 |
s nextPutAll:'#literal2 yourself value:thisContext value:retVal. '. |
8 | 1885 |
]. |
1886 |
withOriginalClass ifTrue:[ |
|
256 | 1887 |
s nextPutAll:'self changeClassTo:stubClass. '. |
8 | 1888 |
]. |
1889 |
s nextPutAll:'^ retVal'; cr. |
|
1890 |
||
37 | 1891 |
save := Compiler stcCompilation. |
1892 |
Compiler stcCompilation:#never. |
|
1893 |
[ |
|
256 | 1894 |
Class withoutUpdatingChangesDo:[ |
1895 |
trapMethod := Compiler compile:s contents |
|
1896 |
forClass:newClass |
|
1897 |
inCategory:'breakpointed' |
|
1898 |
notifying:nil |
|
1899 |
install:false |
|
1900 |
skipIfSame:false |
|
1901 |
silent:true. |
|
1902 |
] |
|
37 | 1903 |
] valueNowOrOnUnwindDo:[ |
256 | 1904 |
Compiler stcCompilation:save |
37 | 1905 |
]. |
8 | 1906 |
|
646 | 1907 |
trapMethod == #Error ifTrue:[ |
1908 |
Transcript showCR:('cannot place trap on method: ' , aSelector). |
|
1909 |
^ self |
|
1910 |
]. |
|
1911 |
||
29 | 1912 |
implClass := orgClass whichClassIncludesSelector:aSelector. |
1913 |
implClass isNil ifTrue:[ |
|
256 | 1914 |
Transcript showCR:aSelector , ' is not understood by ' , orgClass name. |
29 | 1915 |
] ifFalse:[ |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1916 |
trapMethod changeLiteral:#originalMethod to:(implClass compiledMethodAt:aSelector). |
29 | 1917 |
]. |
8 | 1918 |
entryBlock notNil ifTrue:[ |
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1919 |
trapMethod changeLiteral:#literal1 to:entryBlock. |
8 | 1920 |
]. |
1921 |
exitBlock notNil ifTrue:[ |
|
352
ac12b5bc2754
Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents:
327
diff
changeset
|
1922 |
trapMethod changeLiteral:#literal2 to:exitBlock. |
8 | 1923 |
]. |
1924 |
" |
|
1925 |
change the source of this new method |
|
1926 |
(to avoid confusion in the debugger ...) |
|
1927 |
" |
|
1928 |
trapMethod source:'this is a wrapper method - not the real one'. |
|
27 | 1929 |
trapMethod changeClassTo:WrappedMethod. |
8 | 1930 |
|
1931 |
" |
|
1932 |
install this new method |
|
1933 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1934 |
dict := newClass methodDictionary. |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1935 |
dict := dict at:aSelector putOrAppend:trapMethod. |
660 | 1936 |
flushCaches ifTrue:[ |
1937 |
newClass methodDictionary:dict. |
|
1938 |
] ifFalse:[ |
|
1939 |
newClass setMethodDictionary:dict. |
|
1940 |
]. |
|
8 | 1941 |
|
1942 |
" |
|
1943 |
and finally, the big trick: |
|
1944 |
" |
|
660 | 1945 |
newClass ~~ orgClass ifTrue:[ |
1946 |
anObject changeClassTo:newClass |
|
1947 |
]. |
|
8 | 1948 |
|
1949 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1950 |
[exBegin] |
8 | 1951 |
|p| |
1952 |
||
1953 |
p := Point new copy. |
|
1954 |
MessageTracer |
|
256 | 1955 |
wrap:p |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1956 |
selector:#y: |
256 | 1957 |
onEntry:nil |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1958 |
onExit:[:context :retVal | |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1959 |
Transcript show:'leave Point>>y:, returning:'. |
256 | 1960 |
Transcript showCR:retVal printString. |
1961 |
Transcript endEntry |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1962 |
] |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1963 |
withOriginalClass:true. |
256 | 1964 |
Transcript showCR:'sending x: ...'. |
8 | 1965 |
p x:1. |
256 | 1966 |
Transcript showCR:'sending y: ...'. |
8 | 1967 |
p y:2. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1968 |
MessageTracer untrap:p. |
256 | 1969 |
Transcript showCR:'sending x: ...'. |
8 | 1970 |
p x:2. |
256 | 1971 |
Transcript showCR:'sending y: ...'. |
8 | 1972 |
p y:1. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1973 |
[exEnd] |
8 | 1974 |
" |
1975 |
||
1976 |
" |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1977 |
[exBegin] |
8 | 1978 |
|p| |
1979 |
||
1980 |
p := Point new copy. |
|
1981 |
MessageTracer wrap:p |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1982 |
selector:#y: |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1983 |
onEntry:[:context | self halt:'y: you are trapped'] |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1984 |
onExit:nil |
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1985 |
withOriginalClass:false. |
256 | 1986 |
Transcript showCR:'sending x: ...'. |
8 | 1987 |
p x:1. |
256 | 1988 |
Transcript showCR:'sending y: ...'. |
8 | 1989 |
p y:2. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1990 |
MessageTracer untrap:p. |
256 | 1991 |
Transcript showCR:'sending x: ...'. |
8 | 1992 |
p x:2. |
256 | 1993 |
Transcript showCR:'sending y: ...'. |
8 | 1994 |
p y:1. |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
1995 |
[exEnd] |
8 | 1996 |
" |
150
54b6185e9aa7
compile without updating changes-file (also disables historyManager for the wrap)
Claus Gittinger <cg@exept.de>
parents:
120
diff
changeset
|
1997 |
|
646 | 1998 |
"Modified: / 25.6.1996 / 22:11:21 / stefan" |
1999 |
"Modified: / 6.2.1998 / 02:48:13 / cg" |
|
660 | 2000 |
"Created: / 21.4.1998 / 15:30:27 / cg" |
8 | 2001 |
! |
2002 |
||
88 | 2003 |
wrap:anObject selectors:aCollection onEntry:entryBlock onExit:exitBlock |
2004 |
"install wrappers for anObject on all selectors from aCollection" |
|
8 | 2005 |
|
88 | 2006 |
aCollection do:[:aSelector | |
660 | 2007 |
self |
2008 |
wrap:anObject selector:aSelector |
|
2009 |
onEntry:entryBlock onExit:exitBlock |
|
2010 |
withOriginalClass:true |
|
2011 |
flushCaches:false |
|
2012 |
]. |
|
2013 |
ObjectMemory flushCaches |
|
2014 |
||
2015 |
"Modified: / 21.4.1998 / 15:40:28 / cg" |
|
8 | 2016 |
! |
2017 |
||
88 | 2018 |
wrapAll:anObject onEntry:entryBlock onExit:exitBlock |
2019 |
"install wrappers for anObject on all implemented selectors" |
|
27 | 2020 |
|
2021 |
|allSelectors| |
|
2022 |
||
2023 |
allSelectors := IdentitySet new. |
|
2024 |
anObject class withAllSuperclasses do:[:aClass | |
|
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
2025 |
aClass methodDictionary keys addAllTo:allSelectors |
27 | 2026 |
]. |
88 | 2027 |
self wrap:anObject selectors:allSelectors onEntry:entryBlock onExit:exitBlock |
309
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
2028 |
|
d2a145453677
Use methodDictionary instyead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents:
265
diff
changeset
|
2029 |
"Modified: 5.6.1996 / 14:50:07 / stefan" |
88 | 2030 |
! ! |
2031 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2032 |
!MessageTracer class methodsFor:'queries'! |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2033 |
|
579 | 2034 |
isCounting:aMethod |
2035 |
"return true if aMethod is counted" |
|
2036 |
||
2037 |
MethodCounts isNil ifTrue:[^ false]. |
|
2038 |
(MethodCounts includesKey:aMethod) ifTrue:[^ true]. |
|
2039 |
aMethod isWrapped ifTrue:[ |
|
2040 |
^ MethodCounts includesKey:aMethod originalMethod |
|
2041 |
]. |
|
2042 |
^ false |
|
2043 |
||
2044 |
"Created: 15.12.1995 / 11:07:58 / cg" |
|
2045 |
"Modified: 15.12.1995 / 15:42:10 / cg" |
|
2046 |
! |
|
2047 |
||
2048 |
isTiming:aMethod |
|
2049 |
"return true if aMethod is timed" |
|
2050 |
||
2051 |
MethodTiming isNil ifTrue:[^ false]. |
|
2052 |
(MethodTiming includesKey:aMethod) ifTrue:[^ true]. |
|
2053 |
aMethod isWrapped ifTrue:[ |
|
2054 |
^ MethodTiming includesKey:aMethod originalMethod |
|
2055 |
]. |
|
2056 |
^ false |
|
2057 |
||
2058 |
"Modified: 15.12.1995 / 15:42:10 / cg" |
|
2059 |
"Created: 17.6.1996 / 17:04:29 / cg" |
|
2060 |
! |
|
2061 |
||
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2062 |
isTrapped:aMethod |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2063 |
"return true, if a breakpoint is set on aMethod. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2064 |
This only returns true for standard breakpoints (i.e. for user-wraps, |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2065 |
this returns false)" |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2066 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2067 |
aMethod isWrapped ifFalse:[^ false]. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2068 |
^ aMethod basicLiterals includesIdentical:LeaveBreakBlock |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2069 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2070 |
" |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2071 |
MessageTracer trapMethod:(Collection compiledMethodAt:#select:). |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2072 |
Transcript showCR:(Collection compiledMethodAt:#select:) isWrapped. |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2073 |
Transcript showCR:(MessageTracer isTrapped:(Collection compiledMethodAt:#select:)). |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2074 |
MessageTracer unwrapMethod:(Collection compiledMethodAt:#select:). |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2075 |
" |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2076 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2077 |
"Modified: 22.10.1996 / 17:40:37 / cg" |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2078 |
! ! |
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2079 |
|
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2080 |
!MessageTracer class methodsFor:'trace helpers'! |
88 | 2081 |
|
2082 |
printEntryFull:aContext |
|
2083 |
self printEntryFull:aContext level:0 |
|
2084 |
! |
|
27 | 2085 |
|
88 | 2086 |
printEntryFull:aContext level:lvl |
555
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2087 |
|sender| |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2088 |
|
88 | 2089 |
(String new:lvl) errorPrint. |
2090 |
'enter ' errorPrint. |
|
2091 |
aContext methodClass name errorPrint. |
|
2092 |
' ' errorPrint. |
|
2093 |
aContext selector errorPrint. |
|
2094 |
' rcvr=' errorPrint. |
|
2095 |
aContext receiver "printString" errorPrint. |
|
2096 |
' args=' errorPrint. |
|
2097 |
(aContext args) "printString" errorPrint. |
|
555
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2098 |
' from:' errorPrint. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2099 |
sender := aContext sender. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2100 |
sender notNil ifTrue:[ |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2101 |
(sender selector startsWith:'perform:') ifTrue:[ |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2102 |
sender := sender sender. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2103 |
]. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2104 |
]. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2105 |
sender errorPrintCR. |
538
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
2106 |
|
555
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2107 |
"Modified: 5.3.1997 / 12:40:55 / cg" |
88 | 2108 |
! |
27 | 2109 |
|
88 | 2110 |
printEntrySender:aContext |
555
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2111 |
|sender| |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2112 |
|
88 | 2113 |
aContext methodClass name errorPrint. |
2114 |
' ' errorPrint. aContext selector errorPrint. |
|
2115 |
' from ' errorPrint. |
|
538
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
2116 |
|
555
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2117 |
sender := aContext sender. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2118 |
sender notNil ifTrue:[ |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2119 |
(sender selector startsWith:'perform:') ifTrue:[ |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2120 |
sender := sender sender. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2121 |
]. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2122 |
]. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2123 |
sender errorPrintCR. |
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2124 |
|
c92d12af9f1e
in trace: if sender is Object>>perform, print senders sender.
Claus Gittinger <cg@exept.de>
parents:
538
diff
changeset
|
2125 |
"Modified: 5.3.1997 / 12:40:42 / cg" |
88 | 2126 |
! |
2127 |
||
2128 |
printExit:aContext with:retVal |
|
2129 |
self printExit:aContext with:retVal level:0 |
|
27 | 2130 |
! |
2131 |
||
88 | 2132 |
printExit:aContext with:retVal level:lvl |
2133 |
(String new:lvl) errorPrint. |
|
2134 |
'leave ' errorPrint. |
|
2135 |
aContext methodClass name errorPrint. |
|
2136 |
' ' errorPrint. |
|
2137 |
aContext selector errorPrint. |
|
2138 |
' rcvr=' errorPrint. |
|
2139 |
aContext receiver "printString" errorPrint. |
|
538
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
2140 |
' return:' errorPrint. retVal "printString" errorPrintCR. |
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
2141 |
|
5961061365d9
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
536
diff
changeset
|
2142 |
"Modified: 10.1.1997 / 17:54:44 / cg" |
88 | 2143 |
! ! |
13 | 2144 |
|
88 | 2145 |
!MessageTracer methodsFor:'trace helpers '! |
2146 |
||
2147 |
stepInterrupt |
|
2148 |
"called for every send while tracing" |
|
13 | 2149 |
|
88 | 2150 |
|con| |
13 | 2151 |
|
88 | 2152 |
StepInterruptPending := nil. |
2153 |
con := thisContext sender. |
|
2154 |
con lineNumber == 1 ifTrue:[ |
|
265 | 2155 |
traceDetail == true ifTrue:[ |
2156 |
self class printEntryFull:con. |
|
2157 |
] ifFalse:[ |
|
2158 |
con printCR. |
|
2159 |
] |
|
88 | 2160 |
]. |
2161 |
ObjectMemory flushInlineCaches. |
|
2162 |
StepInterruptPending := 1. |
|
2163 |
InterruptPending := 1. |
|
2164 |
^ self |
|
265 | 2165 |
|
2166 |
"Modified: 20.5.1996 / 10:28:20 / cg" |
|
13 | 2167 |
! |
2168 |
||
88 | 2169 |
trace:aBlock detail:fullDetail |
2170 |
"trace execution of aBlock." |
|
2171 |
||
2172 |
traceDetail := fullDetail. |
|
2173 |
ObjectMemory stepInterruptHandler:self. |
|
2174 |
^ [ |
|
2175 |
ObjectMemory flushInlineCaches. |
|
2176 |
StepInterruptPending := 1. |
|
2177 |
InterruptPending := 1. |
|
2178 |
aBlock value |
|
2179 |
] valueNowOrOnUnwindDo:[ |
|
2180 |
StepInterruptPending := nil. |
|
2181 |
ObjectMemory stepInterruptHandler:nil. |
|
11 | 2182 |
] |
2183 |
||
2184 |
" |
|
88 | 2185 |
MessageTracer trace:[#(6 5 4 3 2 1) sort] detail:false |
2186 |
MessageTracer trace:[#(6 5 4 3 2 1) sort] detail:true |
|
8 | 2187 |
" |
2188 |
! ! |
|
27 | 2189 |
|
503
67f6584e0f9f
use different leaveBlocks for break & trace
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
2190 |
!MessageTracer class methodsFor:'documentation'! |
98 | 2191 |
|
2192 |
version |
|
663 | 2193 |
^ '$Header: /cvs/stx/stx/libbasic3/MessageTracer.st,v 1.61 1998-04-22 17:40:38 cg Exp $' |
98 | 2194 |
! ! |
27 | 2195 |
MessageTracer initialize! |