aboutsummaryrefslogtreecommitdiff
path: root/gdbserver
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-09-15 08:38:22 -0600
committerTom Tromey <tromey@adacore.com>2020-09-15 08:38:22 -0600
commitdb92ac4568f1d4cc1a3409098d033afbe8b555f5 (patch)
tree9acf4726c5541a4702d58f6af0da8c747e403c8d /gdbserver
parent7e30b1ebbf2fcf5e6bcfc3a7791d9a52614dcc43 (diff)
downloadgdb-db92ac4568f1d4cc1a3409098d033afbe8b555f5.zip
gdb-db92ac4568f1d4cc1a3409098d033afbe8b555f5.tar.gz
gdb-db92ac4568f1d4cc1a3409098d033afbe8b555f5.tar.bz2
Use arrays rather than pointers for global string constants
My understanding is that it's mildly better to use a static const array, as opposed to a "const char *", for a global string constant, when possible. This makes sense to me because the pointer requires a load from an address, whereas the array is just the address. So, I searched for these in gdb and gdbserver. This patch fixes the ones I found. gdb/ChangeLog 2020-09-15 Tom Tromey <tromey@adacore.com> * unittests/memory-map-selftests.c (valid_mem_map): Now array. * ui-style.c (ansi_regex_text): Now array. * rust-exp.y (number_regex_text): Now array. * linespec.c (linespec_quote_characters): Now array. * jit.c (jit_break_name, jit_descriptor_name, reader_init_fn_sym): Now arrays. gdbserver/ChangeLog 2020-09-15 Tom Tromey <tromey@adacore.com> * linux-x86-low.cc (xmltarget_i386_linux_no_xml) (xmltarget_amd64_linux_no_xml): Now arrays.
Diffstat (limited to 'gdbserver')
-rw-r--r--gdbserver/ChangeLog5
-rw-r--r--gdbserver/linux-x86-low.cc4
2 files changed, 7 insertions, 2 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 3b08ef3..576c96e 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2020-09-15 Tom Tromey <tromey@adacore.com>
+
+ * linux-x86-low.cc (xmltarget_i386_linux_no_xml)
+ (xmltarget_amd64_linux_no_xml): Now arrays.
+
2020-09-14 Tom Tromey <tromey@adacore.com>
* tracepoint.cc (eval_result_names): Now const.
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index 37d3626..eeaced8 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -58,13 +58,13 @@ static unsigned char small_jump_insn[] = { 0x66, 0xe9, 0, 0 };
/* Backward compatibility for gdb without XML support. */
-static const char *xmltarget_i386_linux_no_xml = "@<target>\
+static const char xmltarget_i386_linux_no_xml[] = "@<target>\
<architecture>i386</architecture>\
<osabi>GNU/Linux</osabi>\
</target>";
#ifdef __x86_64__
-static const char *xmltarget_amd64_linux_no_xml = "@<target>\
+static const char xmltarget_amd64_linux_no_xml[] = "@<target>\
<architecture>i386:x86-64</architecture>\
<osabi>GNU/Linux</osabi>\
</target>";