Sync libbacktrace with 2446c6.

This commit is contained in:
Bartosz Taudul 2022-03-18 01:46:12 +01:00
parent dc874a732e
commit 3bb2094751
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -52,6 +52,7 @@ enum dwarf_tag {
DW_TAG_compile_unit = 0x11,
DW_TAG_inlined_subroutine = 0x1d,
DW_TAG_subprogram = 0x2e,
DW_TAG_skeleton_unit = 0x4a,
};
enum dwarf_form {
@ -2325,14 +2326,16 @@ find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
break;
case DW_AT_stmt_list:
if (abbrev->tag == DW_TAG_compile_unit
if ((abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
&& (val.encoding == ATTR_VAL_UINT
|| val.encoding == ATTR_VAL_REF_SECTION))
u->lineoff = val.u.uint;
break;
case DW_AT_name:
if (abbrev->tag == DW_TAG_compile_unit)
if (abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
{
name_val = val;
have_name_val = 1;
@ -2340,7 +2343,8 @@ find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
break;
case DW_AT_comp_dir:
if (abbrev->tag == DW_TAG_compile_unit)
if (abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
{
comp_dir_val = val;
have_comp_dir_val = 1;
@ -2348,19 +2352,22 @@ find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
break;
case DW_AT_str_offsets_base:
if (abbrev->tag == DW_TAG_compile_unit
if ((abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
&& val.encoding == ATTR_VAL_REF_SECTION)
u->str_offsets_base = val.u.uint;
break;
case DW_AT_addr_base:
if (abbrev->tag == DW_TAG_compile_unit
if ((abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
&& val.encoding == ATTR_VAL_REF_SECTION)
u->addr_base = val.u.uint;
break;
case DW_AT_rnglists_base:
if (abbrev->tag == DW_TAG_compile_unit
if ((abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
&& val.encoding == ATTR_VAL_REF_SECTION)
u->rnglists_base = val.u.uint;
break;
@ -2388,7 +2395,8 @@ find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
}
if (abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_subprogram)
|| abbrev->tag == DW_TAG_subprogram
|| abbrev->tag == DW_TAG_skeleton_unit)
{
if (!add_ranges (state, dwarf_sections, base_address,
is_bigendian, u, pcrange.lowpc, &pcrange,
@ -2396,9 +2404,10 @@ find_address_ranges (struct backtrace_state *state, uintptr_t base_address,
(void *) addrs))
return 0;
/* If we found the PC range in the DW_TAG_compile_unit, we
can stop now. */
if (abbrev->tag == DW_TAG_compile_unit
/* If we found the PC range in the DW_TAG_compile_unit or
DW_TAG_skeleton_unit, we can stop now. */
if ((abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
&& (pcrange.have_ranges
|| (pcrange.have_lowpc && pcrange.have_highpc)))
return 1;
@ -2557,6 +2566,9 @@ build_address_map (struct backtrace_state *state, uintptr_t base_address,
u->comp_dir = NULL;
u->abs_filename = NULL;
u->lineoff = 0;
u->str_offsets_base = 0;
u->addr_base = 0;
u->rnglists_base = 0;
/* The actual line number mappings will be read as needed. */
u->lines = NULL;
@ -3607,7 +3619,8 @@ read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata,
/* The compile unit sets the base address for any address
ranges in the function entries. */
if (abbrev->tag == DW_TAG_compile_unit
if ((abbrev->tag == DW_TAG_compile_unit
|| abbrev->tag == DW_TAG_skeleton_unit)
&& abbrev->attrs[i].name == DW_AT_low_pc)
{
if (val.encoding == ATTR_VAL_ADDRESS)