aboutsummaryrefslogtreecommitdiff
path: root/gprofng
diff options
context:
space:
mode:
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>2023-12-18 21:04:57 -0800
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>2023-12-20 14:04:35 -0800
commit0b3ad397ef2dc54602d7966af53515061312733c (patch)
tree2c991acfb05b816bf9dfda05301c253567cf829a /gprofng
parent33179c5b57c9fc89c061deb1d387f972b8604b49 (diff)
downloadfsf-binutils-gdb-0b3ad397ef2dc54602d7966af53515061312733c.zip
fsf-binutils-gdb-0b3ad397ef2dc54602d7966af53515061312733c.tar.gz
fsf-binutils-gdb-0b3ad397ef2dc54602d7966af53515061312733c.tar.bz2
gprofng: 31169 Source code locations can not be found in a C++ application
gprofng incorrectly reads the form of the DW_FORM_ref_addr attribute for DWARF Version 3 or later. From DWARF specification: References that use the attribute form DW_FORM_ref_addr are specified to be four bytes in the DWARF 32-bit format and eight bytes in the DWARF 64-bit format, while DWARF Version 2 specifies that such references have the same size as an address on the target system. 2023-12-18 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/31169 * src/DwarfLib.cc: Fix the reader for DW_FORM_ref_addr.
Diffstat (limited to 'gprofng')
-rw-r--r--gprofng/src/DwarfLib.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gprofng/src/DwarfLib.cc b/gprofng/src/DwarfLib.cc
index 90c3e6e..6273282 100644
--- a/gprofng/src/DwarfLib.cc
+++ b/gprofng/src/DwarfLib.cc
@@ -2034,7 +2034,10 @@ DwrCU::set_die (Dwarf_Die die)
atf->u.offset = debug_infoSec->GetULEB128 ();
break;
case DW_FORM_ref_addr:
- atf->u.offset = debug_infoSec->GetADDR ();
+ if (version > 2)
+ atf->u.offset = debug_infoSec->GetRef ();
+ else
+ atf->u.offset = debug_infoSec->GetADDR ();
break;
case DW_FORM_sec_offset:
atf->u.offset = debug_infoSec->GetRef ();