[squeak-dev] The Trunk: Tools-mt.921.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 29 10:42:52 UTC 2019


Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.921.mcz

==================== Summary ====================

Name: Tools-mt.921
Author: mt
Time: 29 November 2019, 11:42:49.542061 am
UUID: 73dad5fb-bcd1-f742-ab5b-e29d165d6d63
Ancestors: Tools-mt.920

Debugger: Implements the idea of inbox Tools-eem.915, which preserves inspectors' states when toggling the selected context.

Because it is model-only, should work also in MVC debuggers. There might be a quick with #update:with: in PluggableTextView, though.

=============== Diff against Tools-mt.920 ===============

Item was changed:
  CodeHolder subclass: #Debugger
+ 	instanceVariableNames: 'interruptedProcess contextStack contextStackIndex contextStackList receiverInspector receiverInspectorState contextVariablesInspector contextVariablesInspectorState externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject labelString message untilExpression'
- 	instanceVariableNames: 'interruptedProcess contextStack contextStackIndex contextStackList receiverInspector contextVariablesInspector externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject labelString message untilExpression'
  	classVariableNames: 'ContextStackKeystrokes ErrorReportServer FullStackSize InterruptUIProcessIfBlockedOnErrorInBackgroundProcess NotifierStackSize SavedExtent StackSizeLimit 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 changed:
  ----- Method: Debugger>>contextStackIndex:oldContextWas: (in category 'private') -----
  contextStackIndex: anInteger oldContextWas: oldContext 
  	"Change the context stack index to anInteger, perhaps in response to user selection."
  
+ 	| isNewMethod selectedContextSlotName |
+ 	self saveReceiverInspectorState.
+ 	self saveContextVariablesInspectorState.
- 	| isNewMethod selectedContextSlotName index |
  	contextStackIndex := anInteger.
  	anInteger = 0 ifTrue:
  		[currentCompiledMethod := contents := nil.
  		 self changed: #contextStackIndex.
  		 self decorateButtons.
  		 self contentsChanged.
  		 contextVariablesInspector object: nil.
  		 receiverInspector object: self receiver.
  		 ^self].
+ 	selectedContextSlotName := contextVariablesInspector selectedFieldName.
- 	selectedContextSlotName := contextVariablesInspector selectedSlotName.
  	isNewMethod := oldContext == nil
  					or: [oldContext method ~~ (currentCompiledMethod := self selectedContext method)].
  	isNewMethod ifTrue:
  		[contents := self selectedMessage.
  		 self contentsChanged.
  		 self pcRange].
  	self changed: #contextStackIndex.
  	self decorateButtons.
  	contextVariablesInspector object: self selectedContext.
+ 	self restoreContextVariablesInspectorState.
- 	((index := contextVariablesInspector fieldList indexOf: selectedContextSlotName) ~= 0
- 	 and: [index ~= contextVariablesInspector selectionIndex]) ifTrue:
- 		[contextVariablesInspector toggleIndex: index].
  	receiverInspector object: self receiver.
+ 	self restoreReceiverInspectorState.
  	isNewMethod ifFalse:
  		[self changed: #contentsSelection]!

Item was added:
+ ----- Method: Debugger>>keyForContextVariablesInspectorState (in category 'user interface') -----
+ keyForContextVariablesInspectorState
+ 	
+ 	^ self contextVariablesInspector object ifNotNil: [:ctxt | ctxt method]!

Item was added:
+ ----- Method: Debugger>>keyForReceiverInspectorState (in category 'user interface') -----
+ keyForReceiverInspectorState
+ 
+ 	^ self receiverInspector object!

Item was added:
+ ----- Method: Debugger>>restoreContextVariablesInspectorState (in category 'user interface') -----
+ restoreContextVariablesInspectorState
+ 	"For the user's convenience. Save field selection and user-typed content in the context-variables inspector. See #saveContextVariablesInspectorState."
+ 
+ 	contextVariablesInspectorState ifNotNil: [:stateForAll |
+ 		self keyForContextVariablesInspectorState ifNotNil: [:keyForState |
+ 			stateForAll 
+ 				at: keyForState
+ 				ifPresent: [:state |
+ 					self contextVariablesInspector selectFieldNamed: state first.
+ 					state second ifNotNil: [:contentsTyped |
+ 						self contextVariablesInspector
+ 							setContentsTyped: contentsTyped]]]].!

Item was added:
+ ----- Method: Debugger>>restoreReceiverInspectorState (in category 'user interface') -----
+ restoreReceiverInspectorState
+ 	"For the user's convenience. Restore field selection and user-typed content in the receiver inspector. See #saveReceiverInspectorState."
+ 	
+ 	receiverInspectorState ifNotNil: [:stateForAll |
+ 		self keyForReceiverInspectorState ifNotNil: [:keyForState |
+ 			stateForAll 
+ 				at: keyForState
+ 				ifPresent: [:state |
+ 					self receiverInspector selectFieldNamed: state first.
+ 					state second ifNotNil: [:contentsTyped |
+ 						self receiverInspector
+ 							setContentsTyped: contentsTyped]]]].!

Item was added:
+ ----- Method: Debugger>>saveContextVariablesInspectorState (in category 'user interface') -----
+ saveContextVariablesInspectorState
+ 	"For the user's convenience. Save field selection and user-typed content in the context-variables inspector. See #restoreContextVariablesInspectorState."
+ 	
+ 	| stateToSave keyForState |
+ 	(keyForState := self keyForContextVariablesInspectorState)
+ 		ifNil: [^ self].
+ 	contextVariablesInspectorState
+ 		ifNil: [contextVariablesInspectorState := IdentityDictionary new].
+ 	stateToSave := {
+ 		self contextVariablesInspector selectedFieldName.
+ 		self contextVariablesInspector contentsTyped }.
+ 	contextVariablesInspectorState
+ 		at: keyForState
+ 		put: stateToSave.!

Item was added:
+ ----- Method: Debugger>>saveReceiverInspectorState (in category 'user interface') -----
+ saveReceiverInspectorState
+ 	"For the user's convenience. Save field selection and user-typed content in the receiver inspector. See #restoreReceiverInspectorState."
+ 
+ 	| stateToSave keyForState |
+ 	(keyForState := self keyForReceiverInspectorState)
+ 		ifNil: [^ self].
+ 	receiverInspectorState
+ 		ifNil: [receiverInspectorState := IdentityDictionary new].
+ 	stateToSave := {
+ 		self receiverInspector selectedFieldName.
+ 		self receiverInspector contentsTyped }.
+ 	receiverInspectorState
+ 		at: keyForState
+ 		put: stateToSave.!



More information about the Squeak-dev mailing list