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
On Nov 16, 1:20pm, Andrew Cagney wrote:
> > 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).
Unclear. I was able to use an x86 linux gdbserver with gdb prior to
your change below (without seeing the buffer overflow problem). I
don't whether it was your change which caused the breakage or something
else.
Let me know if you'd like me to pursue this; I could do an update
to Nov 3 and see if the problem still exists...
> 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.
Yes. I saw your comment in get_memory_read_packet_size().
> 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''.