aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/remote.c10
-rw-r--r--gdb/testsuite/gdb.base/remote.exp5
2 files changed, 11 insertions, 4 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 75d6bf3..562cc58 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1968,15 +1968,17 @@ add_packet_config_cmd (struct packet_config *config, const char *name,
/* set/show remote NAME-packet {auto,on,off} -- legacy. */
if (legacy)
{
- /* It's not clear who should take ownership of this string, so, for
- now, make it static, and give copies to each of the add_alias_cmd
- calls below. */
- static gdb::unique_xmalloc_ptr<char> legacy_name
+ /* It's not clear who should take ownership of the LEGACY_NAME string
+ created below, so, for now, place the string into a static vector
+ which ensures the strings is released when GDB exits. */
+ static std::vector<gdb::unique_xmalloc_ptr<char>> legacy_names;
+ gdb::unique_xmalloc_ptr<char> legacy_name
= xstrprintf ("%s-packet", name);
add_alias_cmd (legacy_name.get (), cmds.set, class_obscure, 0,
&remote_set_cmdlist);
add_alias_cmd (legacy_name.get (), cmds.show, class_obscure, 0,
&remote_show_cmdlist);
+ legacy_names.emplace_back (std::move (legacy_name));
}
}
diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp
index 1f08694..579dcd4 100644
--- a/gdb/testsuite/gdb.base/remote.exp
+++ b/gdb/testsuite/gdb.base/remote.exp
@@ -195,4 +195,9 @@ gdb_test_no_output "set remote hardware-breakpoint-limit -1"
gdb_test_no_output "set remote hardware-watchpoint-limit 2147483647"
gdb_test_no_output "set remote hardware-breakpoint-limit 2147483647"
+# Check the X/P/p alias commands display the correct packet names.
+foreach pkt {X P p} {
+ gdb_test "show remote ${pkt}-packet" "Support for the `${pkt}' packet is.*"
+}
+
gdb_exit