Make "gnutarget" const
authorTom Tromey <tom@tromey.com>
Wed, 4 Mar 2020 23:24:08 +0000 (16:24 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 4 Mar 2020 23:30:29 +0000 (16:30 -0700)
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.

gdb/ChangeLog
gdb/corefile.c
gdb/gdbcore.h
gdb/jit.c

index 51785c761271f881d723651c7b5b71eb9152271e..a8c0027001e6d50a93d50d802d6b67babcf06c57 100644 (file)
@@ -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.
index 3b9f8c76052711d9a4790be264742eed6c230e7f..4ce1bb78f2829f869726e9171af5818bf15e9c9e 100644 (file)
@@ -415,7 +415,7 @@ write_memory_signed_integer (CORE_ADDR addr, int len,
 \f
 /* 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;
index 9d0f62bc980689b9eaaf11e91586467d7e99f836..7fef4d809eabd7e6a5d951d78282d537ae917c42 100644 (file)
@@ -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 *);
 
index eeaab70bfe0e649fd900b3f9514bbab90aad19fb..35b7167270d03506abefb8a13e7f7eb2ee7a647f 100644 (file)
--- 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);
 
This page took 0.027267 seconds and 4 git commands to generate.