[squeak-dev] Re: Cannot debug from Process browser

Bob Arning arning315 at comcast.net
Thu Dec 6 12:00:09 UTC 2012


On 12/5/12 10:40 PM, Chris Muller wrote:
>>> Well, it will happen if you add something to a list that's already there. Try this:
>>>
>>> | list link |
>>> list := LinkedList new.
>>> link := Link new.
>>> list add: link.
>>> list add: link.
>>> link explore.
> Sure, that makes perfect sense but...
>
>>> So if you send #resume to a process with priority less than the active process, it might happen. Or if you try to suspend the active process, but it's already on a suspended list.
> One thing I don't understand; I didn't see the connection from your
> simple example to what you're saying about resuming a process with
> lower-priority.  Process>>#resume simply calls #primitiveResume, it
> doesn't add anything to any linked list does it?
Well, I don't know where they keep the VM source these days, but when it 
was included in the image it looked like this:

*primitiveResume*

     | proc |
     proc _ self stackTop.  "rcvr"
     "self success: ((self fetchClassOf: proc) = (self splObj: 
ClassProcess))."
     successFlag ifTrue: [ self resume: proc ].

*resume: aProcess**
*
     | activeProc activePriority newPriority |
     self inline: false.
     activeProc _ self fetchPointer: ActiveProcessIndex
                          ofObject: self schedulerPointer.
     activePriority _ self quickFetchInteger: PriorityIndex ofObject: 
activeProc.
     newPriority   _ self quickFetchInteger: PriorityIndex ofObject: 
aProcess.
     newPriority > activePriority ifTrue: [
         self putToSleep: activeProc.
         self transferTo: aProcess.
     ] ifFalse: [
         self putToSleep: aProcess.
     ].
*
**putToSleep: aProcess*
     "Save the given process on the scheduler process list for its 
priority."

     | priority processLists processList |
     priority _ self quickFetchInteger: PriorityIndex ofObject: aProcess.
     processLists _ self fetchPointer: ProcessListsIndex ofObject: self 
schedulerPointer.
     processList _ self fetchPointer: priority - 1 ofObject: processLists.
     self addLastLink: aProcess toList: processList.

*addLastLink: proc toList: aList*
     "Add the given process to the given linked list and set the backpointer
     of process to its new list."

     | lastLink |
     (self isEmptyList: aList) ifTrue: [
         self storePointer: FirstLinkIndex ofObject: aList withValue: proc.
     ] ifFalse: [
         lastLink _ self fetchPointer: LastLinkIndex ofObject: aList.
         self storePointer: NextLinkIndex ofObject: lastLink withValue: 
proc.
     ].
     self storePointer: LastLinkIndex ofObject: aList withValue: proc.
     self storePointer: MyListIndex   ofObject:  proc withValue: aList.

So, either the process you are resuming or the lower-priority active 
process will be added to its proper priority list. If that process is 
already on the list, then your situation could arise.

>
>> Yes, it's certainly in the use of the primitive, not the primitive itself.
> Bert what do you mean by "the use of the primitive"?  It's getting
> called (by Process>>#resume) I can't think of any other way to use
> it..?
>
>> Why does the process need to be resumed if it's going to be debugged anyway?
> In looking at the associated code of ProcessBrowser, there is this
> global IdentityDictionary it maintains called 'SuspendedProcesses'.
> It is only ever populated by the user selecting "suspend (s)" from the
> Process list context menu.  When a process is suspended this way, if
> its 'suspendingList' (what is that?) is a Semaphore, then the priority
> of the Process being suspended is dropped.  The reason, according to
> the comment:
>
>    "Need to take the priority down below the caller's
> 	so that it can keep control after signaling the Semaphore"
>
> All this, so that, when eventually the user selects "resume (r)" from
> the ProcessBrowser list menu, it will be able to restore the original
> priority of the maybe-it-was-a-Semaphore Process..??  Whatever!
>
> Does anyone know Is this still needed or just old junk?
>
First question: was there anything in Suspended{rocesses when you 
encountered the error? Was it the process you were resuming?

Second: can you describe how to recreate the problem?

Cheers,
Bob


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20121206/fe5be24a/attachment.htm


More information about the Squeak-dev mailing list