aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-09-08 11:38:24 -0600
committerTom Tromey <tom@tromey.com>2019-09-11 07:02:46 -0600
commit64b2d4a0a4e4f80d2aa2e52c6eec3186e76fc397 (patch)
tree33767370cb253d485e62fb6d421d227a80f4eccd /gdb
parent1ff5d5c46342727ad6728732e122f963fbb2268b (diff)
downloadgdb-64b2d4a0a4e4f80d2aa2e52c6eec3186e76fc397.zip
gdb-64b2d4a0a4e4f80d2aa2e52c6eec3186e76fc397.tar.gz
gdb-64b2d4a0a4e4f80d2aa2e52c6eec3186e76fc397.tar.bz2
Introduce bfd_set_filename
This introduces a new bfd_set_filename function, which is then used in various spots in gdb. This allows for the removal of some casts. bfd/ChangeLog 2019-09-11 Tom Tromey <tom@tromey.com> * opncls.c (bfd_set_filename): New function. * bfd-in2.h: Regenerate. gdb/ChangeLog 2019-09-11 Tom Tromey <tom@tromey.com> * symfile-mem.c (symbol_file_add_from_memory): Use bfd_set_filename. * solib-darwin.c (darwin_bfd_open): Use bfd_set_filename. * solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/solib-aix.c8
-rw-r--r--gdb/solib-darwin.c3
-rw-r--r--gdb/symfile-mem.c6
4 files changed, 14 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dace64e..e4b18fa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-09-11 Tom Tromey <tom@tromey.com>
+
+ * symfile-mem.c (symbol_file_add_from_memory): Use
+ bfd_set_filename.
+ * solib-darwin.c (darwin_bfd_open): Use bfd_set_filename.
+ * solib-aix.c (solib_aix_bfd_open): Use bfd_set_filename.
+
2019-09-10 Tom Tromey <tromey@adacore.com>
* dwarf-index-write.c (write_psymbols): Extend error message.
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 2b54442..0c8a182 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -643,10 +643,10 @@ solib_aix_bfd_open (const char *pathname)
along with appended parenthesized member name in order to allow commands
listing all shared libraries to display. Otherwise, we would only be
displaying the name of the archive member object. */
- xfree ((char *) bfd_get_filename (object_bfd.get ()));
- object_bfd->filename = xstrprintf ("%s%s",
- bfd_get_filename (archive_bfd.get ()),
- sep);
+ bfd_set_filename (object_bfd.get (),
+ xstrprintf ("%s%s",
+ bfd_get_filename (archive_bfd.get ()),
+ sep));
return object_bfd;
}
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 3dd30d2..778c6d9 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -670,8 +670,7 @@ darwin_bfd_open (const char *pathname)
/* The current filename for fat-binary BFDs is a name generated
by BFD, usually a string containing the name of the architecture.
Reset its value to the actual filename. */
- xfree ((char *) bfd_get_filename (res.get ()));
- res->filename = xstrdup (pathname);
+ bfd_set_filename (res.get (), xstrdup (pathname));
return res;
}
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 6d1deae..05542c1 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -101,11 +101,9 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
/* Manage the new reference for the duration of this function. */
gdb_bfd_ref_ptr nbfd_holder = gdb_bfd_ref_ptr::new_reference (nbfd);
- xfree ((char *) bfd_get_filename (nbfd));
if (name == NULL)
- nbfd->filename = xstrdup ("shared object read from target memory");
- else
- nbfd->filename = name;
+ name = xstrdup ("shared object read from target memory");
+ bfd_set_filename (nbfd, name);
if (!bfd_check_format (nbfd, bfd_object))
error (_("Got object file from memory but can't read symbols: %s."),