[PATCH] tests: Don't assert on bad DW_OP_GNU_parameter_ref target in varlocs.
Mark Wielaard
mark@klomp.org
Fri Jun 8 19:18:00 GMT 2018
If the target of a DW_OP_GNU_parameter_ref isn't a DW_TAG_formal_parameter
that is bad data (which varlocs should error on). But it isn't an internal
consistency check (for which varlocs should assert).
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
tests/ChangeLog | 5 +++++
tests/varlocs.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3b69a87..e5df211 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,10 @@
2018-06-08 Mark Wielaard <mark@klomp.org>
+ * varlocs.c (print_expr): Error on bad DW_OP_GNU_parameter_ref
+ target, do not assert.
+
+2018-06-08 Mark Wielaard <mark@klomp.org>
+
* get-units-invalid.c (main): Check invalid dwarf_getabbrev call.
* show-abbrev.c (main): Check illegal dwarf_getabbrev offset call.
diff --git a/tests/varlocs.c b/tests/varlocs.c
index 99c3887..f4a711c 100644
--- a/tests/varlocs.c
+++ b/tests/varlocs.c
@@ -546,7 +546,8 @@ print_expr (Dwarf_Attribute *attr, Dwarf_Op *expr, Dwarf_Addr addr)
// XXX actually lookup DW_TAG_GNU_call_site_parameter
printf ("%s[%" PRIx64 "]", opname, dwarf_dieoffset (¶m));
assert (expr->number == dwarf_cuoffset (¶m));
- assert (dwarf_tag (¶m) == DW_TAG_formal_parameter);
+ if (dwarf_tag (¶m) != DW_TAG_formal_parameter)
+ error (EXIT_FAILURE, 0, "Not a formal parameter");
}
break;
--
1.8.3.1
More information about the Elfutils-devel
mailing list