public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Kevin Buettner <kevinb@redhat.com>
Subject: [pushed] Simplify case DW_OP_GNU_uninit in dwarf_expr_context::execute_stack_op
Date: Mon, 12 Jun 2023 16:04:58 -0700	[thread overview]
Message-ID: <20230612230458.211814-1-kevinb@redhat.com> (raw)

Tom Tromey pointed out that the test and call to error() for the
DW_OP_GNU_uninit case in dwarf_expr_context::execute_stack_op (in
gdb/dwarf2/expr.c)...

	  if (op_ptr != op_end && *op_ptr != DW_OP_piece
	      && *op_ptr != DW_OP_bit_piece)
	    error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
		   "be the very last op in a DWARF expression or "
		   "DW_OP_piece/DW_OP_bit_piece piece."));

...could be replaced by a call to dwarf_expr_require_composition which
performs a similar check and outputs a suitable error message.
---
 gdb/dwarf2/expr.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index 7e1666165d7..b21016eb38b 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -2200,12 +2200,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	  goto no_push;
 
 	case DW_OP_GNU_uninit:
-	  if (op_ptr != op_end && *op_ptr != DW_OP_piece
-	      && *op_ptr != DW_OP_bit_piece)
-	    error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
-		   "be the very last op in a DWARF expression or "
-		   "DW_OP_piece/DW_OP_bit_piece piece."));
-
+	  dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_GNU_uninit");
 	  this->m_initialized = false;
 	  goto no_push;
 
-- 
2.40.1


                 reply	other threads:[~2023-06-12 23:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230612230458.211814-1-kevinb@redhat.com \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).