This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: RFA: PACKET_OVERHEAD constant added to remote.c
Kevin Buettner wrote:
> > 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:
Yes. I'm just trying to understand if this is a recently introduced bug
(by me) or has always been in there. (In particular prior to the change
to remote.c below).
For what it's worth, there is a nasty overflow bug to do with
remote_read_bytes() - it stuffs up the buffer allocation. Ulgh. Better
fix that one.
Andrew
Thu Nov 4 11:59:24 1999 Andrew Cagney <cagney@b1.cygnus.com>
* remote.c (get_memory_packet_size, set_memory_packet_size,
build_memory_packet_size): New functions. Set / compute / update
the size of a memory read / write packet.
(set_memory_read_packet_size, set_memory_write_packet_size): New
functions. Verify changes to the memory read / write packet
size.
(prefered_memory_write_packet_size,
current_memory_write_packet_size,
prefered_memory_read_packet_size,
current_memory_read_packet_size): New variables.
(get_memory_read_packet_size, get_memory_write_packet_size): New
functions. Determine the current memory read/write packet size.
A
function is needed as ``current_register_packet_size'', a
variable
is used in the calculation.
(register_remote_packet_sizes, build_remote_packet_sizes):
Initialize packet sizes according the current architecture.
(remote_fetch_registers, remote_write_bytes, remote_read_bytes,
build_remote_gdbarch_data): Update.
(_initialize_remote): Add the commands ``set remote
memory-read-packet-size'' and ``set remote
memory-write-packet-size''. Deprecate ``set remotepacketsize''.