From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2041) id DAF0E3858CD1; Wed, 20 Dec 2023 22:10:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DAF0E3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703110243; bh=UV5GfT1ttQdUCDNTlPPLJfNCiMpz10r9M19Dnq958IQ=; h=From:To:Subject:Date:From; b=lgbNlDe9Lz/f2hDOlbeUKpilrTQC7hAwg+vGl/8j6jg5woy5bMshu6gmhSbRnd9tV HXSTKwc9/BjAik0zEt3wvV7FvWDGvZXeZ+Nr71+3C+PdSsftzzvZThzbc+ocKCYVsg mnJSSz9CHURge3odUOXviKDDzxHAPUgKuw6rhEL0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Vladimir Mezentsev To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] gprofng: 31169 Source code locations can not be found in a C++ application X-Act-Checkin: binutils-gdb X-Git-Author: Vladimir Mezentsev X-Git-Refname: refs/heads/master X-Git-Oldrev: 33179c5b57c9fc89c061deb1d387f972b8604b49 X-Git-Newrev: 0b3ad397ef2dc54602d7966af53515061312733c Message-Id: <20231220221043.DAF0E3858CD1@sourceware.org> Date: Wed, 20 Dec 2023 22:10:43 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0b3ad397ef2d= c54602d7966af53515061312733c commit 0b3ad397ef2dc54602d7966af53515061312733c Author: Vladimir Mezentsev Date: Mon Dec 18 21:04:57 2023 -0800 gprofng: 31169 Source code locations can not be found in a C++ applicat= ion =20 gprofng incorrectly reads the form of the DW_FORM_ref_addr attribute fo= r 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 h= ave the same size as an address on the target system. =20 2023-12-18 Vladimir Mezentsev =20 PR gprofng/31169 * src/DwarfLib.cc: Fix the reader for DW_FORM_ref_addr. Diff: --- gprofng/src/DwarfLib.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gprofng/src/DwarfLib.cc b/gprofng/src/DwarfLib.cc index 90c3e6e95a2..62732829517 100644 --- a/gprofng/src/DwarfLib.cc +++ b/gprofng/src/DwarfLib.cc @@ -2034,7 +2034,10 @@ DwrCU::set_die (Dwarf_Die die) atf->u.offset =3D debug_infoSec->GetULEB128 (); break; case DW_FORM_ref_addr: - atf->u.offset =3D debug_infoSec->GetADDR (); + if (version > 2) + atf->u.offset =3D debug_infoSec->GetRef (); + else + atf->u.offset =3D debug_infoSec->GetADDR (); break; case DW_FORM_sec_offset: atf->u.offset =3D debug_infoSec->GetRef ();