[squeak-dev] Re: MVC debugging
Florin Mateoc
fmateoc at gmail.com
Tue Sep 14 23:39:05 UTC 2010
On 9/10/2010 9:33 PM, Florin Mateoc wrote:
> On 9/10/2010 7:48 AM, David T. Lewis wrote:
>> Well, we still have some work to do to get ControlManager>>interruptName:preemptedProcess:
>> working right. Background is at http://bugs.squeak.org/view.php?id=1041
>> but the basic idea is that all four of the following should be interruptable:
>>
>> "[true] whileTrue"
>> "[[true] whileTrue] forkAt: Processor userSchedulingPriority + 1"
>> "Smalltalk createStackOverflow"
>> "[Smalltalk createStackOverflow] forkAt: Processor userSchedulingPriority + 1"
>>
>> I spent some time trying to get this working last night, but have not yet
>> come up with a solution. The basic idea is if the low space interrupt watcher
>> process has called #interruptName:preemptedProcess: passing it theInterruptedProcess,
>> then we want the debugger to open on theInterruptedProcess rather than on
>> activeControllerProcess. This is a bit tricky to debug for obvious reasons ;)
>>
>> Dave
>>
> Of course that if we pass the preempted process, we have to honor that request.
> But I am not sure if I understand correctly. If I have a runaway non-ui process, I don't think that the user interrupt
> should try to find it and interrupt it. I think user interrupt is and should be dedicated to the ui process. Now once
> you open a debugger, you can have a list of currently running processes from which you can select and debug.
>
> Florin
>
>
Hi all,
I have been thinking of a way to have our cake and eat it too (being also able to interrupt a runaway process running at
a priority higher than the ui).
Basically we should have a way to tell Squeak that we want to interrupt the preempted process instead of the
activeControllerProcess.
For example the method #handleUserInterrupt could split the user interrupts into "normal" ones and "emergency" ones. The
code would look like:
handleUserInterrupt
| preemptedProcess |
Preferences cmdDotEnabled ifTrue: [
(Sensor shiftPressed and: [(preemptedProcess := Processor preemptedProcess) notNil])
ifTrue: [
[Project current
interruptName: 'Emergency User Interrupt'
preemptedProcess: preemptedProcess] fork]
ifFalse: [
[Project current interruptName: 'User Interrupt'] fork]]
Unfortunately the interrupt does not trigger if I also press Shift. Is there a simple way to make it trigger regardless
if Shift is pressed or not?
With this occasion, I also noticed that the method ProcessorScheduler>>preemptedProcess starts looking at the same
priority as the active process.
But a process cannot preempt another process at the same priority, therefore the method is either buggy or poorly named.
Both these tests return true:
| p | p := [[true] whileTrue: [Processor yield]] fork.
p name: 'bla'.
Processor yield.
Processor preemptedProcess == p
| p | p := [[true] whileTrue: [(Delay forMilliseconds: 2) wait]] fork.
p name: 'bla'.
Processor yield.
Processor preemptedProcess == p
(I named the processes to be able to terminate them after the test, so that I don't lose control over the image (Process
allInstances do: [:e | e name = 'bla' ifTrue: [e terminate]]))
Anyway, in both cases, these so-called preempted processes were not actually preempted, they were just nice citizens and
cooperative, so they yielded respectively waited.
I think the method #preemptedProcess should start iterating from "activeProcess priority - 1"
Cheers,
Florin
More information about the Squeak-dev
mailing list
|