diff options
author | Tom Tromey <tom@tromey.com> | 2018-02-13 13:34:45 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-02-14 08:09:53 -0700 |
commit | 692d6f9760bc67b68a5c96baac47067fd7dfa711 (patch) | |
tree | 32c976a3a03a840fd0457431758cbd9fb405dcf3 | |
parent | e0cc99a62f9ceb9a0db0b5bc28711fd8c82a6151 (diff) | |
download | gdb-692d6f9760bc67b68a5c96baac47067fd7dfa711.zip gdb-692d6f9760bc67b68a5c96baac47067fd7dfa711.tar.gz gdb-692d6f9760bc67b68a5c96baac47067fd7dfa711.tar.bz2 |
Constify target_so_ops::bfd_open
This constifies the bfd_open method of struct target_so_ops.
gdb/ChangeLog
2018-02-14 Tom Tromey <tom@tromey.com>
* solist.h (struct target_so_ops) <bfd_open>: Make pathname
const.
(solib_bfd_open): Make pathname const.
* solib.c (solib_bfd_open): Make pathname const.
* solib-spu.c (spu_bfd_fopen): Make name const.
(spu_bfd_open): Make pathname const.
* solib-darwin.c (darwin_bfd_open): Make pathname const.
* solib-aix.c (solib_aix_bfd_open): Make pathname const.
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/solib-aix.c | 4 | ||||
-rw-r--r-- | gdb/solib-darwin.c | 2 | ||||
-rw-r--r-- | gdb/solib-spu.c | 6 | ||||
-rw-r--r-- | gdb/solib.c | 2 | ||||
-rw-r--r-- | gdb/solist.h | 4 |
6 files changed, 20 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 76c160a..7b4c5b4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2018-02-14 Tom Tromey <tom@tromey.com> + * solist.h (struct target_so_ops) <bfd_open>: Make pathname + const. + (solib_bfd_open): Make pathname const. + * solib.c (solib_bfd_open): Make pathname const. + * solib-spu.c (spu_bfd_fopen): Make name const. + (spu_bfd_open): Make pathname const. + * solib-darwin.c (darwin_bfd_open): Make pathname const. + * solib-aix.c (solib_aix_bfd_open): Make pathname const. + +2018-02-14 Tom Tromey <tom@tromey.com> + * symfile.c (symfile_bfd_open): Update. * source.h (openp, source_full_path_of, find_and_open_source): Change argument type to unique_xmalloc_ptr. diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index aa0e0d2..f11cbcd 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -602,7 +602,7 @@ solib_aix_in_dynsym_resolve_code (CORE_ADDR pc) /* Implement the "bfd_open" target_so_ops method. */ static gdb_bfd_ref_ptr -solib_aix_bfd_open (char *pathname) +solib_aix_bfd_open (const char *pathname) { /* The pathname is actually a synthetic filename with the following form: "/path/to/sharedlib(member.o)" (double-quotes excluded). @@ -611,7 +611,7 @@ solib_aix_bfd_open (char *pathname) FIXME: This is a little hacky. Perhaps we should provide access to the solib's lm_info here? */ const int path_len = strlen (pathname); - char *sep; + const char *sep; int filename_len; int found_file; diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index ed8f9da..cf15148 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -617,7 +617,7 @@ darwin_lookup_lib_symbol (struct objfile *objfile, } static gdb_bfd_ref_ptr -darwin_bfd_open (char *pathname) +darwin_bfd_open (const char *pathname) { int found_file; diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c index d0d63b5..943ebf5 100644 --- a/gdb/solib-spu.c +++ b/gdb/solib-spu.c @@ -320,7 +320,7 @@ spu_bfd_iovec_stat (bfd *abfd, void *stream, struct stat *sb) } static gdb_bfd_ref_ptr -spu_bfd_fopen (char *name, CORE_ADDR addr) +spu_bfd_fopen (const char *name, CORE_ADDR addr) { CORE_ADDR *open_closure = XNEW (CORE_ADDR); @@ -342,9 +342,9 @@ spu_bfd_fopen (char *name, CORE_ADDR addr) /* Open shared library BFD. */ static gdb_bfd_ref_ptr -spu_bfd_open (char *pathname) +spu_bfd_open (const char *pathname) { - char *original_name = strrchr (pathname, '@'); + const char *original_name = strrchr (pathname, '@'); asection *spu_name; unsigned long long addr; int fd; diff --git a/gdb/solib.c b/gdb/solib.c index 41fba90..f3eea39 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -478,7 +478,7 @@ solib_bfd_fopen (const char *pathname, int fd) /* Find shared library PATHNAME and open a BFD for it. */ gdb_bfd_ref_ptr -solib_bfd_open (char *pathname) +solib_bfd_open (const char *pathname) { int found_file; const struct bfd_arch_info *b; diff --git a/gdb/solist.h b/gdb/solist.h index 1df45e4..6875d1b 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -129,7 +129,7 @@ struct target_so_ops int (*in_dynsym_resolve_code) (CORE_ADDR pc); /* Find and open shared library binary file. */ - gdb_bfd_ref_ptr (*bfd_open) (char *pathname); + gdb_bfd_ref_ptr (*bfd_open) (const char *pathname); /* Optional extra hook for finding and opening a solib. If TEMP_PATHNAME is non-NULL: If the file is successfully opened a @@ -204,7 +204,7 @@ extern gdb::unique_xmalloc_ptr<char> solib_find (const char *in_pathname, extern gdb_bfd_ref_ptr solib_bfd_fopen (const char *pathname, int fd); /* Find solib binary file and open it. */ -extern gdb_bfd_ref_ptr solib_bfd_open (char *in_pathname); +extern gdb_bfd_ref_ptr solib_bfd_open (const char *in_pathname); /* FIXME: gdbarch needs to control this variable. */ extern struct target_so_ops *current_target_so_ops; |