public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Don't print die_hash2 for ODR_UNKNOWN in dump_die_with_indent
@ 2021-02-23  9:24 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-02-23  9:24 UTC (permalink / raw)
  To: dwz, jakub, mark

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-23  9:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23  9:24 [committed] Don't print die_hash2 for ODR_UNKNOWN in dump_die_with_indent 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).