Great contribution!
On Tue, 17 Sep 2019 10:10:24 0000, commits@source.squeak.org commits@source.squeak.org wrote:
Marcel Taeumel uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-mt.1093.mcz
==================== Summary ====================
Name: System-mt.1093 Author: mt Time: 17 September 2019, 12:10:14.798406 pm UUID: 5eb2c78e-ce42-654d-b764-57fc1e4d0521 Ancestors: System-mt.1092
Refactors process debugging in general, which makes MVC debugging work again:
- adds MorphicDebugger and MVCDebugger as subclasses of Debugger to
untangle debugging for those different GUI frameworks
- removes the intermediate role of UIManager for debugging purposes -- focus
on Project, (Standard)ToolSet, and Process
- treat unhandled warnings the same as unhandled errors, which is through
the current ToolSet
- let SyntaxError tool use tool builder
- clarify #handle* and #debug* methods in ToolSet's 'debugging' category
- adds comments to ToolSet and StandardToolSet
=============== Diff against System-mt.1092 ===============
Item was changed:
- ----- Method: Project>>addDeferredUIMessage: (in category 'scheduling &
debugging') -----
- ----- Method: Project>>addDeferredUIMessage: (in category 'scheduling')
addDeferredUIMessage: valuableObject "Arrange for valuableObject to be evaluated at a time when the user interface is in a coherent state."
self subclassResponsibility!
Item was removed:
- ----- Method: Project>>debugMethod:forReceiver:inContext: (in category
'debugging') -----
- debugMethod: aCompiledMethod forReceiver: anObject inContext:
aContextOrNil
- "Just execute the method and return the result. We cannot know how
interactive debugging works for arbitrary projects."
- ^ aCompiledMethod
valueWithReceiver: anObject
arguments: (aContextOrNil
ifNil: [#()]
ifNotNil: [{aContextOrNil}])!
Item was added:
- ----- Method: Project>>debuggerClass (in category 'scheduling &
debugging') -----
- debuggerClass
- ^ self subclassResponsibility!
Item was changed:
- ----- Method: Project>>interruptName: (in category 'scheduling &
debugging') -----
- ----- Method: Project>>interruptName: (in category 'debugging') ----- interruptName: labelString "Create a Notifier on the active scheduling process with the given
label."
^ self subclassResponsibility !
Item was changed:
- ----- Method: Project>>interruptName:preemptedProcess: (in category
'scheduling & debugging') -----
- ----- Method: Project>>interruptName:preemptedProcess: (in category
'debugging') ----- interruptName: labelString preemptedProcess: theInterruptedProcess "Create a Notifier on the active scheduling process with the given label."
^ self subclassResponsibility !
Item was added:
- ----- Method: Project>>syntaxError: (in category 'scheduling & debugging')
- syntaxError: aSyntaxErrorNotification
- ^ ToolSet debugSyntaxError: aSyntaxErrorNotification!
Item was changed: ----- Method: SmalltalkImage>>handleUserInterrupt (in category 'miscellaneous') ----- handleUserInterrupt Preferences cmdDotEnabled ifTrue:
[[ToolSet handleUserInterruptRequest: 'User Interrupt'] fork]
![[Project current interruptName: 'User Interrupt'] fork]
Item was changed: ----- Method: SyntaxErrorNotification>>defaultAction (in category '*System-exceptionDescription') ----- defaultAction
- ^ToolSet handleSyntaxError: self!
- ^ToolSet debugSyntaxError: self!
Item was removed:
- ----- Method: ToolSet class>>debug:context:label:contents:fullView: (in
category 'debugging') -----
- debug: aProcess context: aContext label: aString contents: contents
fullView: aBool
- "Open a debugger on the given process and context."
- self default ifNil:[
(self confirm: 'Debugger request -- proceed?')
ifFalse:[Processor terminateActive].
^self].
- ^self default debug: aProcess context: aContext label: aString contents:
contents fullView: aBool!
Item was added:
- ----- Method: ToolSet class>>debugActiveProcessContext:label:contents: (in
category 'debugging - convenience') -----
- debugActiveProcessContext: aContext label: aString contents: contents
- ^ self
debugProcess: Processor activeProcess
context: aContext
label: aString
contents: contents
fullView: false!
Item was removed:
- ----- Method: ToolSet class>>debugContext:label:contents: (in category
'debugging') -----
- debugContext: aContext label: aString contents: contents
- "Open a debugger on the given context."
- self default ifNil:[
(self confirm: 'Debugger request -- proceed?')
ifFalse:[Processor terminateActive].
^self].
- ^self default debugContext: aContext label: aString contents: contents!
Item was removed:
- ----- Method: ToolSet class>>debugError: (in category 'debugging') -----
- debugError: anError
- "Handle an otherwise unhandled error"
- self default ifNil:[ | ctx |
Smalltalk
logSqueakError: anError description
inContext: (ctx := anError signalerContext) .
self inform: (anError description, String cr, ctx shortStack).
^anError return].
- ^self default debugError: anError!
Item was added:
- ----- Method: ToolSet class>>debugInterruptedProcess:label: (in category
'debugging') -----
- debugInterruptedProcess: aSuspendedProcess label: aString
- "Open a debugger on the given process, which is already suspended."
- ^ self default
ifNil: [(self confirm: 'Debugger request -- proceed?')
ifFalse:[aSuspendedProcess terminate]]
ifNotNil: [:ts | ts debugInterruptedProcess: aSuspendedProcess label:
aString]!
Item was changed: ----- Method: ToolSet class>>debugMethod:forReceiver:inContext: (in category 'debugging') ----- debugMethod: aCompiledMethod forReceiver: anObject inContext: aContext
- ^ self default
ifNil: [
self inform: 'Cannot debug method. It will just be executed.'.
aCompiledMethod
valueWithReceiver: anObject
arguments: (aContext ifNil: [#()] ifNotNil: [{aContext}])]
ifNotNil: [:ts | ts debugMethod: aCompiledMethod forReceiver: anObject
inContext: aContext]!
- self default ifNil:[^ self inform: 'Cannot debug method.'].
- ^self default debugMethod: aCompiledMethod forReceiver: anObject
inContext: aContext
- !
Item was added:
- ----- Method: ToolSet class>>debugProcess:context:label:contents:fullView:
(in category 'debugging') -----
- debugProcess: aProcess context: aContext label: aString contents: contents
fullView: aBool
- "Open a debugger on the given process, which might be active, suspended,
or terminated."
- ^ self default
ifNil: [(self confirm: 'Debugger request -- proceed?') ifFalse:
[Processor terminateActive]]
ifNotNil: [:ts | ts debugProcess: aProcess context: aContext label:
aString contents: contents fullView: aBool]!
Item was changed:
----- Method: ToolSet class>>debugSyntaxError: (in category 'debugging')
- debugSyntaxError: aSyntaxErrorNotification
- "Opens a tool to let the user correct the syntax error, which then
resumes the compiler process."
- ^ self default
ifNil: [Project uiManager edit: aSyntaxErrorNotification errorCode
label: 'Syntax Error (read only)']
ifNotNil: [:ts | ts debugSyntaxError: aSyntaxErrorNotification]!
- debugSyntaxError: anError
- "Handle a syntax error"
- self default ifNil:[^self debugError: anError]. "handle as usual error"
- ^self default debugSyntaxError: anError!
Item was added:
- ----- Method: ToolSet class>>handleError: (in category 'debugging -
handlers') -----
- handleError: anError
- "No exception handler caught the given error. Let the user handle that
error through an interactive tool such as a debugger.
- THE ACTIVE PROCESS *IS* WHERE THE ERROR HAPPENED."
- ^ self default
ifNil: [ | ctx |
Smalltalk
logSqueakError: anError description
inContext: (ctx := anError signalerContext) .
self inform: (anError description, String cr, ctx shortStack).
anError return]
ifNotNil: [:ts | ts handleError: anError]!
Item was added:
- ----- Method: ToolSet class>>handleSyntaxError: (in category 'debugging -
handlers') -----
- handleSyntaxError: anError
- "A syntax error (notification) occurred while parsing and compiling
source code. Usually, the compiling process suspends until the syntax error gets corrected.
- THE ACTIVE PROCESS *IS* THAT COMPILER PROCESS."
- ^ self default
ifNil: [self handleError: anError]
ifNotNil: [:ts | ts handleSyntaxError: anError]!
Item was added:
- ----- Method: ToolSet class>>handleUserInterruptRequest: (in category
'debugging - handlers') -----
- handleUserInterruptRequest: aString
- "The user wants to interrupt a process, which might be unresponsive, to
debug it.
- THE ACTIVE PROCESS *IS* A HELPER PROCESS with a priority higher than the
preempted one. See EventSensor >> #userInterruptWatcher."
- ^ self default
ifNil: [self inform: 'No handler for user interrupts found.']
ifNotNil: [:ts | ts handleUserInterruptRequest: aString]!
Item was added:
- ----- Method: ToolSet class>>handleWarning: (in category 'debugging -
handlers') -----
- handleWarning: aWarning
- "No exception handler caught the given warning. Let the user handle that
warning through an interactive tool such as a debugger.
- THE ACTIVE PROCESS *IS* WHERE THE WARNING HAPPENED."
- ^ self default
ifNil: [
self inform: (aWarning messageText, String cr, aWarning signalerContext
shortStack).
aWarning resume]
ifNotNil: [:ts | ts handleWarning: aWarning]!
Item was removed:
- ----- Method: ToolSet class>>interrupt:label: (in category 'debugging')
- interrupt: aProcess label: aString
- "Open a debugger on the given process and context."
- self default ifNil:[
(self confirm: 'Debugger request -- proceed?')
ifFalse:[aProcess terminate].
^self].
- ^self default interrupt: aProcess label: aString!
Item was changed: ----- Method: UnhandledError>>defaultAction (in category '*System-priv handling') ----- defaultAction "The current computation is terminated. The cause of the error should be logged or reported to the user. If the program is operating in an interactive debugging environment the computation should be suspended and the debugger activated."
- ^ToolSet handleError: self exception!
- ^ToolSet debugError: self exception!
Item was changed: ----- Method: UnhandledWarning>>defaultAction (in category '*System-priv handling') ----- defaultAction
- ^ ToolSet handleWarning: self exception!
- ^ ToolSet
debugContext: self exception signalerContext
label: 'Warning'
contents: self exception messageText , '\\Select Proceed to continue, or
close this window to cancel the operation.' withCRs!
Item was changed:
----- Method: WrappedBreakpoint>>run:with:in: (in category 'evaluation')
run: aSelector with: anArray in: aReceiver | process | process := Process forContext: (Context sender: thisContext sender receiver: aReceiver method: method arguments: anArray) priority: Processor activeProcess priority. ToolSet
debugProcess: process
context: process suspendedContext label: 'Breakpoint in ' , method methodClass name , '>>#' , methoddebug: process
selector contents: nil fullView: true. Project current spawnNewProcessIfThisIsUI: Processor activeProcess. thisContext swapSender: nil. Processor activeProcess terminate!