How to debug primitive failures?

Chris Pettitt cpettitt at vidigiani.dyndns.org
Wed May 21 18:42:44 UTC 2003


The primitive that fails is "<primitive: 'primitiveSocketAccept' module:
'SocketPlugin'>", which is called from
#primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:. I was able to
get
my code working by making a call to #listenOn:backlogSize: instead of
#listenOn:. #listenOn:backlogSize: calls
#primSocket:listenOn:backlogSize:,
while #listenOn: calls #primSocket:listOn:.

I don't know enough about primitives, but wonder if there might be some
kind
of issue there. For example, does the primitive always expect a set number
of parameters? It might be expecting 2 parameters, the port and the
backlog
size, but only getting one from #listen. For now I will just use the call
that includes the backlog size, but I would be interested if anyone knows
why the other message might be failing? Am I doing something wrong with
it?

Thanks,
Chris

On Wed, 21 May 2003, Derek Brans wrote:

> Hi Chris,
>
> When the debugger comes up, the stack trace should offer more information.
> If it doesn't, try steping into the suspect method (in this case,
> waitForAcceptUntil) and hunt down the primitive call using steps (to step
> over a method you know works) and sends (to step into a method you think is
> causing the error.  Self halts can help you get to a place in the code
> faster.
>
> Eventually you should find the offending primitive and you'll have more
> information.
>
> Derek Brans
> Nerd on a Wire
> Web design that's anything but square
> http://www.nerdonawire.com
> phone: 604.874.6463
> mailto: brans at nerdonawire.com
>
> ----- Original Message -----
> From: "Chris Pettitt" <cpettitt at vidigiani.dyndns.org>
> To: "The general-purpose Squeak developers list"
> <squeak-dev at lists.squeakfoundation.org>
> Sent: Wednesday, May 21, 2003 10:52 AM
> Subject: How to debug primitive failures?
>
>
> > Somehow lost the subject when I sent this out. I should also note that
> > this primitive failure is raised after I connect to the server socket
> > using telnet.
> >
> > Thanks,
> > Chris
> >
> > On Wed, 21 May 2003, Chris Pettitt wrote:
> >
> > > When I try to run the following code, I get a "primitive has failed"
> > > error:
> > >
> > > Socket initializeNetwork.
> > > acceptor _ Socket newTCP.
> > > acceptor listenOn: 8000.
> > > [
> > >  connection _ acceptor waitForAcceptUntil: (Socket deadlineSecs: 120).
> > >  connection ~= nil ifTrue: [
> > >   [Transcript show: 'Received Connection!'. connection close.] fork.
> > >  ].
> > >  false.
> > > ] whileTrue.
> > > acceptor close.
> > >
> > > My question is: how do I debug a primitive error in Squeak? I would have
> a
> > > lot better luck debugging this if I could find the C code, I am sure.
> > >
> > > Thanks,
> > > Chris
> > >
> > >
> > >
> > > Here is the stack, for those interested:
> > >
> > > VM: Win32 - Squeak3.4 of 1 March 2003 [latest update: #5170]
> > > Image: Squeak3.5 [latest update: #5180]
> > >
> > > Socket(Object)>>error:
> > >  Receiver: a Socket[destroyed]
> > >  Arguments and temporary variables:
> > >   aString:  'a primitive has failed'
> > >  Receiver's instance variables:
> > >   semaphore:  a Semaphore()
> > >   socketHandle:  nil
> > >   readSemaphore:  a Semaphore()
> > >   writeSemaphore:  a Semaphore()
> > >   primitiveOnlySupportsOneSemaphore:  true
> > >
> > > Socket(Object)>>primitiveFailed
> > >  Receiver: a Socket[destroyed]
> > >  Arguments and temporary variables:
> > >
> > >  Receiver's instance variables:
> > >   semaphore:  a Semaphore()
> > >   socketHandle:  nil
> > >   readSemaphore:  a Semaphore()
> > >   writeSemaphore:  a Semaphore()
> > >   primitiveOnlySupportsOneSemaphore:  true
> > >
> > > Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:
> > >  Receiver: a Socket[destroyed]
> > >  Arguments and temporary variables:
> > >   aHandle:  a ByteArray(16 94 73 70 0 0 0 0 248 96 11 0)
> > >   rcvBufSize:  8000
> > >   sndBufSize:  8000
> > >   semaIndex:  15
> > >  Receiver's instance variables:
> > >   semaphore:  a Semaphore()
> > >   socketHandle:  nil
> > >   readSemaphore:  a Semaphore()
> > >   writeSemaphore:  a Semaphore()
> > >   primitiveOnlySupportsOneSemaphore:  true
> > >
> > >
> Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:readSemaIndex
> :writeSemaIndex:
> > >  Receiver: a Socket[destroyed]
> > >  Arguments and temporary variables:
> > >   aHandle:  a ByteArray(16 94 73 70 0 0 0 0 248 96 11 0)
> > >   rcvBufSize:  8000
> > >   sndBufSize:  8000
> > >   semaIndex:  15
> > >   aReadSema:  16
> > >   aWriteSema:  17
> > >  Receiver's instance variables:
> > >   semaphore:  a Semaphore()
> > >   socketHandle:  nil
> > >   readSemaphore:  a Semaphore()
> > >   writeSemaphore:  a Semaphore()
> > >   primitiveOnlySupportsOneSemaphore:  true
> > >
> > >
> > > --- The full stack ---
> > > Socket(Object)>>error:
> > > Socket(Object)>>primitiveFailed
> > > Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:
> > >
> Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:readSemaIndex
> :writeSemaIndex:
> > >  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> > > Socket>>acceptFrom:
> > > [] in Socket class>>acceptFrom:
> > > BlockContext>>repeatWithGCIf:
> > > Socket class>>acceptFrom:
> > > Socket>>accept
> > > Socket>>waitForAcceptUntil:
> > >
> >
> >
> >
>
>
>



More information about the Squeak-dev mailing list