From: Tom de Vries Date: Thu, 17 Jan 2019 13:42:20 +0000 (+0000) Subject: [libbacktrace] Handle DW_FORM_GNU_ref_alt X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1c2a9a37c681aa24ece35b671931870b1afe5797;p=gcc.git [libbacktrace] Handle DW_FORM_GNU_ref_alt Handle DW_FORM_GNU_ref_alt which references the .debug_info section in the .gnu_debugaltlink file. 2019-01-17 Tom de Vries PR libbacktrace/82857 * dwarf.c (enum attr_val_encoding): Add ATTR_VAL_REF_ALT_INFO. (read_attribute): Handle DW_FORM_GNU_ref_alt using ATTR_VAL_REF_ALT_INFO. (read_referenced_name_from_attr): Handle DW_FORM_GNU_ref_alt. From-SVN: r268031 --- diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index 1fd307bf512..191bfa3cac3 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,11 @@ +2019-01-17 Tom de Vries + + PR libbacktrace/82857 + * dwarf.c (enum attr_val_encoding): Add ATTR_VAL_REF_ALT_INFO. + (read_attribute): Handle DW_FORM_GNU_ref_alt using + ATTR_VAL_REF_ALT_INFO. + (read_referenced_name_from_attr): Handle DW_FORM_GNU_ref_alt. + 2019-01-17 Tom de Vries * dwarf.c (struct unit): Add low_offset and high_offset fields. diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c index 6f56c46774b..aacbd3a453d 100644 --- a/libbacktrace/dwarf.c +++ b/libbacktrace/dwarf.c @@ -143,6 +143,8 @@ enum attr_val_encoding ATTR_VAL_REF_UNIT, /* An offset to other data within the .dwarf_info section. */ ATTR_VAL_REF_INFO, + /* An offset to other data within the alt .dwarf_info section. */ + ATTR_VAL_REF_ALT_INFO, /* An offset to data in some other section. */ ATTR_VAL_REF_SECTION, /* A type signature. */ @@ -858,7 +860,7 @@ read_attribute (enum dwarf_form form, struct dwarf_buf *buf, val->encoding = ATTR_VAL_NONE; return 1; } - val->encoding = ATTR_VAL_REF_SECTION; + val->encoding = ATTR_VAL_REF_ALT_INFO; return 1; case DW_FORM_GNU_strp_alt: { @@ -2200,6 +2202,19 @@ read_referenced_name_from_attr (struct dwarf_data *ddata, struct unit *u, || val->encoding == ATTR_VAL_REF_UNIT) return read_referenced_name (ddata, u, val->u.uint, error_callback, data); + if (val->encoding == ATTR_VAL_REF_ALT_INFO) + { + struct unit *alt_unit + = find_unit (ddata->altlink->units, ddata->altlink->units_count, + val->u.uint); + if (alt_unit == NULL) + return NULL; + + uint64_t offset = val->u.uint - alt_unit->low_offset; + return read_referenced_name (ddata->altlink, alt_unit, offset, + error_callback, data); + } + return NULL; }