public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] gprofng: 31169 Source code locations can not be found in a C++ application
@ 2023-12-20 22:10 Vladimir Mezentsev
  0 siblings, 0 replies; only message in thread
From: Vladimir Mezentsev @ 2023-12-20 22:10 UTC (permalink / raw)
  To: bfd-cvs, gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0b3ad397ef2dc54602d7966af53515061312733c

commit 0b3ad397ef2dc54602d7966af53515061312733c
Author: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date:   Mon Dec 18 21:04:57 2023 -0800

    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.

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 = 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 ();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-20 22:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 22:10 [binutils-gdb] gprofng: 31169 Source code locations can not be found in a C++ application Vladimir Mezentsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).