This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: generic_load: Add ``set remote {read,write}-packet-size NNNN''
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: Re: generic_load: Add ``set remote {read,write}-packet-size NNNN''
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Thu, 04 Nov 1999 16:22:27 +1100
- Organization: Cygnus Solutions
- References: <381FE36C.EA79E935@cygnus.com>
Well,
After much feedback :-), I've reviewed the behavour of the commands and
consequently changed it to:
set remote memory-{read,write}-packet-size {VALUE,fixed,limit}
The VALUE is either a ``limit'' or ``fixed''. A ``limit'' is further
reduced by GDB being paranoid about overrunning the targets buffer. A
fixed value bypasses that mechanism. GDB's existing behavour is to
``limit'' the packet size and that is made the default.
The main motivation for the change is that my initial implementaton
would change the packet size whenever the architecture changed :-(. The
new implementation is more transparent (?).
For instance:
Initially the packet size is not set so the target default is used and
that can be changed to anything:
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 0. Packets are limited to 400 bytes.
(gdb) set remote memory-read-packet-size 200
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 200. Packets are limited to 200 bytes.
(gdb) set remote memory-read-packet-size 10000
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 10000. Packets are limited to 400 bytes.
Fixing the packet size attracts a warning and a different show output:
(gdb) set remote memory-read-packet-size fixed
The target may not be able to correctly handle a memory-read packet size
of 200 bytes.
Change the packet size? (y or n) y
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is fixed at 200 bytes.
(gdb) set remote memory-read-packet-size limit
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 200. Packets are limited to 200 bytes.
(gdb) set remote memory-read-packet-size 0
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 0. Packets are limited to 400 bytes.
Changing the architecture leads to fairly consistent behavour (say there
are two architectures byte50 and byte60):
(gdb) set remote memory-read-packet-size fixed
...
(gdb) set remote memory-read-packet-size 100
(gdb) set architecture byte50
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is fixed at 100 bytes.
(gdb) set architecture byte60
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is fixed at 100 bytes.
(gdb) set remote memory-read-packet-size limit
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 100. Packets are limited to 60 bytes.
(gdb) set architecture byte50
(gdb) show remote memory-read-packet-size
The memory-read-packet-size is 100. Packets are limited to 50 bytes.
More importantly the sequence:
set remote .... NNN
file ZYX
and
file ZYX
set remote .... NNN
now have identical behavour.
Thoughts. Better names?
Andrew
Andrew Cagney wrote:
>
> Hello,
>
> The attatched patch to remote.c adds support for the two commands:
>
> set remote read-packet-size VALUE
> set remote write-packet-size VALUE
>
> (and deprecates the old badly named ``set remotepacketsize''). The
> command has the following behavour:
>
> <=0 The default packet size (as determined
> by playing around with REGISTER_RAW_SIZE
> is restored.
>
> >=16k Illegal until the alloca() are removed.
>
> >= ~REGISTER_RAW_SIZE/2
> The user is prompted for confirmation that
> they really really want to change the buffer
> size.
>
> other The specified size is used but also capped
> by the size of the ``g'' packet returned
> by the target (consistent with the current
> behavour)!
>
> Of course, if someone has better names (or other comments) please post
> :-)
>
> Andrew
>
> (gdb) set remote read-packet-size 0
> Packet size set to the default of 400 bytes.
> (gdb) set remote read-packet-size 200
> (gdb) show remote read-packet-size
> The maximum number of characters per memory-read packet is 200.
> (gdb) set remote read-packet-size 401
> The read packet size of 401 is larger then the
> default of 400 for this target.
> Do you really want to make the change? (y or n) n
> (gdb) show remote read-packet-size
> The maximum number of characters per memory-read packet is 200.
> (gdb) set remote read-packet-size 401
> The read packet size of 401 is larger then the
> default of 400 for this target.
> Do you really want to make the change? (y or n) y
> (gdb) show remote read-packet-size
> The maximum number of characters per memory-read packet is 401.
> (gdb)
>
> ------------------------------------------------------------------------
> Wed Nov 3 17:14:39 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * remote.c (get_memory_packet_size, set_memory_packet_size): New
> functions. Set/compute the size of a memory read/write packet.
> (set_memory_read_packet_size, set_memory_write_packet_size): New.
> Verify changes to the memory read/write packet size.
> (memory_read_packet_size, memory_write_packet_size):
> New. Determine the current memory read/write packet size. A
> function is needed as ``actual_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.
> (prefered_write_packet_size, actual_write_packet_size,
> prefered_read_packet_size, actual_read_packet_size): New
> variables.
> (remote_fetch_registers, remote_fetch_registers,
> remote_write_bytes, remote_read_bytes, build_remote_gdbarch_data):
> Update.
> (_initialize_remote): Add the commands ``set remote
> read-packet-size'' and ``set remote write-packet-size''.
> Deprecate ``set remotepacketsize''.
>