'From Squeak5.3alpha of 18 October 2019 [latest update: #19133] on 23 October 2019 at 1:43:28 pm'! !Debugger methodsFor: 'context stack - message list' stamp: 'mt 10/16/2019 12:43'! contextStackColumns "Answer the array of contexts." | first second | first := OrderedCollection new. second := OrderedCollection new. contextStackList do: [:label | | pos | pos := label findString: '>>'. first add: (label copyFrom: 1 to: pos-1). second add: (label copyFrom: pos+2 to: label size)]. ^ { first. second}! ! !Debugger methodsFor: 'context stack - message list' stamp: 'mt 10/16/2019 12:44'! expandNotifierStack "Show a small amount of stack in the context pane. Useful for notifiers." self okToChange ifFalse: [^ self]. self newStack: (self contextStackTop stackOfSize: self class notifierStackSize). self changed: #contextStackColumns. ! ! !Debugger methodsFor: 'context stack - message list' stamp: 'mt 10/16/2019 12:44'! expandStack "Show a substantial amount of stack in the context pane." self okToChange ifFalse: [^ self]. self newStack: (self contextStackTop stackOfSize: self class fullStackSize). self changed: #contextStackColumns. ! ! !Debugger methodsFor: 'context stack - message list' stamp: 'mt 10/16/2019 12:44'! fullyExpandStack "Expand the stack to include all of it. Well, almost all of it, we better maintain sane limits too." self okToChange ifFalse: [^ self]. self newStack: (self contextStackTop stackOfSize: self class stackSizeLimit - contextStack size). self changed: #contextStackColumns.! ! !Debugger methodsFor: 'context stack - message list' stamp: 'mt 10/16/2019 12:46'! messageIconAt: anIndex column: columnIndex columnIndex = 2 ifFalse: [^ nil]. Browser showMessageIcons ifFalse: [^ nil]. ^ ToolIcons iconNamed: (ToolIcons iconForClass: (contextStack at: anIndex) method methodClass selector: (contextStack at: anIndex) method selector)! ! !Debugger methodsFor: 'toolbuilder' stamp: 'mt 10/23/2019 13:37'! buildFullWith: builder | windowSpec listSpec textSpec | windowSpec := builder pluggableWindowSpec new model: self; label: 'Debugger'; children: OrderedCollection new. listSpec := builder pluggableMultiColumnListSpec new. listSpec model: self; list: #contextStackColumns; itemPaddings: {0. 3@0}; itemAlignments: #(right left); columnResizings: #(spaceFill); columnSpaceFillWeights: #(1 1.75); getIndex: #contextStackIndex; setIndex: #toggleContextStackIndex:; menu: #contextStackMenu:shifted:; icon: #messageIconAt:column:; helpItem: #messageHelpAt:; keyPress: #contextStackKey:from:; frame: (0@0 corner: 1@0.22). windowSpec children add: listSpec. textSpec := self buildCodePaneWith: builder. textSpec frame: (0@0.22corner: 1@0.8). windowSpec children add: textSpec. listSpec := self receiverInspector buildFieldListWith: builder. listSpec frame: (0@0.8 corner: 0.2@1); help: 'Receiver''s\Instance\Variables' withCRs. windowSpec children add: listSpec. textSpec := self receiverInspector buildValuePaneWith: builder. textSpec help: '<- Select receiver''s field' translated; frame: (0.2@0.8 corner: 0.5@1). windowSpec children add: textSpec. listSpec := self contextVariablesInspector buildFieldListWith: builder. listSpec frame: (0.5@0.8 corner: 0.7@1); help: 'Other\Context\Bindings' withCRs. windowSpec children add: listSpec. textSpec := self contextVariablesInspector buildValuePaneWith: builder. textSpec help: '<- Select context''s field' translated; frame: (0.7@0.8 corner: 1@1). windowSpec children add: textSpec. ^builder build: windowSpec! ! !Debugger methodsFor: 'toolbuilder' stamp: 'mt 10/23/2019 13:36'! buildNotifierWith: builder label: label message: messageString | windowSpec listSpec textSpec panelSpec quads | windowSpec := builder pluggableWindowSpec new model: self; extent: self initialExtentForNotifier; label: label; children: OrderedCollection new. panelSpec := builder pluggablePanelSpec new. panelSpec children: OrderedCollection new. quads := self preDebugButtonQuads. (self interruptedContext selector == #doesNotUnderstand:) ifTrue: [ quads := quads copyWith: { 'Create'. #createMethod. #magenta. 'create the missing method' } ]. (#(#notYetImplemented #shouldBeImplemented #requirement) includes: self interruptedContext selector) ifTrue: [ quads := quads copyWith: { 'Create'. #createImplementingMethod. #magenta. 'implement the marked method' } ]. (self interruptedContext selector == #subclassResponsibility) ifTrue: [ quads := quads copyWith: { 'Create'. #createOverridingMethod. #magenta. 'create the missing overriding method' } ]. quads do:[:spec| | buttonSpec | buttonSpec := builder pluggableButtonSpec new. buttonSpec model: self. buttonSpec label: spec first. buttonSpec action: spec second. buttonSpec help: spec fourth. spec size >= 5 ifTrue: [buttonSpec enabled: spec fifth]. panelSpec children add: buttonSpec. ]. panelSpec layout: #horizontal. "buttons" panelSpec frame: self preDebugButtonQuadFrame. windowSpec children add: panelSpec. Preferences eToyFriendly | messageString notNil ifFalse:[ listSpec := builder pluggableMultiColumnListSpec new. listSpec model: self; list: #contextStackColumns; itemPaddings: {0. 3@0}; itemAlignments: #(right left); columnResizings: #(spaceFill); columnSpaceFillWeights: #(1 1.75); getIndex: #contextStackIndex; setIndex: #debugAt:; icon: #messageIconAt:column:; helpItem: #messageHelpAt:; frame: self contextStackFrame. windowSpec children add: listSpec. ] ifTrue:[ message := messageString. textSpec := builder pluggableTextSpec new. textSpec model: self; getText: #preDebugMessageString; setText: nil; selection: nil; menu: #debugProceedMenu:; frame: self contextStackFrame. windowSpec children add: textSpec. ]. ^windowSpec! ! !Debugger methodsFor: 'private' stamp: 'mt 10/16/2019 12:44'! resetContext: aContext changeContents: aBoolean "Used when a new context becomes top-of-stack, for instance when the method of the selected context is re-compiled, or the simulator steps or returns to a new method. There is room for much optimization here, first to save recomputing the whole stack list (and text), and secondly to avoid recomposing all that text (by editing the paragraph instead of recreating it)." | oldContext | oldContext := self selectedContext. self newStack: (aContext ifNil: [oldContext]) contextStack. self changed: #contextStackColumns; changed: #interruptedProcessIsActive. self contextStackIndex: 1 oldContextWas: oldContext. aBoolean ifTrue: [self contentsChanged]. ! !