aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-03-05 12:14:26 +0000
committerNick Clifton <nickc@redhat.com>2015-03-05 12:14:26 +0000
commit425bd9e1bb32b25881dd20d76678d041f7bf04f8 (patch)
treee503906efb4cab1957e3a053fda5d5b8c854bb13 /bfd/coffgen.c
parentf5771b1d96f844e0767a15b258b2de2d4cc52123 (diff)
downloadgdb-425bd9e1bb32b25881dd20d76678d041f7bf04f8.zip
gdb-425bd9e1bb32b25881dd20d76678d041f7bf04f8.tar.gz
gdb-425bd9e1bb32b25881dd20d76678d041f7bf04f8.tar.bz2
Allows the binutils to cope with PE binaries where the section addresses have been changed, but the DWARF debug info has not been altered.
PR binutils/18025 * coffgen.c (coff_find_nearest_line_with_names): If the dwarf2 lookup fails, check for an address bias in the dwarf info, and if one exists, retry the lookup with the biased value. * dwarf2.c (_bfd_dwarf2_find_symbol_bias): New function. Determines if a bias exists bewteen the addresses of functions based on DWARF information vs symbol table information. * libbfd-in.h (_bfd_dwarf2_find_symbol_bias): Prototype. * libbfd.h: Regenerate.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 83673d4..5c664a4 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2245,6 +2245,26 @@ coff_find_nearest_line_with_names (bfd *abfd,
&coff_data(abfd)->dwarf2_find_line_info))
return TRUE;
+ /* If the DWARF lookup failed, but there is DWARF information available
+ then the problem might be that the file has been rebased. This tool
+ changes the VMAs of all the sections, but it does not update the DWARF
+ information. So try again, using a bias against the address sought. */
+ if (coff_data (abfd)->dwarf2_find_line_info != NULL)
+ {
+ bfd_signed_vma bias;
+
+ bias = _bfd_dwarf2_find_symbol_bias (symbols,
+ & coff_data (abfd)->dwarf2_find_line_info);
+
+ if (bias
+ && _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section,
+ offset + bias,
+ filename_ptr, functionname_ptr,
+ line_ptr, NULL, debug_sections, 0,
+ &coff_data(abfd)->dwarf2_find_line_info))
+ return TRUE;
+ }
+
*filename_ptr = 0;
*functionname_ptr = 0;
*line_ptr = 0;