bfd: Add bfd_find_nearest_line_with_alt
authorAaron Merey <amerey@redhat.com>
Fri, 2 Sep 2022 18:16:30 +0000 (14:16 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 6 Sep 2022 14:42:50 +0000 (10:42 -0400)
bfd_find_nearest_line_with_alt functions like bfd_find_nearest_line with
the addition of a parameter for specifying the filename of a supplementary
debug file such as one referenced by .gnu_debugaltlink or .debug_sup.

This patch focuses on implementing bfd_find_nearest_line_with_alt
support for ELF/DWARF2 .gnu_debugaltlink. For other targets this
function simply sets the invalid_operation bfd_error.

36 files changed:
bfd/ChangeLog
bfd/aout-target.h
bfd/bfd-in2.h
bfd/bfd.c
bfd/binary.c
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/dwarf2.c
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-mips.c
bfd/elf64-mips.c
bfd/elfn32-mips.c
bfd/elfxx-mips.h
bfd/elfxx-target.h
bfd/i386msdos.c
bfd/ihex.c
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/libecoff.h
bfd/mach-o.h
bfd/mmo.c
bfd/pef.c
bfd/plugin.c
bfd/ppcboot.c
bfd/som.h
bfd/srec.c
bfd/syms.c
bfd/targets.c
bfd/tekhex.c
bfd/verilog.c
bfd/vms-alpha.c
bfd/wasm-module.c
bfd/xsym.c

index 50e60dad102bf56fd10efaa1659f6acabac55e39..a0e1e87ea26ff74641bb9086995e1a29d4ef9050 100644 (file)
@@ -1,3 +1,52 @@
+2022-09-02  Aaron Merey  <amerey@redhat.com>
+
+       * aout-target.h (MY_find_nearest_line_with_alt): New macro.
+       * bfd-in2.h: Regenerate.
+       * bfd.c (bfd_find_nearest_line_with_alt): New macro.
+       * binary.c (binary_find_nearest_line_with_alt): New macro.
+       * coff-rs6000.c (_bfd_xcoff_find_nearest_line_with_alt): New macro.
+       (rs6000_xcoff64_vec): Add coff_find_nearest_line_with_alt.
+       * dwarf2.c (_bfd_dwarf2_find_nearest_line): Calls
+       _bfd_dwarf2_find_nearest_line_with_alt.
+       (_bfd_dwarf2_find_nearest_line_with_alt): New function. Implements the
+       former _bfd_dwarf2_find_nearest_line. Adds parameter alt_filename.
+       Attempt to open alt_filename and use it as the .dwz file if not NULL.
+       * elf-bfd.h (_bfd_elf_find_nearest_line_with_alt): New declaration.
+       * elf.c (_bfd_elf_find_nearest_line): Calls
+       _bfd_elf_find_nearest_line_with_alt.
+       (_bfd_elf_find_nearest_line_with_alt): New function. Implements the
+       former _bfd_elf_find_nearest_line. Adds parameter alt_filename.
+       * elf32-mips.c (bfd_elf32_find_nearest_line_with_alt): New macro.
+       * elf64-mips.c (bfd_elf64_find_nearest_line_with_alt): New macro.
+       * elfn32-mips.c (bfd_elf32_find_nearest_line_with_alt): New macro.
+       * elfxx-mips.h (_bfd_mips_elf_find_nearest_line_with_alt): New macro.
+       * elfxx-target.h (bfd_elfNN_find_nearest_line_with_alt): New macro.
+       * i386mdos.c (msdos_find_nearest_line_with_alt): New macro.
+       * ihex.c (ihex_find_nearest_line_with_alt): New macro.
+       * libbfd-in.h (_bfd_nosymbols_find_nearest_line_with_alt): New
+       declaration.
+       (_bfd_dwarf2_find_nearest_line_with_alt): New declaration.
+       * libbfd.h: Regenerate.
+       * libcoff-in.h (coff_find_nearest_line_with_alt): New macro.
+       * libcoff.h: Regenerate.
+       * libecoff.h (_bfd_ecoff_find_nearest_line_with_alt): New macro.
+       * mach-o.h (bfd_mach_o_find_nearest_line_with_alt): New macro.
+       * mmo.c (mmo_find_nearest_line_with_alt): New macro.
+       * pef.c (bfd_pef_find_nearest_line_with_alt): New macro.
+       * plugin.c (bfd_plugin_find_nearest_line_with_alt): New macro.
+       * ppcboot.c (ppcboot_find_nearest_line_with_alt): New macro.
+       * som.h (som_find_nearest_line_with_alt): New macro.
+       * srec.c (srec_find_nearest_line_with_alt): New macro.
+       * syms.c (_bfd_nosymbols_find_nearest_line_with_alt): New function.
+       * targets.c (BFD_JUMP_TABLE_SYMBOLS): Add symbol for
+       NAME##_find_nearest_line_with_alt.
+       (_bfd_find_nearest_line_with_alt): Add declaration.
+       * tekhex.c (tekhex_find_nearest_line_with_alt): New macro.
+       * verilog.c (verilog_find_nearest_line_with_alt): New macro.
+       * vms-alpha.c (_bfd_vms_find_nearest_line_with_alt): New macro.
+       * wasm-module.c (wasm_find_nearest_line_with_alt): New macro.
+       * xsym.c (bfd_sym_find_nearest_line_with_alt): New macro.
+
 2022-09-02  Frederic Cambus  <fred@statdns.com>
 
        * config.bfd (arm-*-openbsd*): Restore target.
index bce90f1453089e5ae9de31ad7c56b8f89033e677..1b8c2f13fa83dc9e331bca88870a40380b314431 100644 (file)
@@ -475,6 +475,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
 #ifndef MY_find_nearest_line
 #define MY_find_nearest_line NAME (aout, find_nearest_line)
 #endif
+#ifndef MY_find_nearest_line_with_alt
+#define MY_find_nearest_line_with_alt _bfd_nosymbols_find_nearest_line_with_alt
+#endif
 #ifndef MY_find_line
 #define MY_find_line _bfd_nosymbols_find_line
 #endif
index 6aefdd7cdb2dd84d6f5476cd00484597566fa07e..79fcc4eb912cae7057afa238e67798f54a18d9ff 100644 (file)
@@ -7162,6 +7162,11 @@ bool bfd_set_private_flags (bfd *abfd, flagword flags);
        BFD_SEND (abfd, _bfd_find_nearest_line, \
                  (abfd, syms, sec, off, file, func, line, NULL))
 
+#define bfd_find_nearest_line_with_alt(abfd, alt_filename, sec, syms, off, \
+                                       file, func, line, disc) \
+       BFD_SEND (abfd, _bfd_find_nearest_line_with_alt, \
+                 (abfd, alt_filename, syms, sec, off, file, func, line, disc))
+
 #define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
                                            line, disc) \
        BFD_SEND (abfd, _bfd_find_nearest_line, \
@@ -7554,6 +7559,7 @@ typedef struct bfd_target
   NAME##_bfd_is_target_special_symbol, \
   NAME##_get_lineno, \
   NAME##_find_nearest_line, \
+  NAME##_find_nearest_line_with_alt, \
   NAME##_find_line, \
   NAME##_find_inliner_info, \
   NAME##_bfd_make_debug_symbol, \
@@ -7584,6 +7590,11 @@ typedef struct bfd_target
                                   struct bfd_section *, bfd_vma,
                                   const char **, const char **,
                                   unsigned int *, unsigned int *);
+  bool (*_bfd_find_nearest_line_with_alt) (bfd *, const char *,
+                                           struct bfd_symbol **,
+                                           struct bfd_section *, bfd_vma,
+                                           const char **, const char **,
+                                           unsigned int *, unsigned int *);
   bool (*_bfd_find_line) (bfd *, struct bfd_symbol **,
                           struct bfd_symbol *, const char **,
                           unsigned int *);
index 5297177fd0b44c2ee7edb7a231f9ff50984f3a4d..0a21db11fd65d043be185d97bf9dea41380e5a7f 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2050,6 +2050,11 @@ DESCRIPTION
 .      BFD_SEND (abfd, _bfd_find_nearest_line, \
 .                (abfd, syms, sec, off, file, func, line, NULL))
 .
+.#define bfd_find_nearest_line_with_alt(abfd, alt_filename, sec, syms, off, \
+.                                      file, func, line, disc) \
+.      BFD_SEND (abfd, _bfd_find_nearest_line_with_alt, \
+.                (abfd, alt_filename, syms, sec, off, file, func, line, disc))
+.
 .#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
 .                                          line, disc) \
 .      BFD_SEND (abfd, _bfd_find_nearest_line, \
index 999d41c0611403c4ee34732fdce2d5e384f58f59..7abf4611af0c2138eb7f603e255795f637f2ffe7 100644 (file)
@@ -206,6 +206,7 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
 #define binary_bfd_is_local_label_name     bfd_generic_is_local_label_name
 #define binary_get_lineno                 _bfd_nosymbols_get_lineno
 #define binary_find_nearest_line          _bfd_nosymbols_find_nearest_line
+#define binary_find_nearest_line_with_alt  _bfd_nosymbols_find_nearest_line_with_alt
 #define binary_find_line                  _bfd_nosymbols_find_line
 #define binary_find_inliner_info          _bfd_nosymbols_find_inliner_info
 #define binary_bfd_make_debug_symbol      _bfd_nosymbols_bfd_make_debug_symbol
index 3f0753e5bfc766e5a868a15d57ba10f97925b544..bfa999d69807c42a5ede7d5eee6e949d3cf22d96 100644 (file)
@@ -4409,6 +4409,8 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
   coff_bfd_is_target_special_symbol
 #define _bfd_xcoff_get_lineno coff_get_lineno
 #define _bfd_xcoff_find_nearest_line coff_find_nearest_line
+#define _bfd_xcoff_find_nearest_line_with_alt \
+coff_find_nearest_line_with_alt
 #define _bfd_xcoff_find_line coff_find_line
 #define _bfd_xcoff_find_inliner_info coff_find_inliner_info
 #define _bfd_xcoff_bfd_make_debug_symbol coff_bfd_make_debug_symbol
index c5dc95c1836f2c67935cd63c846c84f38df7c030..fa57910a811d78b7365f377939a491a7b1ed3042 100644 (file)
@@ -2667,6 +2667,7 @@ const bfd_target rs6000_xcoff64_vec =
     coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
+    coff_find_nearest_line_with_alt,
     coff_find_line,
     coff_find_inliner_info,
     coff_bfd_make_debug_symbol,
@@ -2939,6 +2940,7 @@ const bfd_target rs6000_xcoff64_aix_vec =
     coff_bfd_is_target_special_symbol,
     coff_get_lineno,
     coff_find_nearest_line,
+    coff_find_nearest_line_with_alt,
     coff_find_line,
     coff_find_inliner_info,
     coff_bfd_make_debug_symbol,
index c513ef180bceaf6857891b7b66925f3ff077083c..c55a3624367554c0710f2060e06aa19316d67b9e 100644 (file)
@@ -5699,18 +5699,7 @@ _bfd_dwarf2_find_symbol_bias (asymbol ** symbols, void ** pinfo)
   return result;
 }
 
