Support inline class member functions in stack trace.
Summary:
Actually class inline functions exist in both .debug_info and .debug_types sections. In this diff, only the information in .debug_info is used.
Step 1. Find the DW_TAG_inlined_subroutine debug info entry (DIE) based on the given address.
Step 2. Find the DW_TAG_subprogram DIE based on the DW_AT_abstract_origin attr in inlined_subroutine, but this DIE is just a declaration.
Step 3. Find the actual definition DW_TAG_subprogram DIE based on the DW_AT_specification attr.
```
.debug_info
0x00003657: DW_TAG_subprogram [56] * ---- step 3
DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0002932d] = "_ZN5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
DW_AT_name [DW_FORM_strp] ( .debug_str[0x00014064] = "inlineBar")
DW_AT_decl_file [DW_FORM_data1] (0x18)
DW_AT_decl_line [DW_FORM_data1] (0xa1)
DW_AT_declaration [DW_FORM_flag_present] (true)
DW_AT_external [DW_FORM_flag_present] (true)
DW_AT_accessibility [DW_FORM_data1] (0x01)
…
0x0000cd74: DW_TAG_subprogram [203] * . ---- step 2
DW_AT_specification [DW_FORM_ref4] (cu + 0x358f => {0x00003657})
DW_AT_inline [DW_FORM_data1] (0x01)
DW_AT_object_pointer [DW_FORM_ref4] (cu + 0xccb7 => {0x0000cd7f})
…
0x0000cda0: DW_TAG_subprogram [181] *
DW_AT_low_pc [DW_FORM_addr] (0x00000000002a4980)
DW_AT_high_pc [DW_FORM_data4] (0x00001e22)
DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 )
DW_AT_object_pointer [DW_FORM_ref4] (cu + 0xccf0 => {0x0000cdb8})
DW_AT_specification [DW_FORM_ref4] (cu + 0x312f => {0x000031f7})
…
0x0000ce02: DW_TAG_inlined_subroutine [157] * ---- step 1
DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0xccac => {0x0000cd74})
DW_AT_low_pc [DW_FORM_addr] (0x00000000002a4f66)
DW_AT_high_pc [DW_FORM_data4] (0x000000c0)
DW_AT_call_file [DW_FORM_data1] (0x18)
DW_AT_call_line [DW_FORM_data1] (0xe6)
.debug_types
0x00020fdf: DW_TAG_class_type [33] *
DW_AT_calling_convention [DW_FORM_data1] (0x05)
DW_AT_name [DW_FORM_strp] ( .debug_str[0x00067094] = "ClassWithInlineFunctions")
DW_AT_byte_size [DW_FORM_data1] (0x08)
DW_AT_decl_file [DW_FORM_data1] (0x18)
DW_AT_decl_line [DW_FORM_data1] (0x9f)
…
0x00020ff5: DW_TAG_subprogram [56] *
DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0002932d] = "_ZN5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
DW_AT_name [DW_FORM_strp] ( .debug_str[0x00014064] = "inlineBar")
DW_AT_decl_file [DW_FORM_data1] (0x18)
DW_AT_decl_line [DW_FORM_data1] (0xa1)
DW_AT_declaration [DW_FORM_flag_present] (true)
DW_AT_external [DW_FORM_flag_present] (true)
DW_AT_accessibility [DW_FORM_data1] (0x01)
```
Reviewed By: luciang
Differential Revision: D19384064
fbshipit-source-id: a2a6397b94aab9de58d013cf4ad19e658e180d31
Showing
Please register or sign in to comment