public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][low-mem] Fix DW_OP_GNU_implicit_pointer handling
@ 2019-01-01  0:00 Tom de Vries
  2019-01-01  0:00 ` [committed][low-mem] " Tom de Vries
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

If dwz is processing a file f containing a DIE d in compilation unit cu_d,
with DW_AT_location pointing to a loclist with one of the locexprs containing
a DW_OP_GNU_implicit_pointer reference to a DIE not in cu_d (which can be the
case in dwz output), and dwz is processing in low-mem mode, then we may see
this message:
...
dwz: f: Couldn't find DIE referenced by DW_OP_GNU_implicit_pointer
...

The message is emitted in read_exprloc while we're calculating a checksum for
the DW_OP_GNU_implicit_pointer reference.  The reason we can't find the DIE
it's referencing, is that in low-mem mode, we can only count on the current
compilation unit and DW_FORM_ref_addr references to be available.

Fix this by silencing the message in low-mem mode.

OK for trunk?

Thanks,
- Tom

[low-mem] Fix DW_OP_GNU_implicit_pointer handling

2019-02-13  Tom de Vries  <tdevries@suse.de>

	PR dwz/24204
	* dwz.c (read_exprloc): Don't expect DW_OP_GNU_implicit_pointer
	referenced DIE to be present in low-mem mode.

---
 dwz.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/dwz.c b/dwz.c
index d348418..c214aa3 100644
--- a/dwz.c
+++ b/dwz.c
@@ -1533,8 +1533,22 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len,
 	  ref = off_htab_lookup (NULL, addr);
 	  if (ref == NULL)
 	    {
-	      error (0, 0, "%s: Couldn't find DIE referenced by %s",
-		     dso->filename, get_DW_OP_str (op));
+	      if (unlikely (low_mem))
+		/* This reference is relative to the start of the .debug_info
+		   section.  Typically, it's pointing to a DIE within the
+		   current compilation unit (that is, the one of variable die).
+		   But it could be pointing to any compilation unit (in fact,
+		   dwz itself generates code like that, so we could encounter
+		   this situation when processing an already dwz-compressed
+		   file).  In low_mem mode, we can only count on the current
+		   compilation unit and DW_FORM_ref_addr references to be
+		   available, so if we can't find the reference in off_htab, we
+		   consider ourselves unlucky and bail out, but don't consider
+		   it necessary to mention it.  */
+		;
+	      else
+		error (0, 0, "%s: Couldn't find DIE referenced by %s",
+		       dso->filename, get_DW_OP_str (op));
 	      return 1;
 	    }
 	  if (unlikely (low_mem))

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

end of thread, other threads:[~2019-04-29 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [PATCH][low-mem] Fix DW_OP_GNU_implicit_pointer handling Tom de Vries
2019-01-01  0:00 ` [committed][low-mem] " Tom de Vries

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).