-/* Find the source code location of SYMBOL.  If SYMBOL is NULL
-   then find the nearest source code location corresponding to
-   the address SECTION + OFFSET.
-   Returns 1 if the line is found without error and fills in
-   FILENAME_PTR and LINENUMBER_PTR.  In the case where SYMBOL was
-   NULL the FUNCTIONNAME_PTR is also filled in.
-   Returns 2 if partial information from _bfd_elf_find_function is
-   returned (function and maybe file) by looking at symbols.  DWARF2
-   info is present but not regarding the requested code location.
-   Returns 0 otherwise.
-   SYMBOLS contains the symbol table for ABFD.
-   DEBUG_SECTIONS contains the name of the dwarf debug sections.  */
+/* See _bfd_dwarf2_find_nearest_line_with_alt.  */
 
 int
 _bfd_dwarf2_find_nearest_line (bfd *abfd,
@@ -5724,6 +5713,43 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
                               unsigned int *discriminator_ptr,
                               const struct dwarf_debug_section *debug_sections,
                               void **pinfo)
+{
+  return _bfd_dwarf2_find_nearest_line_with_alt
+    (abfd, NULL, symbols, symbol, section, offset, filename_ptr,
+     functionname_ptr, linenumber_ptr, discriminator_ptr, debug_sections,
+     pinfo);
+}
+
+/* Find the source code location of SYMBOL.  If SYMBOL is NULL
+   then find the nearest source code location corresponding to
+   the address SECTION + OFFSET.
+   Returns 1 if the line is found without error and fills in
+   FILENAME_PTR and LINENUMBER_PTR.  In the case where SYMBOL was
+   NULL the FUNCTIONNAME_PTR is also filled in.
+   Returns 2 if partial information from _bfd_elf_find_function is
+   returned (function and maybe file) by looking at symbols.  DWARF2
+   info is present but not regarding the requested code location.
+   Returns 0 otherwise.
+   SYMBOLS contains the symbol table for ABFD.
+   DEBUG_SECTIONS contains the name of the dwarf debug sections.
+   If ALT_FILENAME is given, attempt to open the file and use it
+   as the .gnu_debugaltlink file. Otherwise this file will be
+   searched for when needed.  */
+
+int
+_bfd_dwarf2_find_nearest_line_with_alt
+  (bfd *abfd,
+   const char *alt_filename,
+   asymbol **symbols,
+   asymbol *symbol,
+   asection *section,
+   bfd_vma offset,
+   const char **filename_ptr,
+   const char **functionname_ptr,
+   unsigned int *linenumber_ptr,
+   unsigned int *discriminator_ptr,
+   const struct dwarf_debug_section *debug_sections,
+   void **pinfo)
 {
   /* Read each compilation unit from the section .debug_info, and check
      to see if it contains the address we are searching for.  If yes,
@@ -5755,6 +5781,23 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd,
 
   stash = (struct dwarf2_debug *) *pinfo;
 
+  if (stash->alt.bfd_ptr == NULL && alt_filename != NULL)
+    {
+      bfd *alt_bfd = bfd_openr (alt_filename, NULL);
+
+      if (alt_bfd == NULL)
+       /* bfd_openr will have set the bfd_error.  */
+       return false;
+      if (!bfd_check_format (alt_bfd, bfd_object))
+       {
+         bfd_set_error (bfd_error_wrong_format);
+         bfd_close (alt_bfd);
+         return false;
+       }
+
+      stash->alt.bfd_ptr = alt_bfd;
+    }
+
   do_line = symbol != NULL;
   if (do_line)
     {
index 65bd1128263fc37407f8070a77ae1bf7dc3cab76..f00f87b2779493bd4842767c6a0919afd79ad1ec 100644 (file)
@@ -2333,6 +2333,9 @@ extern bool _bfd_elf_set_arch_mach
 extern bool _bfd_elf_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *);
