aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-10-15 21:52:20 +1030
committerAlan Modra <amodra@gmail.com>2014-10-15 22:55:25 +1030
commitfb167eb272279154dc2502614eb5331b01dc6ea4 (patch)
tree3f1b040a1563d7167a33fed05c5b379459de9d0c /bfd/dwarf2.c
parent9c461f7dba0ab17227ec3ada32804ed7f7c1a4d2 (diff)
downloadgdb-fb167eb272279154dc2502614eb5331b01dc6ea4.zip
gdb-fb167eb272279154dc2502614eb5331b01dc6ea4.tar.gz
gdb-fb167eb272279154dc2502614eb5331b01dc6ea4.tar.bz2
Merge bfd_find_nearest_line variants
When bfd_find_nearest_line_discriminator was added, not enough care was taken to ensure all targets had a proper definition of the function. This patch cures that by merging bfd_find_nearest_line_discriminator and bfd_find_nearest_line target implementations. PR 17481 * aoutx.h (NAME (aout, find_nearest_line)): Add "discriminator_ptr" param, group "section" and "offset" params. Zero discriminator. * bfd.c (bfd_find_nearest_line): Implement with new _bfd_find_nearest_line. (bfd_find_nearest_line_discriminator): Likewise. * coff-i386.c (_bfd_generic_find_nearest_line_discriminator): Don't define. * coff-rs6000.c (xcoff_find_nearest_line, xcoff_find_nearest_line_discriminator): Delete. (_bfd_xcoff_find_nearest_line): Don't define. (_bfd_xcoff_find_nearest_line): Define as coff_find_nearest_line. * coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator): Don't define. * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Adjust. * coffgen.c (coff_find_nearest_line_with_names): Reorder params, adjust _bfd_dwarf2_find_nearest_line call. (coff_find_nearest_line): Add "discriminator_ptr" param, reorder others. Set discriminator. Adjust call. (coff_find_nearest_line_discriminator): Delete. * dwarf1.c (_bfd_dwarf1_find_nearest_line): Reorder params. * dwarf2.c (find_line): Rename to.. (_bfd_dwarf2_find_nearest_line): ..this, reordering params. Simplify setting of do_line. Delete old function. (_bfd_dwarf2_find_line): Delete. * ecoff.c (_bfd_ecoff_find_nearest_line): Reorder params, add discriminator_ptr and set it. * elf-bfd.h (_bfd_elf_find_nearest_line): Update prototype. (_bfd_elf_find_nearest_line_discriminator): Delete. (_bfd_elf_find_line_discriminator): Delete. (_bfd_generic_find_nearest_line_discriminator): Don't define. * elf.c (elf_find_function): Reorder params. (_bfd_elf_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. (_bfd_elf_find_nearest_line_discriminator): Delete. (_bfd_elf_find_line): Adjust call. * elf32-arm.c (arm_elf_find_function): Reorder params. (elf32_arm_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * elf64-alpha.c (elf64_alpha_find_nearest_line): Similarly. * elfnn-aarch64.c (aarch64_elf_find_function): Reorder params. (elfNN_aarch64_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly. * elfxx-mips.h (_bfd_mips_elf_find_nearest_line): Update prototype. * libaout.h (NAME (aout, find_nearest_line)): Update prototype. * libbfd-in.h (_bfd_nosymbols_find_nearest_line): Update. (_bfd_dwarf1_find_nearest_line): Likewise. (_bfd_dwarf2_find_nearest_line): Likewise. (_bfd_dwarf2_find_line): Delete. (_bfd_generic_find_nearest_line_discriminator): Delete. * libbfd.c (_bfd_generic_find_nearest_line_discriminator): Delete. * libcoff-in.h (coff_find_nearest_line): Update prototype. (coff_find_nearest_line_discriminator): Delete. (coff_find_nearest_line_with_names): Update prototype. * libecoff.h (_bfd_ecoff_find_nearest_line): Update prototype. * mach-o.c (bfd_mach_o_find_nearest_line): Reorder params, add discriminator_ptr. Adjust calls. * mach-o.h (bfd_mach_o_find_nearest_line): Update prototype. * pdp11.c (NAME (aout, find_nearest_line)): Reorder params, add discriminator_ptr and set. * som.c (som_find_nearest_line): Similarly. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Delete entry for _bfd_find_nearest_line_discriminator. (struct bfd_target <_bfd_find_nearest_line>): Adjust prototype. (struct bfd_target <_bfd_find_nearest_line_discriminator>): Delete. * vms-alpha.c (_bfd_vms_find_nearest_dst_line): Rename to.. (_bfd_vms_find_nearest_line): ..this. Reorder params, add "discriminator" and set. (_bfd_vms_find_nearest_line_discriminator): Delete. (_bfd_generic_find_nearest_line_discriminator): Don't define. (alpha_vms_find_nearest_line): Update define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * libcoff.h: Regenerate.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c82
1 files changed, 20 insertions, 62 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 1ca69b6..8375da4 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3602,19 +3602,19 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd,
field and in the abbreviation offset, or zero to indicate that the
default value should be used. */
-static bfd_boolean
-find_line (bfd *abfd,
- const struct dwarf_debug_section *debug_sections,
- asection *section,
- bfd_vma offset,
- asymbol *symbol,
- asymbol **symbols,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *linenumber_ptr,
- unsigned int *discriminator_ptr,
- unsigned int addr_size,
- void **pinfo)
+bfd_boolean
+_bfd_dwarf2_find_nearest_line (bfd *abfd,
+ 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,
+ unsigned int addr_size,
+ 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,
@@ -3645,21 +3645,18 @@ find_line (bfd *abfd,
stash = (struct dwarf2_debug *) *pinfo;
- do_line = (section == NULL
- && offset == 0
- && functionname_ptr == NULL
- && symbol != NULL);
+ do_line = symbol != NULL;
if (do_line)
{
- addr = symbol->value;
+ BFD_ASSERT (section == NULL && offset == 0 && functionname_ptr == NULL);
section = bfd_get_section (symbol);
+ addr = symbol->value;
}
- else if (section != NULL
- && functionname_ptr != NULL
- && symbol == NULL)
- addr = offset;
else
- abort ();
+ {
+ BFD_ASSERT (section != NULL && functionname_ptr != NULL);
+ addr = offset;
+ }
if (section->output_section)
addr += section->output_section->vma + section->output_offset;
@@ -3874,45 +3871,6 @@ find_line (bfd *abfd,
return found;
}
-/* The DWARF2 version of find_nearest_line.
- Return TRUE if the line is found without error. */
-
-bfd_boolean
-_bfd_dwarf2_find_nearest_line (bfd *abfd,
- const struct dwarf_debug_section *debug_sections,
- asection *section,
- asymbol **symbols,
- bfd_vma offset,
- const char **filename_ptr,
- const char **functionname_ptr,
- unsigned int *linenumber_ptr,
- unsigned int *discriminator_ptr,
- unsigned int addr_size,
- void **pinfo)
-{
- return find_line (abfd, debug_sections, section, offset, NULL, symbols,
- filename_ptr, functionname_ptr, linenumber_ptr,
- discriminator_ptr, addr_size, pinfo);
-}
-
-/* The DWARF2 version of find_line.
- Return TRUE if the line is found without error. */
-
-bfd_boolean
-_bfd_dwarf2_find_line (bfd *abfd,
- asymbol **symbols,
- asymbol *symbol,
- const char **filename_ptr,
- unsigned int *linenumber_ptr,
- unsigned int *discriminator_ptr,
- unsigned int addr_size,
- void **pinfo)
-{
- return find_line (abfd, dwarf_debug_sections, NULL, 0, symbol, symbols,
- filename_ptr, NULL, linenumber_ptr, discriminator_ptr,
- addr_size, pinfo);
-}
-
bfd_boolean
_bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
const char **filename_ptr,