'From Squeak3.7alpha of ''11 September 2003'' [latest update: #5501] on 4 November 2003 at 9:20:47 pm'! "Change Set: dpsTrace Date: 4 November 2003 Author: Trygve Reenskaug I use these methods a lot for exploring other people's code and for debugging my own. The methods are easy to use and remind me where I put trace commands. They can also show the stack, which tells me where a certain message came from. There are three new methods to be added in Object. They do the following: execute: nil dpsTrace: 'sludder'. Transcript shows class name/method name (obj asString or printString) e.g., MethodContext/DoIt (sludder) execute: nil dpsTrace: 'hello' levels: 5. Transcript shows the trace message and the stack: 1: MethodContext/DoIt (hello) 2: Compiler/evaluate:in:to:notifying:ifFail: 3: TextMorphEditor/evaluateSelection 4: BlockContext/on:do: 5: TextMorphEditor/evaluateSelection The third form is: dpsTrace: reportObject levels: anInt withContext: currentContext This is the general form, rarely used directly. Enjoy --Trygve"! !Object methodsFor: 'error handling' stamp: 'TRee 11/4/2003 16:47'! dpsTrace: reportObject Transcript myDependents isNil ifTrue: [^self]. self dpsTrace: reportObject levels: 1 withContext: thisContext " nil dpsTrace: 'sludder'. "! ! !Object methodsFor: 'error handling' stamp: 'TRee 11/4/2003 16:49'! dpsTrace: reportObject levels: anInt self dpsTrace: reportObject levels: anInt withContext: thisContext "(1 to: 3) do: [:int | nil dpsTrace: int levels: 5.]"! ! !Object methodsFor: 'error handling' stamp: 'TRee 11/4/2003 17:02'! dpsTrace: reportObject levels: anInt withContext: currentContext | reportString context displayCount | reportString := (reportObject respondsTo: #asString) ifTrue: [reportObject asString] ifFalse: [reportObject printString]. (Smalltalk at: #Decompiler ifAbsent: [nil]) ifNil: [Transcript cr; show: reportString] ifNotNil: [context := currentContext. displayCount := anInt > 1. 1 to: anInt do: [:count | Transcript cr. displayCount ifTrue: [Transcript show: count printString, ': ']. reportString notNil ifTrue: [Transcript show: context home class name , '/' , context sender selector, ' (' , reportString , ')'. context := context sender. reportString := nil] ifFalse: [(context notNil and: [(context := context sender) notNil]) ifTrue: [Transcript show: context receiver class name , '/' , context selector]]]. "Transcript cr"].! ! "Postscript:" !