+extern bool _bfd_elf_find_nearest_line_with_alt
+  (bfd *, const char *, asymbol **, asection *, bfd_vma,
+   const char **, const char **, unsigned int *, unsigned int *);
 extern bool _bfd_elf_find_line
   (bfd *, asymbol **, asymbol *, const char **, unsigned int *);
 extern bool _bfd_elf_find_inliner_info
index 8aba36acb3cd137a93900951c3a27effcc28e6b6..1f427e40a443eb94c629cab73ba5bf576caf5eea 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9339,14 +9339,36 @@ _bfd_elf_find_nearest_line (bfd *abfd,
                            const char **functionname_ptr,
                            unsigned int *line_ptr,
                            unsigned int *discriminator_ptr)
+{
+  return _bfd_elf_find_nearest_line_with_alt (abfd, NULL, symbols, section,
+                                             offset, filename_ptr,
+                                             functionname_ptr, line_ptr,
+                                             discriminator_ptr);
+}
+
+/* Find the nearest line to a particular section and offset,
+   for error reporting.  ALT_BFD representing a .gnu_debugaltlink file
+   can be optionally specified.  */
+
+bool
+_bfd_elf_find_nearest_line_with_alt (bfd *abfd,
+                                    const char *alt_filename,
+                                    asymbol **symbols,
+                                    asection *section,
+                                    bfd_vma offset,
+                                    const char **filename_ptr,
+                                    const char **functionname_ptr,
+                                    unsigned int *line_ptr,
+                                    unsigned int *discriminator_ptr)
 {
   bool found;
 
-  if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset,
-                                    filename_ptr, functionname_ptr,
-                                    line_ptr, discriminator_ptr,
-                                    dwarf_debug_sections,
-                                    &elf_tdata (abfd)->dwarf2_find_line_info))
+  if (_bfd_dwarf2_find_nearest_line_with_alt (abfd, alt_filename, symbols, NULL,
+                                             section, offset, filename_ptr,
+                                             functionname_ptr, line_ptr,
+                                             discriminator_ptr,
+                                             dwarf_debug_sections,
+                                             &elf_tdata (abfd)->dwarf2_find_line_info))
     return true;
 
   if (_bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset,
index b611515990db7991a1e8e012c013d6979742667b..3f92df6ee1168d0c7f416f4d70f2ee61c797824f 100644 (file)
@@ -2573,6 +2573,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
                                        _bfd_mips_elf_is_target_special_symbol
 #define bfd_elf32_get_synthetic_symtab _bfd_mips_elf_get_synthetic_symtab
 #define bfd_elf32_find_nearest_line    _bfd_mips_elf_find_nearest_line
+#define bfd_elf32_find_nearest_line_with_alt \
+                                       _bfd_mips_elf_find_nearest_line_with_alt
 #define bfd_elf32_find_inliner_info    _bfd_mips_elf_find_inliner_info
 #define bfd_elf32_new_section_hook     _bfd_mips_elf_new_section_hook
 #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
index c2c6604ef681beca4b39ba5d7f2061ed0eeb4f17..e3ee0b99d97648296f81f364f2921f28d9df3e3c 100644 (file)
@@ -4792,6 +4792,8 @@ const struct elf_size_info mips_elf64_size_info =
 #define bfd_elf64_bfd_is_target_special_symbol \
                                        _bfd_mips_elf_is_target_special_symbol
 #define bfd_elf64_find_nearest_line    _bfd_mips_elf_find_nearest_line
+#define bfd_elf64_find_nearest_line_with_alt \
+                               _bfd_mips_elf_find_nearest_line_with_alt
 #define bfd_elf64_find_inliner_info    _bfd_mips_elf_find_inliner_info
 #define bfd_elf64_new_section_hook     _bfd_mips_elf_new_section_hook
 #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
index af9845457969184022f2c6a0ab4d80b807fd0c6e..ac604eda5eac81bb80ffc2e0e17e5faa0d4cd685 100644 (file)
@@ -4176,6 +4176,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
 #define bfd_elf32_bfd_is_target_special_symbol \
                                        _bfd_mips_elf_is_target_special_symbol
 #define bfd_elf32_find_nearest_line    _bfd_mips_elf_find_nearest_line
+#define bfd_elf32_find_nearest_line_with_alt \
+                               _bfd_mips_elf_find_nearest_line_with_alt
 #define bfd_elf32_find_inliner_info    _bfd_mips_elf_find_inliner_info
 #define bfd_elf32_new_section_hook     _bfd_mips_elf_new_section_hook
 #define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
index 3be69524c01e76ebe56d9421d8246b99c69ddedb..af6d14c6ce300d037bf846a464b32e82f5039d99 100644 (file)
@@ -92,6 +92,8 @@ extern bool _bfd_mips_elf_is_target_special_symbol
 extern bool _bfd_mips_elf_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *);
