From: Tom de Vries Date: Thu, 17 Jan 2019 00:08:05 +0000 (+0000) Subject: [libbacktrace] Handle DW_FORM_GNU_strp_alt X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2f00d3a04533afd3d02e29bb28afb5203de9078;p=gcc.git [libbacktrace] Handle DW_FORM_GNU_strp_alt Handle DW_FORM_GNU_strp_alt which references the .debug_str section in the .gnu_debugaltlink file. 2019-01-17 Tom de Vries PR libbacktrace/82857 * dwarf.c (read_attribute): Handle DW_FORM_GNU_strp_alt using altlink. From-SVN: r267996 --- diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index fb8aebe95c1..458f16c9870 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,9 @@ +2019-01-17 Tom de Vries + + PR libbacktrace/82857 + * dwarf.c (read_attribute): Handle DW_FORM_GNU_strp_alt + using altlink. + 2019-01-17 Tom de Vries * dwarf.c (enum attr_val_encoding): Add ATTR_VAL_NONE. diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c index 4cae5b4f4a3..45691b4ba69 100644 --- a/libbacktrace/dwarf.c +++ b/libbacktrace/dwarf.c @@ -843,14 +843,23 @@ read_attribute (enum dwarf_form form, struct dwarf_buf *buf, val->encoding = ATTR_VAL_REF_SECTION; return 1; case DW_FORM_GNU_strp_alt: - val->u.uint = read_offset (buf, is_dwarf64); - if (altlink == NULL) - { - val->encoding = ATTR_VAL_NONE; - return 1; - } - val->encoding = ATTR_VAL_REF_SECTION; - return 1; + { + uint64_t offset; + offset = read_offset (buf, is_dwarf64); + if (altlink == NULL) + { + val->encoding = ATTR_VAL_NONE; + return 1; + } + if (offset >= altlink->dwarf_str_size) + { + dwarf_buf_error (buf, "DW_FORM_GNU_strp_alt out of range"); + return 0; + } + val->encoding = ATTR_VAL_STRING; + val->u.string = (const char *) altlink->dwarf_str + offset; + return 1; + } default: dwarf_buf_error (buf, "unrecognized DWARF form"); return 0;