• Matt Ma's avatar
    Get the correct file name for inline functions. · 4c872d1c
    Matt Ma authored
    Summary:
    Here is an example for class inline member function declared and defined in the same file:
    
    ```
    Definition:
    0x00004c0a:           DW_TAG_subprogram [55] *
                            DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x00177124] = "_ZNK5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                            DW_AT_name [DW_FORM_strp] ( .debug_str[0x00089a73] = "inlineBar")
                            DW_AT_decl_file [DW_FORM_data1] (0x1a)
                            DW_AT_decl_line [DW_FORM_data1] (0xa5)
                            DW_AT_declaration [DW_FORM_flag_present]  (true)
                            DW_AT_external [DW_FORM_flag_present] (true)
                            DW_AT_accessibility [DW_FORM_data1] (0x01)
    …
    
    Declaration:   -- no DW_AT_decl_file
    0x000164c1:   DW_TAG_subprogram [228] *
                    DW_AT_specification [DW_FORM_ref4]  (cu + 0x48ea => {0x00004c0a})
                    DW_AT_inline [DW_FORM_data1]  (0x01)
                    DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x161ac => {0x000164cc})
    
    …
    
    Inline function call
    0x0001657b:     DW_TAG_inlined_subroutine [140] *
                      DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x161a1 => {0x000164c1})
                      DW_AT_low_pc [DW_FORM_addr] (0x000000000040fa6e)
                      DW_AT_high_pc [DW_FORM_data4] (0x00000055)
                      DW_AT_call_file [DW_FORM_data1] (0x1a)
                      DW_AT_call_line [DW_FORM_data1] (0xe2)
    ```
    
    Here is an example for class inline member function declared and defined in different files:
    
    ```
    Definition:  DW_AT_decl_file: 0x01  --> SymbolizerTestUtils.h
    0x00004c3d:           DW_TAG_subprogram [55] *
                            DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0017717f] = "_ZNK5folly10symbolizer4test22InlineFunctionsWrapper9inlineBarERNS0_10FrameArrayILm100EEE")
                            DW_AT_name [DW_FORM_strp] ( .debug_str[0x00089a73] = "inlineBar")
                            DW_AT_decl_file [DW_FORM_data1] (0x01)
                            DW_AT_decl_line [DW_FORM_data1] (0x30)
                            DW_AT_declaration [DW_FORM_flag_present]  (true)
                            DW_AT_external [DW_FORM_flag_present] (true)
                            DW_AT_accessibility [DW_FORM_data1] (0x01)
    
    …
    
    Declaration:   DW_AT_decl_file: 0xbf  --> SymbolizerTestUtils-inl.h
    0x00017ee8:   DW_TAG_subprogram [231] *
                    DW_AT_decl_file [DW_FORM_data1] (0xbf)
                    DW_AT_decl_line [DW_FORM_data1] (0x21)
                    DW_AT_specification [DW_FORM_ref4]  (cu + 0x491d => {0x00004c3d})
                    DW_AT_inline [DW_FORM_data1]  (0x01)
                    DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x17bd5 => {0x00017ef5})
    
    …
    
    Inline function call
    0x00017fa5:     DW_TAG_inlined_subroutine [158] *
                      DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x17bc8 => {0x00017ee8})
                      DW_AT_low_pc [DW_FORM_addr] (0x00000000004104ee)
                      DW_AT_high_pc [DW_FORM_data4] (0x00000055)
                      DW_AT_call_file [DW_FORM_data1] (0x1a)
                      DW_AT_call_line [DW_FORM_data2] (0x0101)
    ```
    
    Reviewed By: luciang
    
    Differential Revision: D19658560
    
    fbshipit-source-id: 78c1e42d76c19f09e4632c40e0df18bfb49479f9
    4c872d1c
SymbolizerTest.cpp 9.95 KB