+#define _bfd_mips_elf_find_nearest_line_with_alt \
+  _bfd_nosymbols_find_nearest_line_with_alt
 extern bool _bfd_mips_elf_find_inliner_info
   (bfd *, const char **, const char **, unsigned int *);
 extern bool _bfd_mips_elf_set_section_contents
index 0579f64d1a031fe25ef11d57bcf2e85934a6e52d..feaba84bf2ed22a4c885bd95ccba9c750bda5c97 100644 (file)
 #ifndef bfd_elfNN_find_nearest_line
 #define bfd_elfNN_find_nearest_line    _bfd_elf_find_nearest_line
 #endif
+#ifndef bfd_elfNN_find_nearest_line_with_alt
+#define bfd_elfNN_find_nearest_line_with_alt \
+  _bfd_elf_find_nearest_line_with_alt
+#endif
 #ifndef bfd_elfNN_find_line
 #define bfd_elfNN_find_line            _bfd_elf_find_line
 #endif
index 8247828eac849c8bee765d6bf5be5cca39386a1f..0f6cdec64be14dce79beeed1145c80b657edb10b 100644 (file)
@@ -252,6 +252,7 @@ msdos_set_section_contents (bfd *abfd,
 #define msdos_get_symbol_version_string \
   _bfd_nosymbols_get_symbol_version_string
 #define msdos_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define msdos_find_nearest_line_with_alt _bfd_nosymbols_find_nearest_line_with_alt
 #define msdos_find_line _bfd_nosymbols_find_line
 #define msdos_find_inliner_info _bfd_nosymbols_find_inliner_info
 #define msdos_get_lineno _bfd_nosymbols_get_lineno
index cccec8f164eb3b54a5def7366150f99da903facb..3088f7ee1de4bd373807efa6bcfad25081c96199 100644 (file)
@@ -942,6 +942,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define ihex_bfd_is_local_label_name             _bfd_nosymbols_bfd_is_local_label_name
 #define ihex_get_lineno                                  _bfd_nosymbols_get_lineno
 #define ihex_find_nearest_line                   _bfd_nosymbols_find_nearest_line
+#define ihex_find_nearest_line_with_alt                  _bfd_nosymbols_find_nearest_line_with_alt
 #define ihex_find_line                           _bfd_nosymbols_find_line
 #define ihex_find_inliner_info                   _bfd_nosymbols_find_inliner_info
 #define ihex_bfd_make_debug_symbol               _bfd_nosymbols_bfd_make_debug_symbol
index 2905de8ef9212b8c5ece25f772cd67094162f21a..04f343b051b9e3341698973ffb0e9be16ea3e66f 100644 (file)
@@ -451,6 +451,10 @@ extern bool _bfd_nosymbols_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *)
   ATTRIBUTE_HIDDEN;
+extern bool _bfd_nosymbols_find_nearest_line_with_alt
+  (bfd *, const char *, asymbol **, asection *, bfd_vma,
+   const char **, const char **, unsigned int *, unsigned int *)
+  ATTRIBUTE_HIDDEN;
 extern bool _bfd_nosymbols_find_line
   (bfd *, asymbol **, asymbol *, const char **, unsigned int *)
   ATTRIBUTE_HIDDEN;
@@ -586,6 +590,13 @@ extern int _bfd_dwarf2_find_nearest_line
    const char **, const char **, unsigned int *, unsigned int *,
    const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
 
+/* Find the nearest line using DWARF 2 debugging information, with
+   the option of specifying a .gnu_debugaltlink file.  */
+extern int _bfd_dwarf2_find_nearest_line_with_alt
+  (bfd *, const char *, asymbol **, asymbol *, asection *, bfd_vma,
+   const char **, const char **, unsigned int *, unsigned int *,
+   const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
+
 /* Find the bias between DWARF addresses and real addresses.  */
 extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias
   (asymbol **, void **) ATTRIBUTE_HIDDEN;
index c766722efb0e08d430b95696a2b1f3102c0078ed..68d0c4278b3b8f7e45a87b5136a89f742b8eb877 100644 (file)
@@ -456,6 +456,10 @@ extern bool _bfd_nosymbols_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *)
   ATTRIBUTE_HIDDEN;
+extern bool _bfd_nosymbols_find_nearest_line_with_alt
+  (bfd *, const char *, asymbol **, asection *, bfd_vma,
+   const char **, const char **, unsigned int *, unsigned int *)
+  ATTRIBUTE_HIDDEN;
 extern bool _bfd_nosymbols_find_line
   (bfd *, asymbol **, asymbol *, const char **, unsigned int *)
   ATTRIBUTE_HIDDEN;
