aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-03-04 16:24:08 -0700
committerTom Tromey <tom@tromey.com>2020-03-04 16:30:29 -0700
commit4e7625fde223fd0c98f09f41fe924e7317a82e1a (patch)
tree30f8214f883c378b30abc9ec95c9d84765ff6f2c
parentbaf09cba8f97be8044f7422cb31b1cb3f23e2762 (diff)
downloadgdb-4e7625fde223fd0c98f09f41fe924e7317a82e1a.zip
gdb-4e7625fde223fd0c98f09f41fe924e7317a82e1a.tar.gz
gdb-4e7625fde223fd0c98f09f41fe924e7317a82e1a.tar.bz2
Make "gnutarget" const
I noticed that gnutarget was not "const". Since writing through this pointer would probably be a bug, I think it ought to be. This patch makes the change. gdb/ChangeLog 2020-03-04 Tom Tromey <tom@tromey.com> * jit.c (bfd_open_from_target_memory): Make "target" const. * corefile.c (gnutarget): Now const. * gdbcore.h (gnutarget): Now const.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/corefile.c2
-rw-r--r--gdb/gdbcore.h2
-rw-r--r--gdb/jit.c3
4 files changed, 10 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 51785c7..a8c0027 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-04 Tom Tromey <tom@tromey.com>
+
+ * jit.c (bfd_open_from_target_memory): Make "target" const.
+ * corefile.c (gnutarget): Now const.
+ * gdbcore.h (gnutarget): Now const.
+
2020-03-04 Hannes Domani <ssbssa@yahoo.de>
* NEWS: Mention support for WOW64 processes.
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 3b9f8c7..4ce1bb7 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -415,7 +415,7 @@ write_memory_signed_integer (CORE_ADDR addr, int len,
/* The current default bfd target. Points to storage allocated for
gnutarget_string. */
-char *gnutarget;
+const char *gnutarget;
/* Same thing, except it is "auto" not NULL for the default case. */
static char *gnutarget_string;
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 9d0f62b..7fef4d8 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -164,7 +164,7 @@ extern void validate_exec_file (int from_tty);
/* The current default bfd target. */
-extern char *gnutarget;
+extern const char *gnutarget;
extern void set_gnutarget (const char *);
diff --git a/gdb/jit.c b/gdb/jit.c
index eeaab70..35b7167 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -136,7 +136,8 @@ mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
/* Open a BFD from the target's memory. */
static gdb_bfd_ref_ptr
-bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target)
+bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size,
+ const char *target)
{
struct target_buffer *buffer = XNEW (struct target_buffer);