aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-19 11:51:04 +0930
committerAlan Modra <amodra@gmail.com>2019-09-20 18:04:02 +0930
commit00f93c449228e69f2161405b1f49b406e88785f0 (patch)
tree89558e119955a9ae7847d60870efdfaa3d42dfe7 /gdb
parent3f9aad111cea2f25877d0a6b404956769c14faee (diff)
downloadgdb-00f93c449228e69f2161405b1f49b406e88785f0.zip
gdb-00f93c449228e69f2161405b1f49b406e88785f0.tar.gz
gdb-00f93c449228e69f2161405b1f49b406e88785f0.tar.bz2
bfd macro conversion to inline functions
This converts some of the macros that access struct bfd fields to inline functions. bfd/ * archive.c (bfd_generic_archive_p): Use bfd_set_thin_archive. * bfd-in.h (bfd_get_filename, bfd_get_cacheable, bfd_get_format), (bfd_get_target, bfd_get_flavour, bfd_family_coff, bfd_big_endian), (bfd_little_endian, bfd_header_big_endian, bfd_header_little_endian), (bfd_get_file_flags, bfd_applicable_file_flags), (bfd_applicable_section_flags, bfd_has_map, bfd_is_thin_archive), (bfd_valid_reloc_types, bfd_usrdata, bfd_get_start_address), (bfd_get_symcount, bfd_get_outsymbols, bfd_count_sections), (bfd_get_dynamic_symcount, bfd_get_symbol_leading_char): Delete. * bfd/bfd.c (bfd_get_filename, bfd_get_cacheable, bfd_get_format), (bfd_get_file_flags, bfd_get_start_address, bfd_get_symcount), (bfd_get_dynamic_symcount, bfd_get_outsymbols, bfd_count_sections), (bfd_has_map, bfd_is_thin_archive, bfd_set_thin_archive), (bfd_usrdata, bfd_set_usrdata): New inline functions. * targets.c (bfd_get_target, bfd_get_flavour), (bfd_applicable_file_flags, bfd_family_coff, bfd_big_endian), (bfd_little_endian, bfd_header_big_endian), (bfd_header_little_endian, bfd_applicable_section_flags), (bfd_get_symbol_leading_char): New inline functions. * bfd-in2.h: Regenerate. binutils/ * ar.c (write_archive): Use bfd_set_thin_archive. gdb/ * gdb_bfd.c (gdb_bfd_ref, gdb_bfd_unref): Use bfd_set_usrdata. * dwarf2read.c (dwarf2_read_gdb_index, dwarf2_read_debug_names), (read_indirect_string_from_dwz): Use bfd accessor. * dwarf2read.h (struct dwz_file <filename>): Likewise. * machoread.c (macho_symfile_read_all_oso): Likewise. * solib.c (solib_bfd_open): Likewise. ld/ * ldelf.c (ldelf_after_open, ldelf_place_orphan * ldlang.c (walk_wild_file, lang_process): Use bfd_usrdata. (load_symbols, ldlang_add_file): Use bfd_set_usrdata. * ldmain.c (add_archive_element): Use bfd_usrdata. * ldlang.h (bfd_input_just_syms): New inline function. * emultempl/aarch64elf.em (build_section_lists): Use it. * emultempl/mmo.em (mmo_place_orphan): Likewise. * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise. * emultempl/ppc64elf.em (build_section_lists): Likewise. sim/ * ppc/emul_generic.c (emul_add_tree_options): Delete old bfd code.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dwarf2read.c14
-rw-r--r--gdb/dwarf2read.h2
-rw-r--r--gdb/gdb_bfd.c4
-rw-r--r--gdb/machoread.c4
-rw-r--r--gdb/solib.c6
6 files changed, 24 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 41a0024..5314b27 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2019-09-20 Alan Modra <amodra@gmail.com>
+
+ * gdb_bfd.c (gdb_bfd_ref, gdb_bfd_unref): Use bfd_set_usrdata.
+ * dwarf2read.c (dwarf2_read_gdb_index, dwarf2_read_debug_names),
+ (read_indirect_string_from_dwz): Use bfd accessor.
+ * dwarf2read.h (struct dwz_file <filename>): Likewise.
+ * machoread.c (macho_symfile_read_all_oso): Likewise.
+ * solib.c (solib_bfd_open): Likewise.
+
2019-09-19 Christian Biesinger <cbiesinger@google.com>
* eval.c: Move declaration of overload_resolution to...
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 5e71ded..1052501 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3584,14 +3584,14 @@ dwarf2_read_gdb_index
return 0;
if (!read_gdb_index_from_buffer (objfile,
- bfd_get_filename (dwz->dwz_bfd), 1,
- dwz_index_content, &dwz_map,
+ bfd_get_filename (dwz->dwz_bfd.get ()),
+ 1, dwz_index_content, &dwz_map,
&dwz_list, &dwz_list_elements,
&dwz_types_ignore,
&dwz_types_elements_ignore))
{
warning (_("could not read '.gdb_index' section from %s; skipping"),
- bfd_get_filename (dwz->dwz_bfd));
+ bfd_get_filename (dwz->dwz_bfd.get ()));
return 0;
}
}
@@ -5596,11 +5596,11 @@ dwarf2_read_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile)
if (dwz != NULL)
{
if (!read_debug_names_from_section (objfile,
- bfd_get_filename (dwz->dwz_bfd),
+ bfd_get_filename (dwz->dwz_bfd.get ()),
&dwz->debug_names, dwz_map))
{
warning (_("could not read '.debug_names' section from %s; skipping"),
- bfd_get_filename (dwz->dwz_bfd));
+ bfd_get_filename (dwz->dwz_bfd.get ()));
return false;
}
}
@@ -19759,11 +19759,11 @@ read_indirect_string_from_dwz (struct objfile *objfile, struct dwz_file *dwz,
if (dwz->str.buffer == NULL)
error (_("DW_FORM_GNU_strp_alt used without .debug_str "
"section [in module %s]"),
- bfd_get_filename (dwz->dwz_bfd));
+ bfd_get_filename (dwz->dwz_bfd.get ()));
if (str_offset >= dwz->str.size)
error (_("DW_FORM_GNU_strp_alt pointing outside of "
".debug_str section [in module %s]"),
- bfd_get_filename (dwz->dwz_bfd));
+ bfd_get_filename (dwz->dwz_bfd.get ()));
gdb_assert (HOST_CHAR_BIT == 8);
if (dwz->str.buffer[str_offset] == '\0')
return NULL;
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index e9b9462..d5a0299 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -417,7 +417,7 @@ struct dwz_file
const char *filename () const
{
- return bfd_get_filename (this->dwz_bfd);
+ return bfd_get_filename (this->dwz_bfd.get ());
}
/* A dwz file can only contain a few sections. */
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 8a67d5e..69618a2 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -546,7 +546,7 @@ gdb_bfd_ref (struct bfd *abfd)
abfd->flags |= BFD_DECOMPRESS;
gdata = new gdb_bfd_data (abfd);
- bfd_usrdata (abfd) = gdata;
+ bfd_set_usrdata (abfd, gdata);
bfd_alloc_data (abfd);
/* This is the first we've seen it, so add it to the hash table. */
@@ -608,7 +608,7 @@ gdb_bfd_unref (struct bfd *abfd)
bfd_free_data (abfd);
delete gdata;
- bfd_usrdata (abfd) = NULL; /* Paranoia. */
+ bfd_set_usrdata (abfd, NULL); /* Paranoia. */
htab_remove_elt (all_bfds, abfd);
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 1795982..a015d29 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -671,7 +671,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
/* Load all oso in this library. */
while (member_bfd != NULL)
{
- const char *member_name = member_bfd->filename;
+ const char *member_name = bfd_get_filename (member_bfd.get ());
int member_len = strlen (member_name);
/* If this member is referenced, add it as a symfile. */
@@ -685,7 +685,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
member_len))
{
macho_add_oso_symfile (oso2, member_bfd,
- bfd_get_filename (member_bfd),
+ bfd_get_filename (member_bfd.get ()),
main_objfile, symfile_flags);
oso2->name = NULL;
break;
diff --git a/gdb/solib.c b/gdb/solib.c
index 86000f6..b9a61e2 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -502,14 +502,14 @@ solib_bfd_open (const char *pathname)
/* Check bfd format. */
if (!bfd_check_format (abfd.get (), bfd_object))
error (_("`%s': not in executable format: %s"),
- bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
+ bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (target_gdbarch ());
if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
warning (_("`%s': Shared library architecture %s is not compatible "
- "with target architecture %s."), bfd_get_filename (abfd),
- bfd_get_arch_info (abfd.get ())->printable_name,
+ "with target architecture %s."), bfd_get_filename (abfd.get ()),
+ bfd_get_arch_info (abfd.get ())->printable_name,
b->printable_name);
return abfd;