diff options
author | Aaron Merey <amerey@redhat.com> | 2022-09-02 14:16:30 -0400 |
---|---|---|
committer | Aaron Merey <amerey@redhat.com> | 2022-09-06 10:42:50 -0400 |
commit | 6e7a29c7de4e1df679f2b6f6449b20474fbbcfdf (patch) | |
tree | 4ebae737f83b181c6a30c561bcf09a238c6da55f /bfd/elf.c | |
parent | cb21dd0c599a420117abbcbbd1e20cce8d9e771d (diff) | |
download | gdb-6e7a29c7de4e1df679f2b6f6449b20474fbbcfdf.zip gdb-6e7a29c7de4e1df679f2b6f6449b20474fbbcfdf.tar.gz gdb-6e7a29c7de4e1df679f2b6f6449b20474fbbcfdf.tar.bz2 |
bfd: Add bfd_find_nearest_line_with_alt
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.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 32 |
1 files changed, 27 insertions, 5 deletions
@@ -9340,13 +9340,35 @@ _bfd_elf_find_nearest_line (bfd *abfd, 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, |