[squeak-dev] The Trunk: Tools-jar.1161.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 13 07:42:26 UTC 2022


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

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

Name: Tools-jar.1161
Author: jar
Time: 9 June 2022, 1:57:46.549529 pm
UUID: f3921b2b-5628-104d-98a9-1e99671344a2
Ancestors: Tools-ct.1160

Fix an inconsistent Debugger behavior WRT the new alternative abandon/terminate/destroy modes introduced by Kernel-ct.1434 and Tools-ct.1092.

The suggestion is to make all three termination methods equal in terms of how the chosen termination mode is propagated to #windowIsClosing. Current asymmetrical approach leads to an incorrect debugger termination via #terminate mode. 

Replace termination of the debugged process with an indirect termination via a forked process (otherwise the debugger waits until the debugged process is terminated but if another error is raised during unwind the termination is halted and the assertion fail).

Following up a conversation in http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-May/220675.html

Complemented by ToolsTests-jar.111 fixing the failing/incorrects tests in ToolsTests-ct.107

Please review as I'm no debugger expert and this is just my suggestion.

Superseeds (or replaces) Tools-jar.1159 (please kindly remove from Inbox)

=============== Diff against Tools-ct.1160 ===============

Item was changed:
  CodeHolder subclass: #Debugger
+ 	instanceVariableNames: 'interruptedProcess contextStack contextStackIndex contextStackList receiverInspector receiverInspectorState contextVariablesInspector contextVariablesInspectorState externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject labelString message untilExpression terminationMethod'
- 	instanceVariableNames: 'interruptedProcess contextStack contextStackIndex contextStackList receiverInspector receiverInspectorState contextVariablesInspector contextVariablesInspectorState externalInterrupt proceedValue selectingPC savedCursor isolationHead failedProject labelString message untilExpression'
  	classVariableNames: 'ContextStackKeystrokes ErrorReportServer FullStackSize InterruptUIProcessIfBlockedOnErrorInBackgroundProcess NotifierStackSize SavedExtent StackSizeLimit WantsAnnotationPane'
  	poolDictionaries: ''
  	category: 'Tools-Debugger'!
  
  !Debugger commentStamp: 'mt 12/17/2019 12:19' 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. 
  
  ---
  
  In September 2019, we added MorphicDebugger and MVCDebugger to untangle framework-specific features in our debugger infrastructure. However, this is just an intermediate step. The overall goal would be to remove those two subclasses again while preserving their functionality. Mostly, MVC and Morphic differ in their GUI-process management. This means that "proceed" and "close" work differently depending on the process that is being debugged. --- One idea is to attach that framework-specific information to the process objects. See Process >> #environmentAt: and #environmentAt:put:. Also see ToolSet's #handle* and #debug* methods.!

Item was changed:
  ----- Method: Debugger>>abandon (in category 'context stack menu') -----
  abandon
+ 	"close the debugger and terminate the debugged process"
- 	"abandon the debugger from its pre-debug notifier"
  	
+ 	terminationMethod := #terminateAggressively.
+ 	self close
+ !
- 	self close.!

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.
+ 	
+ 	terminationMethod := #terminateAggressively "debugger's default termination method"!
- 	contextStackIndex := 0.!

Item was changed:
  ----- Method: Debugger>>terminateProcess (in category 'context stack menu') -----
  terminateProcess
+ 	"close the debugger and terminate the debugged process"
  
+ 	terminationMethod := #terminate.
+ 	self close
+ !
- 	interruptedProcess terminate.
- 	interruptedProcess := nil.
- 	self close.!

Item was changed:
  ----- Method: Debugger>>windowIsClosing (in category 'initialize') -----
  windowIsClosing
  	"My window is being closed; clean up. Restart the low space watcher."
  
  	contextStack := nil.
  	receiverInspector := nil.
  	contextVariablesInspector := nil.
  	
  	interruptedProcess == nil ifTrue: [^ self].
+ 	[interruptedProcess perform: terminationMethod.
+ 	interruptedProcess := nil] fork.
- 	interruptedProcess terminateAggressively.
- 	interruptedProcess := nil.
  	
  	Smalltalk installLowSpaceWatcher.  "restart low space handler"!



More information about the Squeak-dev mailing list