@@ -591,6 +595,13 @@ extern int _bfd_dwarf2_find_nearest_line
    const char **, const char **, unsigned int *, unsigned int *,
    const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
 
+/* Find the nearest line using DWARF 2 debugging information, with
+   the option of specifying a .gnu_debugaltlink file.  */
+extern int _bfd_dwarf2_find_nearest_line_with_alt
+  (bfd *, const char *, asymbol **, asymbol *, asection *, bfd_vma,
+   const char **, const char **, unsigned int *, unsigned int *,
+   const struct dwarf_debug_section *, void **) ATTRIBUTE_HIDDEN;
+
 /* Find the bias between DWARF addresses and real addresses.  */
 extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias
   (asymbol **, void **) ATTRIBUTE_HIDDEN;
index e1f9e60c5272a67a5fc8227801bbb5c926609f89..722fd1e6ba48c62a15224f2dfea4c89dba44cd8f 100644 (file)
@@ -358,6 +358,8 @@ extern asymbol *coff_bfd_make_debug_symbol
 extern bool coff_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *);
+#define coff_find_nearest_line_with_alt \
+  _bfd_nosymbols_find_nearest_line_with_alt
 #define coff_find_line _bfd_nosymbols_find_line
 struct dwarf_debug_section;
 extern bool coff_find_nearest_line_with_names
index a884a80463186f0b8b5789f2877f9e416b233b59..21640c11ea66bb38c242fc55c51aa29a78d7c3eb 100644 (file)
@@ -362,6 +362,8 @@ extern asymbol *coff_bfd_make_debug_symbol
 extern bool coff_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *);
+#define coff_find_nearest_line_with_alt \
+  _bfd_nosymbols_find_nearest_line_with_alt
 #define coff_find_line _bfd_nosymbols_find_line
 struct dwarf_debug_section;
 extern bool coff_find_nearest_line_with_names
index b6c694873e739333ae431531ddd55509b1e9a752..073377755a441723426f5ccef6d41318686f202f 100644 (file)
@@ -293,6 +293,8 @@ extern bool _bfd_ecoff_bfd_is_local_label_name
 extern bool _bfd_ecoff_find_nearest_line
   (bfd *, asymbol **, asection *, bfd_vma,
    const char **, const char **, unsigned int *, unsigned int *);
+#define _bfd_ecoff_find_nearest_line_with_alt \
+  _bfd_nosymbols_find_nearest_line_with_alt
 #define _bfd_ecoff_find_line _bfd_nosymbols_find_line
 #define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
 #define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols
index f7418ad8d402fe1394005cf85025f67d445c9e2a..2e9a634df78b29680ea835151b497771c09535e6 100644 (file)
@@ -729,6 +729,8 @@ bool bfd_mach_o_find_nearest_line (bfd *, asymbol **,
                                          asection *, bfd_vma,
                                          const char **, const char **,
                                          unsigned int *, unsigned int *);
+#define bfd_mach_o_find_nearest_line_with_alt \
+  _bfd_nosymbols_find_nearest_line_with_alt
 #define bfd_mach_o_find_line _bfd_nosymbols_find_line
 bool bfd_mach_o_close_and_cleanup (bfd *);
 bool bfd_mach_o_free_cached_info (bfd *);
index 80b5cb6b4ca26fed4f0ed9f84c34337c9637e69c..fd92a346bc742de87f49ecb516d67d754e296ef5 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3316,6 +3316,7 @@ mmo_write_object_contents (bfd *abfd)
 /* FIXME: We can do better on this one, if we have a dwarf2 .debug_line
    section or if MMO line numbers are implemented.  */
 #define mmo_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define mmo_find_nearest_line_with_alt _bfd_nosymbols_find_nearest_line_with_alt
 #define mmo_find_line _bfd_nosymbols_find_line
 #define mmo_find_inliner_info _bfd_nosymbols_find_inliner_info
 #define mmo_make_empty_symbol _bfd_generic_make_empty_symbol
index 1dcb1dae40e5ca1bd3d0a5c40d2908199fbae662..d9936f750c17cfceb5ba2603640dab1bdb4f01e9 100644 (file)
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -41,6 +41,7 @@
 #define bfd_pef_bfd_is_target_special_symbol        _bfd_bool_bfd_asymbol_false
 #define bfd_pef_get_lineno                         _bfd_nosymbols_get_lineno
 #define bfd_pef_find_nearest_line                  _bfd_nosymbols_find_nearest_line
+#define bfd_pef_find_nearest_line_with_alt         _bfd_nosymbols_find_nearest_line_with_alt
 #define bfd_pef_find_line                          _bfd_nosymbols_find_line
 #define bfd_pef_find_inliner_info                  _bfd_nosymbols_find_inliner_info
 #define bfd_pef_get_symbol_version_string          _bfd_nosymbols_get_symbol_version_string
