diff options
author | Pedro Alves <palves@redhat.com> | 2018-05-22 18:22:10 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-05-22 18:34:03 +0100 |
commit | cc0be08f80d4348e8f81471c80409710c4d4cd1a (patch) | |
tree | f623a911517a56177aa8684f5a99aebc61a6c3ae /gdb/testsuite/gdb.base | |
parent | 9607784ac00f9278094e962963f6271472b1dfca (diff) | |
download | gdb-cc0be08f80d4348e8f81471c80409710c4d4cd1a.zip gdb-cc0be08f80d4348e8f81471c80409710c4d4cd1a.tar.gz gdb-cc0be08f80d4348e8f81471c80409710c4d4cd1a.tar.bz2 |
Handle "show remote memory-write-packet-size" when not connected
Currently "show remote memory-write-packet-size" says that the packet
size is limited to whatever is stored in the remote_state global, even
if not connected to a target.
When we get to support multiple instances of remote targets, there
won't be a remote_state global anymore, so that must be replaced by
something else.
Since it doesn't make sense to print the limit of the packet size of a
non-existing connection, this patch makes us say that the limit will
be further reduced when we connect.
The text is taken from the command's online help, which says:
"The actual limit is further reduced dependent on the target."
Note that a value of "0" is special, as per "help set remote
memory-write-packet-size":
~~~
Specify the number of bytes in a packet or 0 (zero) for the
default packet size.
~~~
I've tweaked "show remote memory-write-packet-size" to include
"(default)" in the output in that case, like this:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0 (default). The actual limit will be further reduced dependent on the target.
While working on this, I noticed that an explicit "set remote
write-packet-size 0" does not makes GDB go back to the exact same
state as the default state when GDB starts up:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0. [...]
^^
(gdb) set remote memory-write-packet-size 0
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 16384. [...]
^^^^^
The "16384" number comes from DEFAULT_MAX_MEMORY_PACKET_SIZE.
This happens because git commit a5c0808e221c ("gdb: remove packet size
limit") at
<https://sourceware.org/ml/gdb-patches/2015-08/msg00743.html>, added
this:
/* So that the query shows the correct value. */
if (size <= 0)
size = DEFAULT_MAX_MEMORY_PACKET_SIZE;
to set_memory_packet_size, but despite what the comment suggests, that
also has the side-effect of recording DEFAULT_MAX_MEMORY_PACKET_SIZE
in config->size.
Finally, DEFAULT_MAX_MEMORY_PACKET_SIZE only makes sense for "set
remote memory-write-packet-size fixed", so I've renamed it
accordingly, to make it a little bit clearer.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (DEFAULT_MAX_MEMORY_PACKET_SIZE): Rename to ...
(DEFAULT_MAX_MEMORY_PACKET_SIZE_FIXED): ... this.
(get_fixed_memory_packet_size): New.
(get_memory_packet_size): Use it.
(set_memory_packet_size): Don't override the config size with
DEFAULT_MAX_MEMORY_PACKET_SIZE.
(show_memory_packet_size): Use get_fixed_memory_packet_size.
Don't refer to get_memory_packet_size if not connected to a remote
target. Show "(default)" if configured size is 0.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* gdb.base/remote.exp: Adjust expected output of "show remote
memory-write-packet-size". Add tests for "set remote
memory-write-packet-size 0" and "set remote
memory-write-packet-size fixed/limit".
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/remote.exp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp index 26361af..ba34441 100644 --- a/gdb/testsuite/gdb.base/remote.exp +++ b/gdb/testsuite/gdb.base/remote.exp @@ -35,7 +35,7 @@ if {$result != "" } then { # gdb_test "show remote memory-write-packet-size" \ - "The memory-write-packet-size is 0. Packets are limited to \[0-9\]+ bytes." \ + "The memory-write-packet-size is 0 \\(default\\). The actual limit will be further reduced dependent on the target\." \ "write-packet default" gdb_test "set remote memory-write-packet-size" \ @@ -44,14 +44,38 @@ gdb_test "set remote memory-write-packet-size" \ gdb_test_no_output "set remote memory-write-packet-size 20" gdb_test "show remote memory-write-packet-size" \ - "The memory-write-packet-size is 20. Packets are limited to 20 bytes." \ + "The memory-write-packet-size is 20. The actual limit will be further reduced dependent on the target\." \ "set write-packet - small" gdb_test_no_output "set remote memory-write-packet-size 1" gdb_test "show remote memory-write-packet-size" \ - "The memory-write-packet-size is 1. Packets are limited to 20 bytes." \ + "The memory-write-packet-size is 1. The actual limit will be further reduced dependent on the target\." \ "set write-packet - very-small" +gdb_test_no_output "set remote memory-write-packet-size 0" +gdb_test "show remote memory-write-packet-size" \ + "The memory-write-packet-size is 0 \\(default\\). The actual limit will be further reduced dependent on the target\." \ + "write-packet default again" + +set test "set remote memory-write-packet-size fixed" +gdb_test_multiple $test $test { + -re "Change the packet size. .y or n. " { + gdb_test_multiple "y" $test { + -re "$gdb_prompt $" { + pass $test + } + } + } +} +gdb_test "show remote memory-write-packet-size" \ + "The memory-write-packet-size is 0 \\(default\\). Packets are fixed at 16384 bytes\." \ + "write-packet default fixed" + +gdb_test_no_output "set remote memory-write-packet-size limit" +gdb_test "show remote memory-write-packet-size" \ + "The memory-write-packet-size is 0 \\(default\\). The actual limit will be further reduced dependent on the target\." \ + "write-packet default limit again" + # # Part TWO: Check the download behavior. # |