Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.893.mcz ==================== Summary ==================== Name: Tools-mt.893 Author: mt Time: 24 September 2019, 5:16:51.52786 pm UUID: 40c3d300-00ba-854f-b33f-042b711bc73c Ancestors: Tools-mt.892 More fixes and code clean-up in debugger: - make stack sizes a preference(s) - move code to specific (Morphic/MVC) subclasses =============== Diff against Tools-mt.892 =============== Item was changed: CodeHolder subclass: #Debugger instanceVariableNames: 'interruptedProcess contextStack contextStackIndex contextStackList receiverInspector contextVariablesInspector externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject labelString message untilExpression' + classVariableNames: 'ContextStackKeystrokes ErrorRecursion ErrorRecursionGuard ErrorReportServer FullStackSize InterruptUIProcessIfBlockedOnErrorInBackgroundProcess NotifierStackSize SavedExtent StackSizeLimit WantsAnnotationPane' - classVariableNames: 'ContextStackKeystrokes ErrorRecursion ErrorRecursionGuard ErrorReportServer InterruptUIProcessIfBlockedOnErrorInBackgroundProcess SavedExtent WantsAnnotationPane' 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 class>>fullStackSize (in category 'preferences') ----- + fullStackSize + + <preference: 'Stack Size in Full Debugger' + categoryList: #(debug tools) + description: 'The number of stack frames to be shown in the full debugger. You can always expand the full stack there.' + type: #Number> + + ^ FullStackSize ifNil: [20]! Item was added: + ----- Method: Debugger class>>fullStackSize: (in category 'preferences') ----- + fullStackSize: aNumber + + FullStackSize := aNumber max: self notifierStackSize.! Item was added: + ----- Method: Debugger class>>lowSpaceChoices (in category 'private') ----- + lowSpaceChoices + "Return a notifier message string to be presented when space is running low." + + ^ 'Warning!! Squeak is almost out of memory!! + + Low space detection is now disabled. It will be restored when you close or proceed from this error notifier. Don''t panic, but do proceed with caution. + + Here are some suggestions: + + If you suspect an infinite recursion (the same methods calling each other again and again), then close this debugger, and fix the problem. + + If you want this computation to finish, then make more space available (read on) and choose "proceed" in this debugger. Here are some ways to make more space available... + > Close any windows that are not needed. + > Get rid of some large objects (e.g., images). + > Leave this window on the screen, choose "save as..." from the screen menu, quit, restart the Squeak VM with a larger memory allocation, then restart the image you just saved, and choose "proceed" in this window. + + If you want to investigate further, choose "debug" in this window. Do not use the debugger "fullStack" command unless you are certain that the stack is not very deep. (Trying to show the full stack will definitely use up all remaining memory if the low-space problem is caused by an infinite recursion!!). + + ' + ! Item was added: + ----- Method: Debugger class>>notifierStackSize (in category 'preferences') ----- + notifierStackSize + + <preference: 'Stack Size in Notifier Debugger' + categoryList: #(debug tools) + description: 'If there is no message to be displayed in the notifier, how many stack frames should be visible?' + type: #Number> + + ^ NotifierStackSize ifNil: [10]! Item was added: + ----- Method: Debugger class>>notifierStackSize: (in category 'preferences') ----- + notifierStackSize: anInteger + + NotifierStackSize := anInteger.! Item was added: + ----- Method: Debugger class>>stackSizeLimit (in category 'preferences') ----- + stackSizeLimit + + <preference: 'Stack Size Limit' + categoryList: #(debug tools) + description: 'Even when expanding the entire stack, there should be a limit to avoid low-space errors.' + type: #Number> + + ^ StackSizeLimit ifNil: [100000]! Item was added: + ----- Method: Debugger class>>stackSizeLimit: (in category 'preferences') ----- + stackSizeLimit: aNumber + + StackSizeLimit := aNumber max: self fullStackSize.! Item was changed: ----- Method: Debugger>>abandon: (in category 'context stack menu') ----- abandon: aTopView "abandon the notifier represented by aTopView" + + self subclassResponsibility.! - ToolBuilder default close: aTopView! Item was removed: - ----- Method: Debugger>>close: (in category 'context stack menu') ----- - close: aScheduledController - "The argument is a controller on a view of the receiver. - That view is closed." - - aScheduledController close - ! Item was changed: ----- Method: Debugger>>debug (in category 'notifier menu') ----- debug + "Open a full debugger." + + self openFullFromNotifier: self topView. - "Open a full DebuggerView." - | topView | - topView := self topView. - topView model: nil. "so close won't release me." - self breakDependents. - self openFullNoSuspendFrom: topView. ! Item was changed: ----- Method: Debugger>>debugAt: (in category 'initialize') ----- debugAt: anInteger + "Opens a full debugger with the given index selected. See #initializeFull to understand why contextStackIndex is set directly." + + contextStackIndex := anInteger. + ^ self debug! - self toggleContextStackIndex: anInteger. - ^ self debug.! Item was added: + ----- Method: Debugger>>expandNotifierStack (in category 'context stack (message list)') ----- + 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: #contextStackList. + ! Item was changed: ----- Method: Debugger>>expandStack (in category 'context stack (message list)') ----- expandStack + "Show a substantial amount of stack in the context pane." - "A Notifier is being turned into a full debugger. Show a substantial amount of stack in the context pane." + self okToChange ifFalse: [^ self]. + self newStack: (self contextStackTop stackOfSize: self class fullStackSize). + self changed: #contextStackList. + ! - self newStack: (self 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. Well, almost all of it, we better maintain sane limits too." - "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: self class stackSizeLimit - contextStack size). + self changed: #contextStackList.! - self newStack: (self contextStackTop stackOfSize: contextStack size + 100000). - self changed: #contextStackList! Item was changed: ----- Method: Debugger>>initialize (in category 'initialize') ----- initialize super initialize. Smalltalk at: #MessageTally ifPresentAndInMemory: [ :tally | tally terminateTimerProcess]. externalInterrupt := false. + selectingPC := true. + + contextStackIndex := 0.! - selectingPC := true.! Item was added: + ----- Method: Debugger>>initializeFull (in category 'initialize') ----- + initializeFull + "Expand the stack for the full debugger. Create inspectors." + + | oldIndex | + oldIndex := contextStackIndex. + contextStackIndex := 0. + + self expandStack. + + receiverInspector := Inspector inspect: nil. + contextVariablesInspector := ContextVariablesInspector inspect: nil. + + self toggleContextStackIndex: oldIndex.! Item was removed: - ----- Method: Debugger>>lowSpaceChoices (in category 'private') ----- - lowSpaceChoices - "Return a notifier message string to be presented when space is running low." - - ^ 'Warning!! Squeak is almost out of memory!! - - Low space detection is now disabled. It will be restored when you close or proceed from this error notifier. Don''t panic, but do proceed with caution. - - Here are some suggestions: - - If you suspect an infinite recursion (the same methods calling each other again and again), then close this debugger, and fix the problem. - - If you want this computation to finish, then make more space available (read on) and choose "proceed" in this debugger. Here are some ways to make more space available... - > Close any windows that are not needed. - > Get rid of some large objects (e.g., images). - > Leave this window on the screen, choose "save as..." from the screen menu, quit, restart the Squeak VM with a larger memory allocation, then restart the image you just saved, and choose "proceed" in this window. - - If you want to investigate further, choose "debug" in this window. Do not use the debugger "fullStack" command unless you are certain that the stack is not very deep. (Trying to show the full stack will definitely use up all remaining memory if the low-space problem is caused by an infinite recursion!!). - - ' - ! Item was added: + ----- Method: Debugger>>openFullFromNotifier: (in category 'initialize') ----- + openFullFromNotifier: topView + "Create a full debugger with the given label. Subclasses should complete this procedure." + + self initializeFull. + + topView model: nil. "so close won't release me." + self breakDependents.! Item was removed: - ----- Method: Debugger>>openFullNoSuspendFrom: (in category 'initialize') ----- - openFullNoSuspendFrom: topView - "Create, schedule and answer a full debugger with the given label. Do not terminate the current active process." - - | oldContextStackIndex | - oldContextStackIndex := contextStackIndex. - self expandStack. "Sets contextStackIndex to zero." - ^[ToolBuilder default openDebugger: self label: topView label closing: topView] ensure: - [self toggleContextStackIndex: oldContextStackIndex]! Item was changed: ----- Method: Debugger>>openFullNoSuspendLabel: (in category 'initialize') ----- openFullNoSuspendLabel: aString + "Create, schedule and answer a full debugger with the given label. Subclasses should complete this procedure." - "Create, schedule and answer a full debugger with the given label. Do not terminate the current active process." + self initializeFull.! - | oldContextStackIndex | - oldContextStackIndex := contextStackIndex. - self expandStack. "Sets contextStackIndex to zero." - ^[ToolBuilder default openDebugger: self label: aString] ensure: - [self toggleContextStackIndex: oldContextStackIndex]! Item was removed: - ----- Method: Debugger>>openNotifierContents:label: (in category 'initialize') ----- - openNotifierContents: msgString label: label - "Create, schedule and answer a notifier view with the given label and message. A notifier view shows just the message or the first several lines of the stack, with a menu that allows the user to open a full debugger if so desired." - "NOTE: When this method returns, a new process has been scheduled to run the windows, and thus this notifier, but the previous active process has not been suspended. The sender will do this." - | msg builder spec | - - Sensor flushKeyboard. - savedCursor := Cursor currentCursor. - Cursor currentCursor: Cursor normal. - msg := (label beginsWith: 'Space is low') - ifTrue: [self lowSpaceChoices, (msgString ifNil: [String empty])] - ifFalse: [msgString]. - builder := ToolBuilder default. - spec := self buildNotifierWith: builder label: label message: msg. - self expandStack. - ^ builder openDebugger: spec! Item was added: + ----- Method: Debugger>>openNotifierNoSuspendContents:label: (in category 'initialize') ----- + openNotifierNoSuspendContents: msgString label: label + "Create, schedule and answer a notifier view with the given label and message. A notifier view shows just the message or the first several lines of the stack, with a menu that allows the user to open a full debugger if so desired." + "NOTE: When this method returns, a new process has been scheduled to run the windows, and thus this notifier, but the previous active process has not been suspended. The sender will do this." + + Sensor flushKeyboard. + savedCursor := Cursor currentCursor. + Cursor currentCursor: Cursor normal. + + self expandNotifierStack.! Item was removed: - ----- Method: Debugger>>release (in category 'initialize') ----- - release - - self windowIsClosing. - super release. - ! |
Does this create the inspectors of the debugger later? I got a "does not understand
#selectedSlotName" on the contextVariablesInspector when I used the "Create" button in the notifier for a subclassResponsibility: Am Di., 24. Sept. 2019 um 17:17 Uhr schrieb <[hidden email]>: Marcel Taeumel uploaded a new version of Tools to project The Trunk: |
It does. Let me check that. Best, Marcel
|
Works again in Tools-mt.894. Best, Marcel
|
Free forum by Nabble | Edit this page |