index c69fbd7b568ce49d63aa949d1a866c602a9f68f4..9103e21019dee37ad42e7ee0db974044e8f85c8e 100644 (file)
@@ -83,6 +83,7 @@ dlerror (void)
 #define bfd_plugin_bfd_is_target_special_symbol              _bfd_bool_bfd_asymbol_false
 #define bfd_plugin_get_lineno                        _bfd_nosymbols_get_lineno
 #define bfd_plugin_find_nearest_line                 _bfd_nosymbols_find_nearest_line
+#define bfd_plugin_find_nearest_line_with_alt        _bfd_nosymbols_find_nearest_line_with_alt
 #define bfd_plugin_find_line                         _bfd_nosymbols_find_line
 #define bfd_plugin_find_inliner_info                 _bfd_nosymbols_find_inliner_info
 #define bfd_plugin_get_symbol_version_string         _bfd_nosymbols_get_symbol_version_string
index 4e6cc9abbe2777fa6f36774932ce7f8f0b6673e4..d52d1a63357249f6d8fe17c3f410dcef279a4677 100644 (file)
@@ -332,6 +332,7 @@ ppcboot_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
 #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name
 #define ppcboot_get_lineno _bfd_nosymbols_get_lineno
 #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define ppcboot_find_nearest_line_with_alt _bfd_nosymbols_find_nearest_line_with_alt
 #define ppcboot_find_line _bfd_nosymbols_find_line
 #define ppcboot_find_inliner_info _bfd_nosymbols_find_inliner_info
 #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
index 6aca4a28760b57b7594ccc7802fd0d967cde6e81..68b8cc317f4e4489ea3266b4a8aa55d4e4b2b55e 100644 (file)
--- a/bfd/som.h
+++ b/bfd/som.h
@@ -230,6 +230,9 @@ struct som_section_data_struct
 #define R_HPPA_BEGIN_TRY               R_BEGIN_TRY
 #define R_HPPA_END_TRY                 R_END_TRY
 
+#define som_find_nearest_line_with_alt \
+  _bfd_nosymbols_find_nearest_line_with_alt
+
 /* Exported functions, mostly for use by GAS.  */
 bool bfd_som_set_section_attributes
   (asection *, int, int, unsigned int, int);
index abe36bbdbd1e46943610e426ca4a57ce15ae70a2..3ef429eca6d735f1022333004cb6514073dfad38 100644 (file)
@@ -1249,6 +1249,7 @@ srec_print_symbol (bfd *abfd,
 #define srec_bfd_is_local_label_name             bfd_generic_is_local_label_name
 #define srec_get_lineno                                  _bfd_nosymbols_get_lineno
 #define srec_find_nearest_line                   _bfd_nosymbols_find_nearest_line
+#define srec_find_nearest_line_with_alt                  _bfd_nosymbols_find_nearest_line_with_alt
 #define srec_find_line                           _bfd_nosymbols_find_line
 #define srec_find_inliner_info                   _bfd_nosymbols_find_inliner_info
 #define srec_make_empty_symbol                   _bfd_generic_make_empty_symbol
index b284cb294ffe782b42aac18bdb95da2b2aed22c2..7a454c5d7e7cd9e431df6617b8a046fa5a4751ed 100644 (file)
@@ -1504,6 +1504,21 @@ _bfd_nosymbols_find_nearest_line
   return _bfd_bool_bfd_false_error (abfd);
 }
 
+bool
+_bfd_nosymbols_find_nearest_line_with_alt
+    (bfd *abfd,
+     const char *alt_filename ATTRIBUTE_UNUSED,
+     asymbol **symbols ATTRIBUTE_UNUSED,
+     asection *section ATTRIBUTE_UNUSED,
+     bfd_vma offset ATTRIBUTE_UNUSED,
+     const char **filename_ptr ATTRIBUTE_UNUSED,
+     const char **functionname_ptr ATTRIBUTE_UNUSED,
+     unsigned int *line_ptr ATTRIBUTE_UNUSED,
+     unsigned int *discriminator_ptr ATTRIBUTE_UNUSED)
+{
+  return _bfd_bool_bfd_false_error (abfd);
+}
+
 bool
 _bfd_nosymbols_find_line (bfd *abfd,
                          asymbol **symbols ATTRIBUTE_UNUSED,
index 8ad3ef366cea6bca67f41a69d46dcb4496827861..1ec8acdb03ff53d0797131cdba6c49b16856f77a 100644 (file)
@@ -377,6 +377,7 @@ BFD_JUMP_TABLE macros.
 .  NAME##_bfd_is_target_special_symbol, \
 .  NAME##_get_lineno, \
 .  NAME##_find_nearest_line, \
+.  NAME##_find_nearest_line_with_alt, \
 .  NAME##_find_line, \
 .  NAME##_find_inliner_info, \
 .  NAME##_bfd_make_debug_symbol, \
@@ -407,6 +408,11 @@ BFD_JUMP_TABLE macros.
 .                                 struct bfd_section *, bfd_vma,
 .                                 const char **, const char **,
 .                                 unsigned int *, unsigned int *);
