Use bfd_get_filename throughout gdb
authorAlan Modra <amodra@gmail.com>
Tue, 19 May 2020 22:29:00 +0000 (07:59 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 19 May 2020 22:29:00 +0000 (07:59 +0930)
This patch makes gdb use the inline accessor for all bfd->filename
read accesses.

* coff-pe-read.c (read_pe_exported_syms): Use bfd_get_filename
rather than accessing bfd->filename directly.
* dtrace-probe.c (dtrace_static_probe_ops::get_probes): Likewise,
and use bfd_section_name.
* dwarf2/frame.c (decode_frame_entry): Likewise.
* exec.c (exec_set_section_address): Likewise.
* solib-aix.c (solib_aix_bfd_open): Likewise.
* stap-probe.c (get_stap_base_address): Likewise.
* symfile.c (reread_symbols): Likewise.

gdb/ChangeLog
gdb/coff-pe-read.c
gdb/dtrace-probe.c
gdb/dwarf2/frame.c
gdb/exec.c
gdb/solib-aix.c
gdb/stap-probe.c
gdb/symfile.c

index 93113be33029a18d812742c0e38b7ec3c78210bc..9799e1ed4a97c7aefadf2a18770238fcd36bc44b 100644 (file)
@@ -1,3 +1,15 @@
+2020-05-20  Alan Modra  <amodra@gmail.com>
+
+       * coff-pe-read.c (read_pe_exported_syms): Use bfd_get_filename
+       rather than accessing bfd->filename directly.
+       * dtrace-probe.c (dtrace_static_probe_ops::get_probes): Likewise,
+       and use bfd_section_name.
+       * dwarf2/frame.c (decode_frame_entry): Likewise.
+       * exec.c (exec_set_section_address): Likewise.
+       * solib-aix.c (solib_aix_bfd_open): Likewise.
+       * stap-probe.c (get_stap_base_address): Likewise.
+       * symfile.c (reread_symbols): Likewise.
+
 2020-05-19  Tom Tromey  <tromey@adacore.com>
 
        * sparc64-tdep.c (adi_tag_fd): Update call to target_fileio_open.
index 3ecfb3d06134418225a20efb3b0900bc5f0548ac..9253cb115f63c0adcc1b7bdf38eea0a749f20447 100644 (file)
@@ -342,7 +342,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
   unsigned long exp_funcbase;
   unsigned char *expdata, *erva;
   unsigned long name_rvas, ordinals, nexp, ordbase;
-  char *dll_name = (char *) dll->filename;
+  char *dll_name = (char *) bfd_get_filename (dll);
   int otherix = PE_SECTION_TABLE_SIZE;
   int is_pe64 = 0;
   int is_pe32 = 0;
index c452ac9b476c5f84dfc2326d709075f25939da60..ce96037be21fe210b8462ad65e0b18121d0c2618 100644 (file)
@@ -860,7 +860,7 @@ dtrace_static_probe_ops::get_probes
          else
            complaint (_("could not obtain the contents of"
                         "section '%s' in objfile `%s'."),
-                      sect->name, abfd->filename);
+                      bfd_section_name (sect), bfd_get_filename (abfd));
 
          xfree (dof);
        }
index f7276d48ce79dc339a0c915a593e163b67a70a26..a05f841817aa332597d4e9571832e97083c63aa7 100644 (file)
@@ -2101,21 +2101,21 @@ decode_frame_entry (struct gdbarch *gdbarch,
     case ALIGN4:
       complaint (_("\
 Corrupt data in %s:%s; align 4 workaround apparently succeeded"),
-                unit->dwarf_frame_section->owner->filename,
-                unit->dwarf_frame_section->name);
+                bfd_get_filename (unit->dwarf_frame_section->owner),
+                bfd_section_name (unit->dwarf_frame_section));
       break;
 
     case ALIGN8:
       complaint (_("\
 Corrupt data in %s:%s; align 8 workaround apparently succeeded"),
-                unit->dwarf_frame_section->owner->filename,
-                unit->dwarf_frame_section->name);
+                bfd_get_filename (unit->dwarf_frame_section->owner),
+                bfd_section_name (unit->dwarf_frame_section));
       break;
 
     default:
       complaint (_("Corrupt data in %s:%s"),
-                unit->dwarf_frame_section->owner->filename,
-                unit->dwarf_frame_section->name);
+                bfd_get_filename (unit->dwarf_frame_section->owner),
+                bfd_section_name (unit->dwarf_frame_section));
       break;
     }
 
index 932270a000d0585374414ce4f46e4cd1690705ab..93dd157e583ee729d26081d0f7c7a6ce0793e4ff 100644 (file)
@@ -1173,7 +1173,8 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
   table = current_target_sections;
   for (p = table->sections; p < table->sections_end; p++)
     {
-      if (filename_cmp (filename, p->the_bfd_section->owner->filename) == 0
+      if (filename_cmp (filename,
+                       bfd_get_filename (p->the_bfd_section->owner)) == 0
          && index == p->the_bfd_section->index)
        {
          p->endaddr += address - p->addr;
index 125c8960c20c7ae2e30eb55f0920affcc76e52f9..5da1214a2564867be86ea58ce50f660aa4e71bc1 100644 (file)
@@ -611,7 +611,7 @@ solib_aix_bfd_open (const char *pathname)
     (gdb_bfd_openr_next_archived_file (archive_bfd.get (), NULL));
   while (object_bfd != NULL)
     {
-      if (member_name == object_bfd->filename)
+      if (member_name == bfd_get_filename (object_bfd.get ()))
        break;
 
       object_bfd = gdb_bfd_openr_next_archived_file (archive_bfd.get (),
index 4b1a75f8166ea4e11772442033ac42f8294b99e5..73596446cce51d94e789b1ff3584b8fec807b5a1 100644 (file)
@@ -1606,7 +1606,7 @@ get_stap_base_address (bfd *obfd, bfd_vma *base)
     {
       complaint (_("could not obtain base address for "
                                        "SystemTap section on objfile `%s'."),
-                obfd->filename);
+                bfd_get_filename (obfd));
       return 0;
     }
 
index 01e0726e1eb409cf812827b297502099ddd8dc71..dd8192a67fbba4f40d2b68a3f8e9b0ad86318d50 100644 (file)
@@ -2450,7 +2450,7 @@ reread_symbols (void)
         a `shared library' on AIX is also an archive), then you should
         stat on the archive name, not member name.  */
       if (objfile->obfd->my_archive)
-       res = stat (objfile->obfd->my_archive->filename, &new_statbuf);
+       res = stat (bfd_get_filename (objfile->obfd->my_archive), &new_statbuf);
       else
        res = stat (objfile_name (objfile), &new_statbuf);
       if (res != 0)