aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2012-07-24 21:06:58 +0000
committerCary Coutant <ccoutant@google.com>2012-07-24 21:06:58 +0000
commit9b8d1a36034b5bdf665b952f581d96a987faecdf (patch)
tree7d7c940776178575125abdf217cc7f201e1da032 /bfd/elf.c
parent882f447fddcf308f10b2398c84fbb95a4905c49e (diff)
downloadgdb-9b8d1a36034b5bdf665b952f581d96a987faecdf.zip
gdb-9b8d1a36034b5bdf665b952f581d96a987faecdf.tar.gz
gdb-9b8d1a36034b5bdf665b952f581d96a987faecdf.tar.bz2
2012-07-24 Teresa Johnson <tejohnson@google.com>
bfd/ * bfd.c (bfd_find_nearest_line_discriminator): New macro. * coff-rs6000.c: Init _bfd_find_nearest_line_discriminator. * coff64-rs6000.c: Likewise. * dwarf2.c (struct line_info): Add discriminator field. (add_line_info): Fill in new discriminator field. (decode_line_info): Record discriminator information instead of ignoring it. (lookup_address_in_line_info_table): Return discriminator field if requested. (comp_unit_find_nearest_line): Add discriminator argument. (find_line): Likewise. (_bfd_dwarf2_find_nearest_line): Likewise. (_bfd_dwarf2_find_line): Likewise. * elf-bfd.h (_bfd_elf_find_nearest_line_discriminator): New. (_bfd_elf_find_line_discriminator): Likewise. (_bfd_generic_find_nearest_line_discriminator): Likewise. Defined. * elf.c (_bfd_elf_find_nearest_line): Change to a wrapper that invokes _bfd_elf_find_nearest_line_discriminator with correct arguments. (_bfd_elf_find_nearest_line_discriminator): New. (_bfd_elf_find_line): Change to a wrapper that invokes _bfd_elf_find_line_discriminator with correct arguments. (_bfd_elf_find_line_discriminator): New. * coffgen.c (coff_find_nearest_line_with_names): Handle new discriminator argument. * elf32-arm.c (elf32_arm_find_nearest_line): Likewise. * elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise. * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise. * mach-o.c (bfd_mach_o_find_nearest_line): Likewise. * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Add discriminator argument. (_bfd_dwarf2_find_line): Likewise. (_bfd_generic_find_nearest_line_discriminator): New. * libbfd.c (_bfd_generic_find_nearest_line_discriminator): New. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. * targets.c (BFD_JUMP_TABLE_SYMBOLS): Initialize _bfd_find_nearest_line_discriminator with _bfd_generic_find_nearest_line_discriminator. (bfd_target): Add _bfd_find_nearest_line_discriminator. binutils/ * addr2line.c (find_address_in_section): Invoke bfd_find_nearest_line_discriminator to get the discriminator. (find_offset_in_section): Likewise. (translate_addresses): Print discriminator if it is non-zero. * objdump.c (show_line): Invoke bfd_find_nearest_line_discriminator to get the discriminator, and keep track of prev_discriminator. Print discriminator if it is non-zero. (disassemble_data): Initialize prev_discriminator. (dump_reloc_set): Invoke bfd_find_nearest_line_discriminator to get the discriminator, and keep track of last_discriminator. Print discriminator if it is non-zero.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 48e5d68..0ac4032 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7567,6 +7567,23 @@ _bfd_elf_find_nearest_line (bfd *abfd,
const char **functionname_ptr,
unsigned int *line_ptr)
{
+ return _bfd_elf_find_nearest_line_discriminator (abfd, section, symbols,
+ offset, filename_ptr,
+ functionname_ptr,
+ line_ptr,
+ NULL);
+}
+
+bfd_boolean
+_bfd_elf_find_nearest_line_discriminator (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr,
+ unsigned int *discriminator_ptr)
+{
bfd_boolean found;
if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
@@ -7584,7 +7601,7 @@ _bfd_elf_find_nearest_line (bfd *abfd,
if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections,
section, symbols, offset,
filename_ptr, functionname_ptr,
- line_ptr, 0,
+ line_ptr, discriminator_ptr, 0,
&elf_tdata (abfd)->dwarf2_find_line_info))
{
if (!*functionname_ptr)
@@ -7620,8 +7637,19 @@ bfd_boolean
_bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol,
const char **filename_ptr, unsigned int *line_ptr)
{
+ return _bfd_elf_find_line_discriminator (abfd, symbols, symbol,
+ filename_ptr, line_ptr,
+ NULL);
+}
+
+bfd_boolean
+_bfd_elf_find_line_discriminator (bfd *abfd, asymbol **symbols, asymbol *symbol,
+ const char **filename_ptr,
+ unsigned int *line_ptr,
+ unsigned int *discriminator_ptr)
+{
return _bfd_dwarf2_find_line (abfd, symbols, symbol,
- filename_ptr, line_ptr, 0,
+ filename_ptr, line_ptr, discriminator_ptr, 0,
&elf_tdata (abfd)->dwarf2_find_line_info);
}