This is the mail archive of the
mailing list for the GDB project.
Re: RFA: PACKET_OVERHEAD constant added to remote.c
- To: Andrew Cagney <ac131313 at cygnus dot com>, Kevin Buettner <kevinb at cygnus dot com>
- Subject: Re: RFA: PACKET_OVERHEAD constant added to remote.c
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Mon, 15 Nov 1999 16:34:03 -0700
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <991112184146.ZM22052@ocotillo.lan> <38308EDB.A02AF873@cygnus.com>
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.
> 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
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 @@
- 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
perhaps we want
return what_they_get - PACKET_OVERHEAD;