public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libdw: Handle DW_OP_GNU_uninit in dwarf_getlocation
Date: Fri, 10 Feb 2023 14:01:12 +0100	[thread overview]
Message-ID: <20230210130112.1093665-1-mark@klomp.org> (raw)

dwarf_getlocation would return an error when it saw a
DW_OP_GNU_uninit. Handle it by simply recognizing as a no argument
operation.

DW_OP_GNU_uninit is emitted by GCC as a marker to flag the location
expression as referring to an uninitialized value.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libdw/ChangeLog           | 5 +++++
 libdw/dwarf_getlocation.c | 1 +
 tests/ChangeLog           | 4 ++++
 tests/varlocs.c           | 6 ++++++
 4 files changed, 16 insertions(+)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 71e96c88..9bea831e 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2023-02-10  Mark Wielaard  <mark@klomp.org>
+
+	* dwarf_getlocation.c (__libdw_intern_expression): Handle
+	DW_OP_GNU_uninit.
+
 2023-01-22  Mark Wielaard  <mark@klomp.org>
 
 	* dwarf_getscopes.c (pc_record): Return nscopes when done.
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index d0d78163..553fdc98 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -396,6 +396,7 @@ __libdw_intern_expression (Dwarf *dbg, bool other_byte_order,
 	case DW_OP_form_tls_address:
 	case DW_OP_GNU_push_tls_address:
 	case DW_OP_stack_value:
+	case DW_OP_GNU_uninit:
 	  /* No operand.  */
 	  break;
 
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 974a3a4f..fd261bc6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2023-02-10  Mark Wielaard  <mark@klomp.org>
+
+	* varlocs.c (print_expr): Handle DW_OP_GNU_uninit.
+
 2023-02-03  Mark Wielaard  <mark@klomp.org>
 
 	* run-addr2line-C-test.sh: Check ELFUTILS_DISABLE_DEMANGLE.
diff --git a/tests/varlocs.c b/tests/varlocs.c
index d2c13767..8e563fd3 100644
--- a/tests/varlocs.c
+++ b/tests/varlocs.c
@@ -251,6 +251,12 @@ print_expr (Dwarf_Attribute *attr, Dwarf_Op *expr, Dwarf_Addr addr, int depth)
       printf ("%s", opname);
       break;
 
+    case DW_OP_GNU_uninit:
+      /* No arguments. Special. It means the expression describes
+	 an value which hasn't been initialized (yet).  */
+      printf ("%s", opname);
+      break;
+
     case DW_OP_call_frame_cfa:
       /* No arguments. Special. Pushes Call Frame Address as computed
 	 by CFI data (dwarf_cfi_addrframe will fetch that info (either from
-- 
2.39.1


             reply	other threads:[~2023-02-10 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 13:01 Mark Wielaard [this message]
2023-02-14 16:30 ` Mark Wielaard

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=20230210130112.1093665-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@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).