'From Squeak5.3beta of 24 January 2020 [latest update: #19332] on 28 January 2020 at 2:19:19 pm'! !Debugger methodsFor: 'initialize' stamp: 'ct 1/28/2020 13:50'! context: aContext self process: Processor basicActiveProcess context: aContext.! ! !Debugger class methodsFor: '*60Deprecated-opening' stamp: 'ct 1/28/2020 13:50'! context: aContext self deprecated. ^ self openOn: Processor basicActiveProcess context: aContext label: 'Debug' contents: nil fullView: false! ! !Debugger class methodsFor: '*60Deprecated-opening' stamp: 'ct 1/28/2020 13:50'! openContext: aContext label: aString contents: contentsStringOrNil self deprecated. ^ self openOn: Processor basicActiveProcess context: aContext label: aString contents: contentsStringOrNil fullView: false ! ! !DebuggerTests methodsFor: 'tests' stamp: 'ct 1/28/2020 14:12'! test16HandleErrorOnBehalfOf "Regression test. An error raised inside of #evaluate:onBehalfOf: must not be debugged on the replaced active context. Otherwise, context simulation errors can lead to an infinite chain of debuggers. See http://forum.world.st/I-broke-the-debugger-td5110752.html." process := [Processor activeProcess evaluate: [self error] onBehalfOf: [] newProcess] newProcess. process resume. Processor yield. self ensureDebugger. self deny: [process isTerminated]. debugger proceed. Processor yield. self assert: [process isTerminated].! ! !Process methodsFor: 'testing' stamp: 'ct 1/28/2020 13:38'! isBasicActiveProcess ^ self == Processor basicActiveProcess! ! !Process methodsFor: '*System-debugging' stamp: 'ct 1/28/2020 13:39'! debug: context title: title full: bool contents: contents "Open debugger on self with context shown on top" | topCtxt | topCtxt := self isBasicActiveProcess ifTrue: [thisContext] ifFalse: [self suspendedContext]. (topCtxt hasContext: context) ifFalse: [^ self error: 'context not in process']. ^ ToolSet debugProcess: self context: context label: title contents: contents fullView: bool! ! !Process methodsFor: '*System-debugging' stamp: 'ct 1/28/2020 14:13'! debugWithTitle: title full: bool contents: contents "Automatically choose the top context." ^ self debug: (self isBasicActiveProcess ifTrue: [thisContext] ifFalse: [self suspendedContext]) title: title full: bool contents: contents! ! !ProcessorScheduler methodsFor: 'accessing' stamp: 'ct 1/28/2020 13:34'! basicActiveProcess "Answer the active Process. Warning: Kind of private!! Does not respect #evaluate:onBehalfOf:. Only use this for debugging scnearios." ^activeProcess! ! !StandardToolSet class methodsFor: 'debugging - handlers' stamp: 'ct 1/28/2020 13:34'! handleError: anError "Double dispatch. Let the active process take care of that error, which usually calls back here to #debugProcess:..." ^ Processor basicActiveProcess debug: anError signalerContext title: anError description! ! !StandardToolSet class methodsFor: 'debugging - handlers' stamp: 'ct 1/28/2020 13:54'! handleWarning: aWarning "Double dispatch. Let the active process take care of that warning, which usually calls back here to #debugProcess:..." | message | message := '{1}\\{2}' withCRs asText format: { "First, show the actual text of this warning." aWarning messageText. "Second, append some helpful information that apply to all kinds of warnings." ('{1} {2}' asText format: { 'Select "Proceed" to continue or close this window to cancel the operation.' translated. 'If you do not want to be interrupted anymore, you can {1} this kind of warning. You can also {2}, which resets such warnings on the next image startup.' translated asText format: { "Provide clickable text links so that the user can directly suppress warnings." 'always suppress' asText addAttribute: (PluggableTextAttribute evalBlock: [ aWarning class suppressWarnings. self inform: ('All ''{1}'' warnings will be suppressed.' translated format: {aWarning class name})]). 'suppress temporarily' asText addAttribute: (PluggableTextAttribute evalBlock: [ aWarning class suppressAndResetOnStartUp. self inform: ('All ''{1}'' warnings will be suppressed\and reset on the next image startup.' withCRs translated format: {aWarning class name})])}. }) addAttribute: ( "Show this helpful information in a smaller font." TextFontReference toFont: Preferences standardButtonFont)}. ^ Processor basicActiveProcess debug: aWarning signalerContext title: 'Warning' translated full: false contents: message! !