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] Add assert in partition_found_dups
Date: Thu, 18 Feb 2021 14:04:19 +0100	[thread overview]
Message-ID: <37c5db79-d36e-cbaa-c02e-1afe79f073aa@suse.de> (raw)
In-Reply-To: <20210216091146.GA32276@delia>

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

[ was: Re: [PATCH] Fix CK_BAD propagation for --odr ]
On 2/16/21 10:11 AM, Tom de Vries wrote:
> We can catch the problem of the checksum much earlier, with an assert:
> ...
>  static void
>  partition_found_dups (dw_die_ref die, struct obstack *vec)
>  {
> +  assert (die->die_ck_state == CK_KNOWN);
> ...

Committed assert for now.

Thanks,
- Tom


[-- Attachment #2: 0001-Add-assert-in-partition_found_dups.patch --]
[-- Type: text/x-patch, Size: 2597 bytes --]

Add assert in partition_found_dups

With the reproducer from PR26252 we get:
...
$ dwz -m 3 --odr 1 2
dwz: 1: DWARF compression not beneficial - old size 317760 new size 317760
dwz: dwz.c:12431: write_die: \
  Assertion `value && refdcu->cu_kind != CU_ALT' failed.
Aborted (core dumped)
...

The assertion fails when writing out the contribution of file 2 to the
multifile.

It's trying to write out a copy of this DIE:
...
 <3><9f3e>: Abbrev Number: 149 (DW_TAG_subprogram)
    <9f40>   DW_AT_name        :
             _M_access<ydotool::Tool::ToolManager::ScanPath(const string&)::\
	       <lambda(const string&, dirent*)> >
    <9f44>   DW_AT_decl_file   : 11
    <9f45>   DW_AT_decl_line   : 92
    <9f46>   DW_AT_decl_column : 7
    <9f47>   DW_AT_type        : <0x1a2a5>
    <9f4b>   DW_AT_declaration : 1
    <9f4b>   DW_AT_object_pointer: <0x9f5c>
    <9f4f>   DW_AT_sibling     : <0x9f62>
...
and specifically, for the DW_AT_type attribute it attempts to write out the
reference to the copy of the DIE at 0x1a2a5:
...
 <1><1a2a5>: Abbrev Number: 9 (DW_TAG_reference_type)
    <1a2a6>   DW_AT_byte_size   : 8
    <1a2a7>   DW_AT_type        : <0x27cd9>
...

There is no copy of that DIE, because it has a bad checksum:
...
  1a2a5 X d27b2f2a d27b2f2a  reference_type (type: 27cd9 structure_type)
...
which means that its toplevel DIE 0x9edc:
...
<2><9edc>: Abbrev Number: 182 (DW_TAG_union_type)
    <9ede>   DW_AT_name        : _Any_data
...
should also have a bad checksum, but it doesn't:
...
   9edc O 9d6524b4 9d6524b4 _Any_data union_type
...
while without --odr, it does:
...
   9edc X d8f947f3 5100c9e1 _Any_data union_type
...

Add an assert partition_found_dups such that we can catch the problem of the
checksum much earlier:
...
 static void
 partition_found_dups (dw_die_ref die, struct obstack *vec)
 {
+  assert (die->die_ck_state == CK_KNOWN);
...
which means we can reproduce with just one file:
...
$ dwz 2 --odr
dwz: dwz.c:7372: partition_found_dups: \
  Assertion `die->die_ck_state == CK_KNOWN' failed.
Aborted (core dumped)
...

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

	* dwz.c (partition_found_dups): Assert that
	die->die_ck_state == CK_KNOWN.

---
 dwz.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dwz.c b/dwz.c
index d037e1e..0b751fc 100644
--- a/dwz.c
+++ b/dwz.c
@@ -7393,6 +7393,7 @@ partition_cmp (const void *p, const void *q)
 static void
 partition_found_dups (dw_die_ref die, struct obstack *vec)
 {
+  assert (die->die_ck_state == CK_KNOWN);
   obstack_ptr_grow (vec, die);
   if (unlikely (verify_dups_p))
     verify_dups (die, true);

  reply	other threads:[~2021-02-18 13:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16  9:11 [PATCH] Fix CK_BAD propagation for --odr Tom de Vries
2021-02-18 13:04 ` Tom de Vries [this message]
2021-02-18 14:20 ` Tom de Vries
2021-02-22  7:51   ` Tom de Vries

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=37c5db79-d36e-cbaa-c02e-1afe79f073aa@suse.de \
    --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).