summaryrefslogtreecommitdiff
path: root/libbacktrace
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2019-01-17 00:08:05 +0000
committerTom de Vries <vries@gcc.gnu.org>2019-01-17 00:08:05 +0000
commitf2f00d3a04533afd3d02e29bb28afb5203de9078 (patch)
tree1c111529bc8651d2f75549de3df91b88ff1a7431 /libbacktrace
parent944f59ffe2ea4cfc7391741ddab281d7d9cf5b94 (diff)
downloadgcc-f2f00d3a04533afd3d02e29bb28afb5203de9078.tar.gz
[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 <tdevries@suse.de> PR libbacktrace/82857 * dwarf.c (read_attribute): Handle DW_FORM_GNU_strp_alt using altlink. From-SVN: r267996
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/ChangeLog6
-rw-r--r--libbacktrace/dwarf.c25
2 files changed, 23 insertions, 8 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index fb8aebe95c1..458f16c9870 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,5 +1,11 @@
2019-01-17 Tom de Vries <tdevries@suse.de>
+ PR libbacktrace/82857
+ * dwarf.c (read_attribute): Handle DW_FORM_GNU_strp_alt
+ using altlink.
+
+2019-01-17 Tom de Vries <tdevries@suse.de>
+
* dwarf.c (enum attr_val_encoding): Add ATTR_VAL_NONE.
(read_attribute): Add altlink parameter. Handle missing altlink for
DW_FORM_GNU_strp_alt and DW_FORM_GNU_ref_alt.
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;