+.  bool (*_bfd_find_nearest_line_with_alt) (bfd *, const char *,
+.                                          struct bfd_symbol **,
+.                                          struct bfd_section *, bfd_vma,
+.                                          const char **, const char **,
+.                                          unsigned int *, unsigned int *);
 .  bool (*_bfd_find_line) (bfd *, struct bfd_symbol **,
 .                         struct bfd_symbol *, const char **,
 .                         unsigned int *);
index 7ff87af8a9dbf51ac27030b8a80459cf281f0f2b..f2b2db2bd0ba194401e30f9da0595dc2ff411694 100644 (file)
@@ -966,6 +966,7 @@ tekhex_print_symbol (bfd *abfd,
 #define tekhex_bfd_is_local_label_name              bfd_generic_is_local_label_name
 #define tekhex_get_lineno                          _bfd_nosymbols_get_lineno
 #define tekhex_find_nearest_line                   _bfd_nosymbols_find_nearest_line
+#define tekhex_find_nearest_line_with_alt          _bfd_nosymbols_find_nearest_line_with_alt
 #define tekhex_find_line                           _bfd_nosymbols_find_line
 #define tekhex_find_inliner_info                   _bfd_nosymbols_find_inliner_info
 #define tekhex_get_symbol_version_string           _bfd_nosymbols_get_symbol_version_string
index 4579f05ded3ead15dcd44030842a618b08c23d9a..baf0e044c42c52362b4f39abf76773cc48af0ca8 100644 (file)
@@ -370,6 +370,7 @@ verilog_mkobject (bfd *abfd)
 #define verilog_bfd_is_local_label_name                     bfd_generic_is_local_label_name
 #define verilog_get_lineno                          _bfd_nosymbols_get_lineno
 #define verilog_find_nearest_line                   _bfd_nosymbols_find_nearest_line
+#define verilog_find_nearest_line_with_alt          _bfd_nosymbols_find_nearest_line_with_alt
 #define verilog_find_inliner_info                   _bfd_nosymbols_find_inliner_info
 #define verilog_make_empty_symbol                   _bfd_generic_make_empty_symbol
 #define verilog_bfd_make_debug_symbol               _bfd_nosymbols_bfd_make_debug_symbol
index 5a867f715ea9983d5d1bac6cb52becdaef827cdc..0ea9ed544f1f9512ec787ee0017a679751fbfec5 100644 (file)
@@ -9992,6 +9992,8 @@ bfd_vms_get_data (bfd *abfd)
 #define alpha_vms_find_inliner_info       _bfd_nosymbols_find_inliner_info
 #define alpha_vms_bfd_make_debug_symbol           _bfd_nosymbols_bfd_make_debug_symbol
 #define alpha_vms_find_nearest_line       _bfd_vms_find_nearest_line
+#define alpha_vms_find_nearest_line_with_alt \
+   _bfd_nosymbols_find_nearest_line_with_alt
 #define alpha_vms_find_line               _bfd_nosymbols_find_line
 #define alpha_vms_bfd_is_local_label_name  vms_bfd_is_local_label_name
 
index f6afa054db0061734d07a1e93de31fcc387147d9..2c2c6c7286359ff0b42b0fa857653920730f63ff 100644 (file)
@@ -784,6 +784,7 @@ wasm_object_p (bfd *abfd)
 #define wasm_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
 #define wasm_get_lineno                          _bfd_nosymbols_get_lineno
 #define wasm_find_nearest_line           _bfd_nosymbols_find_nearest_line
+#define wasm_find_nearest_line_with_alt          _bfd_nosymbols_find_nearest_line_with_alt
 #define wasm_find_line                   _bfd_nosymbols_find_line
 #define wasm_find_inliner_info           _bfd_nosymbols_find_inliner_info
 #define wasm_bfd_make_debug_symbol       _bfd_nosymbols_bfd_make_debug_symbol
index 8a092f07f9cd15fd77baa784d4600f7e4cbef43f..b8e3d6c68a67efb1ff4793597db36c21f761821d 100644 (file)
@@ -32,6 +32,7 @@
 #define bfd_sym_bfd_is_target_special_symbol       _bfd_bool_bfd_asymbol_false
 #define bfd_sym_get_lineno                         _bfd_nosymbols_get_lineno
 #define bfd_sym_find_nearest_line                  _bfd_nosymbols_find_nearest_line
+#define bfd_sym_find_nearest_line_with_alt         _bfd_nosymbols_find_nearest_line_with_alt
 #define bfd_sym_find_line                          _bfd_nosymbols_find_line
 #define bfd_sym_find_inliner_info                  _bfd_nosymbols_find_inliner_info
 #define bfd_sym_get_symbol_version_string          _bfd_nosymbols_get_symbol_version_string