public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tests: Don't assert on bad DW_OP_GNU_parameter_ref target in varlocs.
@ 2018-06-08 19:18 Mark Wielaard
  2018-06-11  6:38 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2018-06-08 19:18 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

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 (&param));
 	assert (expr->number == dwarf_cuoffset (&param));
-	assert (dwarf_tag (&param) == DW_TAG_formal_parameter);
+	if (dwarf_tag (&param) != DW_TAG_formal_parameter)
+	  error (EXIT_FAILURE, 0, "Not a formal parameter");
       }
       break;
 
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests: Don't assert on bad DW_OP_GNU_parameter_ref target in varlocs.
  2018-06-08 19:18 [PATCH] tests: Don't assert on bad DW_OP_GNU_parameter_ref target in varlocs Mark Wielaard
@ 2018-06-11  6:38 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2018-06-11  6:38 UTC (permalink / raw)
  To: elfutils-devel

On Fri, 2018-06-08 at 21:18 +0200, Mark Wielaard wrote:
> 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).

Pushed to master.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-11  6:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 19:18 [PATCH] tests: Don't assert on bad DW_OP_GNU_parameter_ref target in varlocs Mark Wielaard
2018-06-11  6:38 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).