[squeak-dev] The Inbox: Tools-fbs.285.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Dec 11 14:24:40 UTC 2010
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-fbs.285.mcz
==================== Summary ====================
Name: Tools-fbs.285
Author: fbs
Time: 10 December 2010, 10:41:45.634 pm
UUID: c4b539b4-2c40-e648-b2f2-e358514de1d0
Ancestors: Tools-ul.282
Remove the contextStackTop instvar, replacing its calls with an indirection through "self contextStackTop", which just calls the top/first element of contextStack.
=============== Diff against Tools-ul.282 ===============
Item was changed:
CodeHolder subclass: #Debugger
+ instanceVariableNames: 'interruptedProcess interruptedController contextStack contextStackIndex contextStackList receiverInspector contextVariablesInspector externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject errorWasInUIProcess labelString message'
- instanceVariableNames: 'interruptedProcess interruptedController contextStack contextStackTop contextStackIndex contextStackList receiverInspector contextVariablesInspector externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject errorWasInUIProcess labelString message'
classVariableNames: 'ContextStackKeystrokes ErrorRecursion InterruptUIProcessIfBlockedOnErrorInBackgroundProcess'
poolDictionaries: ''
category: 'Tools-Debugger'!
!Debugger commentStamp: '<historical>' prior: 0!
I represent the machine state at the time of an interrupted process. I also represent a query path into the state of the process. The debugger is typically viewed through a window that views the stack of suspended contexts, the code for, and execution point in, the currently selected message, and inspectors on both the receiver of the currently selected message, and the variables in the current context.
Special note on recursive errors:
Some errors affect Squeak's ability to present a debugger. This is normally an unrecoverable situation. However, if such an error occurs in an isolation layer, Squeak will attempt to exit from the isolation layer and then present a debugger. Here is the chain of events in such a recovery.
* A recursive error is detected.
* The current project is queried for an isolationHead
* Changes in the isolationHead are revoked
* The parent project of isolated project is returned to
* The debugger is opened there and execution resumes.
If the user closes that debugger, execution continues in the outer project and layer. If, after repairing some damage, the user proceeds from the debugger, then the isolationHead is re-invoked, the failed project is re-entered, and execution resumes in that world. !
Item was added:
+ ----- Method: Debugger>>contextStackTop (in category 'accessing') -----
+ contextStackTop
+ ^ contextStack first.!
Item was changed:
----- Method: Debugger>>createMethod (in category 'private') -----
createMethod
"Should only be called when this Debugger was created in response to a
MessageNotUnderstood exception. Create a stub for the method that was
missing and proceed into it."
| msg chosenClass |
+ msg := self contextStackTop tempAt: 1.
- msg := contextStackTop tempAt: 1.
chosenClass := self
+ askForSuperclassOf: self contextStackTop receiver class
- askForSuperclassOf: contextStackTop receiver class
toImplement: msg selector
ifCancel: [^self].
self implement: msg inClass: chosenClass.
!
Item was changed:
----- Method: Debugger>>expandStack (in category 'context stack (message list)') -----
expandStack
"A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane."
+ self newStack: (self contextStackTop stackOfSize: 20).
- self newStack: (contextStackTop stackOfSize: 20).
contextStackIndex := 0.
receiverInspector := Inspector inspect: nil.
contextVariablesInspector := ContextVariablesInspector inspect: nil.
proceedValue := nil!
Item was changed:
----- Method: Debugger>>fullyExpandStack (in category 'context stack (message list)') -----
fullyExpandStack
"Expand the stack to include all of it, rather than the first four or five contexts.
Well, almost all of it, we better maintain sane limits too."
self okToChange ifFalse: [^ self].
+ self newStack: (self contextStackTop stackOfSize: contextStack size + 100000).
- self newStack: (contextStackTop stackOfSize: contextStack size + 100000).
self changed: #contextStackList!
Item was changed:
----- Method: Debugger>>interruptedContext (in category 'accessing') -----
interruptedContext
"Answer the suspended context of the interrupted process."
+ ^self contextStackTop.!
- ^contextStackTop!
Item was changed:
----- Method: Debugger>>process:controller:context: (in category 'private') -----
process: aProcess controller: aController context: aContext
super initialize.
Smalltalk at: #MessageTally ifPresentAndInMemory: [ :tally |
tally terminateTimerProcess].
contents := nil.
interruptedProcess := aProcess.
interruptedController := aController.
+ self newStack: (aContext stackOfSize: 1).
- contextStackTop := aContext.
- self newStack: (contextStackTop stackOfSize: 1).
contextStackIndex := 1.
externalInterrupt := false.
selectingPC := true.
Smalltalk isMorphic ifTrue:
[errorWasInUIProcess := false]!
Item was changed:
----- Method: Debugger>>resetContext: (in category 'private') -----
resetContext: aContext
"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 contextStack.
- contextStackTop := aContext.
- self newStack: contextStackTop contextStack.
self changed: #contextStackList.
self contextStackIndex: 1 oldContextWas: oldContext.
self contentsChanged.
!
Item was changed:
----- Method: Debugger>>selectedContext (in category 'private') -----
selectedContext
contextStackIndex = 0
+ ifTrue: [^contextStack first]
- ifTrue: [^contextStackTop]
ifFalse: [^contextStack at: contextStackIndex]!
Item was changed:
----- Method: Debugger>>storeLog (in category 'notifier menu') -----
storeLog
| logFileName |
logFileName := Preferences debugLogTimestamp
ifTrue: ['SqueakDebug-' , Time totalSeconds printString , '.log']
ifFalse: ['SqueakDebug.log'].
+ Smalltalk logError: labelString printString inContext: self contextStackTop to: logFileName
- Smalltalk logError: labelString printString inContext: contextStackTop to: logFileName
!
Item was changed:
----- Method: Debugger>>windowIsClosing (in category 'initialize') -----
windowIsClosing
"My window is being closed; clean up. Restart the low space watcher."
interruptedProcess == nil ifTrue: [^ self].
interruptedProcess terminate.
interruptedProcess := nil.
interruptedController := nil.
contextStack := nil.
- contextStackTop := nil.
receiverInspector := nil.
contextVariablesInspector := nil.
Smalltalk installLowSpaceWatcher. "restart low space handler"
!
More information about the Squeak-dev
mailing list
|