This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFA: PACKET_OVERHEAD constant added to remote.c


On Nov 16,  9:53am, Andrew Cagney wrote:
> Kevin Buettner wrote:
> > 
> > Hi Andrew,
> > 
> > Jesper Skov alerted me to the fact that we were getting some "Remote
> > packet too long" messages when attempting to debug using a gdbserver
> > for i386 linux.  The problem was that the memory packet size
> > computations were not taking into account the packet overhead.  This
> > would've been a one line fix, but I decided to define PACKET_OVERHEAD
> > instead of adding another hard-coded instance of the constant 32.
> 
> Keven,
> 
> I'm puzzled. (I guess you mean one of the M or X packets?).
> I thought the function remote_write_bytes () was already taking care of
> the packet overhead.  Can you expand a little on what exactly Jesper is
> seeing?

I was able to reproduce the problem as well.  Here's what I was seeing

Sending packet: $m40013368,c8#cd...Ack

    ()Remote packet too long: 00000000870101401c990408883601400000000090...

In other words, gdb was asking gdbserver to send a packet that was
too large for gdb to deal with.

As far as remote_write_bytes() or remote_read_bytes() are concerned,
they get their packet sizes by calling get_memory_write_packet_size()
or get_memory_read_packet_size() which in turn determine the size by
calling get_memory_packet_size().  It is the latter function which
was returning too large a value.  It is also in this function where
I chose to make an adjustment:

@@ -358,7 +363,7 @@
     }
   else
     {
-      what_they_get = remote_packet_size;
+      what_they_get = remote_packet_size - PACKET_OVERHEAD;
       /* Limit the packet to the size specified by the user. */
       if (config->size > 0
 	  && what_they_get > config->size)


Looking at it again, it occurs to me that it might be better to
subtract out PACKET_OVERHEAD on the expression in the return statement.

I.e, instead of

  return what_they_get;

perhaps we want

  return what_they_get - PACKET_OVERHEAD;

??

Kevin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]