[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [valgrind] [Bug 278972] Memcheck prints the wrong source file for certain functions.
From:       Matthias Schwarzott <zzam () gentoo ! org>
Date:       2014-05-20 5:32:43
Message-ID: bug-278972-17878-PQiCH8KOyV () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=278972

Matthias Schwarzott <zzam@gentoo.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zzam@gentoo.org

--- Comment #9 from Matthias Schwarzott <zzam@gentoo.org> ---
I checked binutils code (bfd library) / addr2line:
It uses the DWARF tag DW_TAG_inlined_subroutine.
So if a range for DW_TAG_inlined_subroutine is found this is the current
function (and DW_AT_abstract_origin giving the function name). The tags
DW_AT_call_file and DW_AT_call_line give the caller source location.
After that stepping up to the parent DIE gives maybe the next level of
inlining.

Example from memcheck/test/inline (after adding a
"__attribute__((always_inline))"):
<1><87>: Abbrev Number: 5 (DW_TAG_subprogram)
    <88>   DW_AT_name        : (indirect string, offset: 0xe): addemup  
    <8c>   DW_AT_decl_file   : 1        
    <8d>   DW_AT_decl_line   : 6        
    <8e>   DW_AT_prototyped  : 1        
    <8f>   DW_AT_type        : <0x57>   
    <93>   DW_AT_inline      : 3        (declared as inline and inlined)
    <94>   DW_AT_sibling     : <0xb6>   
 <2><98>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <99>   DW_AT_name        : arr      
    <9d>   DW_AT_decl_file   : 1        
    <9e>   DW_AT_decl_line   : 6        
    <9f>   DW_AT_type        : <0x73>   
 <2><a3>: Abbrev Number: 7 (DW_TAG_variable)
    <a4>   DW_AT_name        : i        
    <a6>   DW_AT_decl_file   : 1        
    <a7>   DW_AT_decl_line   : 8        
    <a8>   DW_AT_type        : <0x57>   
 <2><ac>: Abbrev Number: 7 (DW_TAG_variable)
    <ad>   DW_AT_name        : j        
    <af>   DW_AT_decl_file   : 1        
    <b0>   DW_AT_decl_line   : 8        
    <b1>   DW_AT_type        : <0x57>   
 <2><b5>: Abbrev Number: 0
 <1><b6>: Abbrev Number: 8 (DW_TAG_subprogram)
    <b7>   DW_AT_external    : 1        
    <b8>   DW_AT_name        : (indirect string, offset: 0x1f): main    
    <bc>   DW_AT_decl_file   : 1        
    <bd>   DW_AT_decl_line   : 14       
    <be>   DW_AT_prototyped  : 1        
    <bf>   DW_AT_type        : <0x57>   
    <c3>   DW_AT_low_pc      : 0x4005aa 
    <cb>   DW_AT_high_pc     : 0x400621 
    <d3>   DW_AT_frame_base  : 0x0      (location list)
    <d7>   DW_AT_GNU_all_tail_call_sites: 1     
 <2><d8>: Abbrev Number: 9 (DW_TAG_variable)
    <d9>   DW_AT_name        : sum      
    <dd>   DW_AT_decl_file   : 1        
    <de>   DW_AT_decl_line   : 16       
    <df>   DW_AT_type        : <0x57>   
    <e3>   DW_AT_location    : 2 byte block: 91 64      (DW_OP_fbreg: -28)
 <2><e6>: Abbrev Number: 9 (DW_TAG_variable)
    <e7>   DW_AT_name        : a        
    <e9>   DW_AT_decl_file   : 1        
    <ea>   DW_AT_decl_line   : 17       
    <eb>   DW_AT_type        : <0x73>   
    <ef>   DW_AT_location    : 2 byte block: 91 68      (DW_OP_fbreg: -24)
 <2><f2>: Abbrev Number: 10 (DW_TAG_inlined_subroutine)
    <f3>   DW_AT_abstract_origin: <0x87>        
    <f7>   DW_AT_low_pc      : 0x4005cd 
    <ff>   DW_AT_high_pc     : 0x400606 
    <107>   DW_AT_call_file   : 1       
    <108>   DW_AT_call_line   : 18      
 <3><109>: Abbrev Number: 11 (DW_TAG_formal_parameter)
    <10a>   DW_AT_abstract_origin: <0x98>       
    <10e>   DW_AT_location    : 2 byte block: 91 58     (DW_OP_fbreg: -40)
 <3><111>: Abbrev Number: 12 (DW_TAG_lexical_block)
    <112>   DW_AT_low_pc      : 0x4005cd        
    <11a>   DW_AT_high_pc     : 0x400603        
 <4><122>: Abbrev Number: 13 (DW_TAG_variable)
    <123>   DW_AT_abstract_origin: <0xa3>       
    <127>   DW_AT_location    : 2 byte block: 91 50     (DW_OP_fbreg: -48)
 <4><12a>: Abbrev Number: 13 (DW_TAG_variable)
    <12b>   DW_AT_abstract_origin: <0xac>       
    <12f>   DW_AT_location    : 2 byte block: 91 54     (DW_OP_fbreg: -44)
 <4><132>: Abbrev Number: 0
 <3><133>: Abbrev Number: 0
 <2><134>: Abbrev Number: 0
 <1><135>: Abbrev Number: 0

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic