public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed] Don't print die_hash2 for ODR_UNKNOWN in dump_die_with_indent
Date: Tue, 23 Feb 2021 10:24:31 +0100	[thread overview]
Message-ID: <20210223092430.GA3417@delia.home> (raw)

Hi,

With the following debugging session where we dwz exec hello using odr:
...
$ gdb -q --args dwz hello -o hello.z --odr
Reading symbols from dwz...
(gdb) b checksum_die
Breakpoint 1 at 0x409778: file dwz.c, line 3348.
(gdb) r
Starting program: dwz hello -o hello.z --odr

Breakpoint 1, checksum_die (...) at dwz.c:3348
3348      switch (die->die_ck_state)
(gdb) call dump_die (die)
 b X 0(0) 0 ../sysdeps/x86_64/start.S compile_unit
(gdb) p die->die_odr_state
$1 = ODR_UNKNOWN
...
we see that we're printing the die_hash2 for a die with die_odr_state ==
ODR_UNKNOWN, while this is only supposed to trigger for ODR_DECL and ODR_DEF.

Fix this in dump_die_with_indent, by not printing die_hash2 when die_odr_state ==
ODR_UNKNOWN.

Committed to trunk.

Thanks,
- Tom

Don't print die_hash2 for ODR_UNKNOWN in dump_die_with_indent

2021-02-23  Tom de Vries  <tdevries@suse.de>

	* dwz.c (dump_die_with_indent): Don't print die_hash2 when
	die_odr_state == ODR_UNKNOWN.

---
 dwz.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dwz.c b/dwz.c
index 86863ce..6c516cf 100644
--- a/dwz.c
+++ b/dwz.c
@@ -5482,7 +5482,8 @@ dump_die_with_indent (int indent, dw_die_ref die)
       fprintf (stderr, "%*s %x %c %x", indent, "", die->die_offset,
 	       die->die_ck_state == CK_KNOWN ? 'O' : 'X',
 	       (unsigned) die->u.p1.die_hash);
-      if (odr && die->die_odr_state != ODR_NONE)
+      if (odr && die->die_odr_state != ODR_NONE
+	   && die->die_odr_state != ODR_UNKNOWN)
 	  fprintf (stderr, "(%x)", (unsigned) die->u.p1.die_hash2);
       fprintf (stderr, " %x %s %s", (unsigned) die->u.p1.die_ref_hash,
 	       name ? name : "", get_DW_TAG_name (die->die_tag) + 7);

                 reply	other threads:[~2021-02-23  9:24 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=20210223092430.GA3417@delia.home \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.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).