Marcel Taeumel uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-mt.242.mcz ==================== Summary ==================== Name: ST80-mt.242 Author: mt Time: 7 October 2019, 10:11:49.848231 am UUID: afdab065-0896-584a-8c18-3376d0d5a0ed Ancestors: ST80-mt.241 Complements System-mt.1112, which fixes and clean-up in the debugger infrastructure. =============== Diff against ST80-mt.241 =============== Item was added: + ----- Method: ControlManager>>activeController:andProcess: (in category 'accessing') ----- + activeController: aController andProcess: aProcess + "Set aController to be the currently active controller and aProcess to be the the process that handles controller scheduling activities in the system. ndProcess: in that it + does not send controlTerminate to the currently active controller." + + self inActiveControllerProcess + ifTrue: [ + aController ifNotNil: [:c | + (scheduledControllers includes: c) + ifTrue: [self promote: c] + ifFalse: [self error: 'Old controller not scheduled']]. + activeController ifNotNil: [:c | c controlTerminate]. + activeController := aController. + activeController ifNotNil: [:c | c controlInitialize]. + + aProcess resume. + + activeController + ifNil: [self searchForActiveController] + ifNotNil: [ + "Assume that given controller matches the process." + activeControllerProcess := aProcess. + Processor terminateActive]] + ifFalse: + [self error: 'New active controller process must be set from old one'] ! Item was removed: - ----- Method: MVCDebugger class>>openInterrupt:onProcess: (in category 'opening') ----- - openInterrupt: aString onProcess: interruptedProcess - "Open a notifier in response to an interrupt. An interrupt occurs when the user types the interrupt key (cmd-. on Macs, ctrl-c or alt-. on other systems) or when the low-space watcher detects that memory is low." - - | debugger message | - <primitive: 19> "Simulation guard" - - Project current world inActiveControllerProcess - ifTrue: [^ self notify: 'You cannot interrupt from within the active controller process. Use a helper process instead.\\This interrupt request will be aborted.' withCRs translated]. - - debugger := self new. - debugger - process: interruptedProcess - controller: (Project current world activeControllerProcess == interruptedProcess - ifTrue: [Project current world activeController]) - context: interruptedProcess suspendedContext. - debugger externalInterrupt: true. - - ((aString includesSubstring: 'Space') and: [aString includesSubstring: 'low']) - ifTrue: [ - "Space is low!! See SmalltalkImage >> #lowSpaceWatcher." - message := self lowSpaceChoices. - Preferences logDebuggerStackToFile ifTrue: [ - Smalltalk logError: aString inContext: debugger interruptedContext to: 'LowSpaceDebug.log']] - ifFalse: [ - Preferences logDebuggerStackToFile ifTrue: [ - Smalltalk logSqueakError: aString inContext: debugger interruptedContext]]. - - debugger - openNotifierNoSuspendContents: message label: aString; - yourself. - - "Since we are in a helper process, #openNoTerminate WILL NOT activate the debugger's controller." - Project current world searchForActiveController. - ! Item was changed: ----- Method: MVCDebugger class>>openOn:context:label:contents:fullView: (in category 'opening') ----- + openOn: processToDebug context: context label: title contents: contentsStringOrNil fullView: full - openOn: process context: context label: title contents: contentsStringOrNil fullView: full "Open a notifier in response to an error, halt, or notify. A notifier view just shows a short view of the sender stack and provides a menu that lets the user open a full debugger." + | debugger cm ac acp wasActive | + cm := Project current world. "controller manager" + ac := cm activeController. + acp := cm activeControllerProcess. "the ui process" + wasActive := cm inActiveControllerProcess. + + debugger := self new + process: processToDebug + "Keep track of the controller if it matches." + controller: (acp == processToDebug ifTrue: [ac]) + context: context. - ErrorRecursionGuard critical: [ - - | debugger | - ErrorRecursion ifTrue: [ - "self assert: process == Project current uiProcess -- DOCUMENTATION ONLY" - self clearErrorRecursion. - ^ Project current handleFatalDrawingError: title]. + full + ifTrue: [debugger openFullNoSuspendLabel: title] + ifFalse: [debugger openNotifierNoSuspendContents: contentsStringOrNil label: title]. - [ErrorRecursion not & Preferences logDebuggerStackToFile - ifTrue: [Smalltalk logSqueakError: title inContext: context]] - on: Error - do: [:ex | ex return: nil]. - - self setErrorRecursion. - - self informExistingDebugger: context label: title. - - debugger := self new - process: process - controller: (Project current world activeControllerProcess == process - ifTrue: [Project current world activeController]) - context: context. + "Try drawing the debugger tool at least once to avoid freeze." + Project current restoreDisplay. + + "If we are in a helper process, #openNoTerminate WILL NOT activate the debugger's controller." + (acp == processToDebug and: [wasActive not]) + ifTrue: [ [cm searchForActiveController] fork ]. - full - ifTrue: [debugger openFullNoSuspendLabel: title] - ifFalse: [debugger openNotifierNoSuspendContents: contentsStringOrNil label: title]. + processToDebug suspend. - "Try drawing the debugger tool at least once to avoid freeze." - Project current restoreDisplay. - - self clearErrorRecursion]. + "Get here only if active process is not the process-to-debug. Use helper process if you want to access this return value." + ^ debugger! - process suspend.! Item was removed: - ----- Method: MVCDebugger class>>openOnMethod:forReceiver:inContext: (in category 'opening') ----- - openOnMethod: aCompiledMethod forReceiver: anObject inContext: aContextOrNil - - | guineaPig debugger context inActiveControllerProcess | - inActiveControllerProcess := ScheduledControllers inActiveControllerProcess. - - guineaPig := - [aCompiledMethod - valueWithReceiver: anObject - arguments: (aContextOrNil ifNil: [ #() ] ifNotNil: [ { aContextOrNil } ]). - guineaPig := nil. "Spot the return from aCompiledMethod. See below." - - "If we proceed in the debugger, make sure to keep the system responsive." - "ScheduledControllers searchForActiveController"] newProcess. - context := guineaPig suspendedContext. - - debugger := self new - process: guineaPig - controller: nil "None because the guinea pig does *not* relate to the active controller." - context: context. - debugger initializeFull. "To make #send work. See below." - - "Now step into the expression. But if it is quick (is implemented as a primtiive, e.g. `0') - it will return immediately back to the block that is sent newProcess above. Guard - against that with the check for home being thisContext." - [debugger interruptedContext method == aCompiledMethod] - whileFalse: [ - (guineaPig isNil and: [debugger interruptedContext home == thisContext]) - ifTrue: [^ Project uiManager inform: 'Nothing to debug; expression is optimized.']. - debugger send]. - - debugger openFullNoSuspendLabel: 'Debug it'. - inActiveControllerProcess ifTrue: [Processor terminateActive].! Item was removed: - ----- Method: MVCDebugger>>abandon: (in category 'initialize') ----- - abandon: aTopView - - aTopView controller closeAndUnscheduleNoTerminate.! Item was changed: ----- Method: MVCDebugger>>resumeProcess: (in category 'private') ----- + resumeProcess: processToResume + "Finally free the reference to the controller if any. We cannot do this in #windowIsClosing." - resumeProcess: aTopView - - | hasActiveController | - aTopView erase. - savedCursor ifNotNil: [Cursor currentCursor: savedCursor]. + | controllerToReschedule | + controllerToReschedule := interruptedController. + interruptedController := nil. - hasActiveController := interruptedProcess isTerminated not and: [interruptedController notNil]. + ScheduledControllers + activeController: controllerToReschedule + andProcess: processToResume.! - interruptedProcess isTerminated ifFalse: [ - ScheduledControllers activeControllerNoTerminate: interruptedController andProcess: interruptedProcess]. - - Smalltalk installLowSpaceWatcher. "restart low space handler" - - interruptedProcess := nil. "Before delete, so release doesn't terminate it" - aTopView controller closeAndUnscheduleNoErase. - - hasActiveController - ifTrue: [Processor terminateActive] - ifFalse: [Project current world searchForActiveController].! Item was removed: - ----- Method: MVCDebugger>>windowIsClosing (in category 'initialize') ----- - windowIsClosing - - super windowIsClosing. - - interruptedController := nil.! Item was added: + ----- Method: MVCProject>>interruptCleanUpFor: (in category 'scheduling & debugging') ----- + interruptCleanUpFor: interruptedProcess + + super interruptCleanUpFor: interruptedProcess. + + (world activeController ~~ nil and: [world activeController ~~ world screenController]) ifTrue: [ + interruptedProcess == self uiProcess + ifTrue: [ + world activeController view topView deEmphasizeForDebugger] + ifFalse: [ + world activeController controlTerminate]].! Item was removed: - ----- Method: MVCProject>>interruptName: (in category 'scheduling & debugging') ----- - interruptName: labelString - "Create a Notifier on the active scheduling process with the given label. Make the Notifier the active controller." - - ^ self - interruptName: labelString - preemptedProcess: self uiProcess! Item was removed: - ----- Method: MVCProject>>interruptName:preemptedProcess: (in category 'scheduling & debugging') ----- - interruptName: labelString preemptedProcess: theInterruptedProcess - "Create a Notifier on the interrupted process with the given label. Make the Notifier the active controller." - - world inActiveControllerProcess ifTrue: [ - ^ self inform: 'You cannot interrupt from within the UI process.\Use a helper process instead.' withCRs translated]. - - (world activeController ~~ nil and: [world activeController ~~ world screenController]) ifTrue: [ - theInterruptedProcess == self uiProcess - ifTrue: [ - "Carefully de-emphasis the current window." - world activeController view topView deEmphasizeForDebugger] - ifFalse: [ - world activeController controlTerminate]]. - - theInterruptedProcess suspend. - self interruptCleanUpFor: theInterruptedProcess. - - ToolSet - debugInterruptedProcess: theInterruptedProcess - label: labelString.! |
Free forum by Nabble | Edit this page |