I suspect this is due to latest updates to debugger & compiler etc,
brought by Eliot. To display a context variable 'contents', a message #contents is sent to ContextVariableInspector. The problem is, that in TextMorphForEditView>>newContents: which sends this message to model (which is a ContextVariableInspector) expects that returned value is text, or string at least. While at some point, this is not always true, and inspection of different context slots in debugger could lead to interesting results, where #contents returns an actual object, which does not implements #asText , and as result i often get an DNU: SmallInteger>>asText or similar. The root of evil, i think, is in ContextVariableInspector>>toggleIndex: method, in following code: self contentsIsString ifTrue: [contents := self selection] ifFalse: [contents := self selectionPrintString]]. which sometimes returns an actual object (self selection) instead of (self selectionPrintString). I don't really understand, what exactly tests the #contentsIsString method: contentsIsString "Hacked so contents empty when deselected" ^ #(0 2 3) includes: selectionIndex maybe a proper fix would be to test additionally, that selection is string, and if not, then return false, so caller will use #selectionPrintString later. -- Best regards, Igor Stasenko AKA sig. |
On Thu, Oct 15, 2009 at 1:02 PM, Igor Stasenko <[hidden email]> wrote: I suspect this is due to latest updates to debugger & compiler etc, This defines which indices in the context inspector answer meta-values rather than actual slot contents. Open up a debugger on the activation of a method with args and/or temps and you'll see
thisContext stack top all temp vars
textOrStream aContext receiver
aRequestor failBlock logFlag
methodNode method value
toLog itsSelection itsSelectionString
thisContext is an object, but "stack top" and "all temp vars" are strings computed by ContextvariablesInspector>>selection. i.e. selection "Refer to the comment in Inspector|selection."
selectionIndex = 0 ifTrue:[^'']. selectionIndex = 1 ifTrue: [^object].
selectionIndex = 2 ifTrue: [^object stackPtr > 0 ifTrue: [object top]]. selectionIndex = 3 ifTrue: [^object tempsAndValues].
^object debuggerMap namedTempAt: selectionIndex - 3 in: object So the meta values at index 0 (unselected null string), 2 & 3 shouldn't be sent printString, otherwise e.g. an unselected CVI would show '' (the printString of ByteString new) instead of nothing.
The right thing is to ensure thatContextvariablesInspector contentsIsString fieldList replaceSelectionValue: & selection all agree. I think I added "stack top" to the list. I may have forgotten to integrate the changes for one or more of these which in my image are (also attached):
!ContextVariablesInspector methodsFor: 'accessing' stamp: 'eem 5/21/2008 12:31'! fieldList "Refer to the comment in Inspector|fieldList."
object == nil ifTrue: [^Array with: 'thisContext']. ^fieldList ifNil:[fieldList := (Array with: 'thisContext' with: 'stack top' with: 'all temp vars') , object tempNames]! !
!ContextVariablesInspector methodsFor: 'selecting' stamp: 'eem 3/6/2009 10:05'! contentsIsString ^ #(0 3) includes: selectionIndex! !
!ContextVariablesInspector methodsFor: 'selecting' stamp: 'eem 7/18/2008 11:18'! replaceSelectionValue: anObject "Refer to the comment in Inspector|replaceSelectionValue:."
^selectionIndex = 1 ifTrue: [object] ifFalse: [object namedTempAt: selectionIndex - 3 put: anObject]! !
!ContextVariablesInspector methodsFor: 'selecting' stamp: 'eem 6/10/2008 09:37'! selection "Refer to the comment in Inspector|selection."
selectionIndex = 0 ifTrue:[^'']. selectionIndex = 1 ifTrue: [^object].
selectionIndex = 2 ifTrue: [^object stackPtr > 0 ifTrue: [object top]]. selectionIndex = 3 ifTrue: [^object tempsAndValues].
^object debuggerMap namedTempAt: selectionIndex - 3 in: object! !
ContextVariablesInspector.st (3K) Download Attachment |
Free forum by Nabble | Edit this page |