From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Cc: Mark Wielaard <mark@gcc.gnu.org>
Subject: [PATCH] Handle DW_FORM_implicit_const for DW_AT_decl_line
Date: Sun, 14 Feb 2021 09:52:04 +0100 [thread overview]
Message-ID: <20210214085202.GA16780@delia> (raw)
Hi,
When running the test-suite like this:
...
$ make clean; make; make check CC="gcc -gdwarf-5" CXX="g++ -gdwarf-5"
...
we run into:
...
FAIL: dwz/testsuite/dwz.tests/odr-struct.sh
...
The reason for the FAIL is that this DIE:
...
<1><115>: Abbrev Number: 2 (DW_TAG_structure_type)
<116> DW_AT_name : aaa
<11a> DW_AT_byte_size : 16
<11b> DW_AT_decl_file : 2
<11c> DW_AT_decl_line : 4
<11d> DW_AT_sibling : <0x13a>
...
with abbrev:
...
2 DW_TAG_structure_type [has children]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_sibling DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
...
is not recognized as a duplicate of DIE:
...
<1><1b9>: Abbrev Number: 2 (DW_TAG_structure_type)
<1ba> DW_AT_name : aaa
<1be> DW_AT_byte_size : 16
<1bf> DW_AT_decl_file : 2
<1c0> DW_AT_decl_line : 4
<1c0> DW_AT_sibling : <0x1dd>
...
with abbrev:
...
2 DW_TAG_structure_type [has children]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_implicit_const: 4
DW_AT_sibling DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
...
due to the DW_AT_decl_line attribute having different forms, DW_FORM_data1 and
DW_FORM_implicit_const.
Fix this in checksum_die and die_eq_1 by adding dedicated handling for
DW_AT_decl_line, similar to how that's done for DW_AT_decl_file.
Any comments?
Thanks,
- Tom
Handle DW_FORM_implicit_const for DW_AT_decl_line
2021-02-14 Tom de Vries <tdevries@suse.de>
PR dwz/27400
* dwz.c (checksum_die, die_eq_1): Handle DW_FORM_implicit_const for
DW_AT_decl_line.
---
dwz.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 58 insertions(+), 3 deletions(-)
diff --git a/dwz.c b/dwz.c
index 992da77..971c402 100644
--- a/dwz.c
+++ b/dwz.c
@@ -3510,7 +3510,35 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die)
case DW_AT_call_line:
case DW_AT_call_column:
if (ignore_locus)
- handled = true;
+ {
+ handled = true;
+ break;
+ }
+ switch (form)
+ {
+ case DW_FORM_data1: value = read_8 (ptr); handled = true; break;
+ case DW_FORM_data2: value = read_16 (ptr); handled = true; break;
+ case DW_FORM_data4: value = read_32 (ptr); handled = true; break;
+ case DW_FORM_data8: value = read_64 (ptr); handled = true; break;
+ case DW_FORM_udata:
+ value = read_uleb128 (ptr); handled = true; break;
+ case DW_FORM_implicit_const:
+ value = t->values[i]; handled = true; break;
+ default:
+ error (0, 0, "%s: Unhandled %s for %s",
+ dso->filename, get_DW_FORM_str (form),
+ get_DW_AT_str (t->attr[i].attr));
+ return 1;
+ }
+ if (handled)
+ {
+ ptr = old_ptr;
+ s = t->attr[i].attr;
+ die->u.p1.die_hash
+ = iterative_hash_object (s, die->u.p1.die_hash);
+ die->u.p1.die_hash
+ = iterative_hash_object (value, die->u.p1.die_hash);
+ }
break;
default:
break;
@@ -4797,8 +4825,35 @@ die_eq_1 (dw_cu_ref cu1, dw_cu_ref cu2,
case DW_AT_call_line:
case DW_AT_call_column:
if (ignore_locus)
- old_ptr1 = NULL;
- break;
+ {
+ old_ptr1 = NULL;
+ break;
+ }
+ switch (form1)
+ {
+ case DW_FORM_data1: value1 = read_8 (ptr1); break;
+ case DW_FORM_data2: value1 = read_16 (ptr1); break;
+ case DW_FORM_data4: value1 = read_32 (ptr1); break;
+ case DW_FORM_data8: value1 = read_64 (ptr1); break;
+ case DW_FORM_udata: value1 = read_uleb128 (ptr1); break;
+ case DW_FORM_implicit_const: value1 = t1->values[i]; break;
+ default: abort ();
+ }
+ switch (form2)
+ {
+ case DW_FORM_data1: value2 = read_8 (ptr2); break;
+ case DW_FORM_data2: value2 = read_16 (ptr2); break;
+ case DW_FORM_data4: value2 = read_32 (ptr2); break;
+ case DW_FORM_data8: value2 = read_64 (ptr2); break;
+ case DW_FORM_udata: value2 = read_uleb128 (ptr2); break;
+ case DW_FORM_implicit_const: value2 = t2->values[j]; break;
+ default: abort ();
+ }
+ if (value1 != value2)
+ FAIL;
+ i++;
+ j++;
+ continue;
default:
break;
}
next reply other threads:[~2021-02-14 8:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-14 8:52 Tom de Vries [this message]
2021-02-14 19:10 ` Mark Wielaard
2021-02-14 19:19 ` Jakub Jelinek
2021-02-14 21:27 ` Tom de Vries
2021-02-15 12:54 ` Tom de Vries
2021-02-14 21:23 ` 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=20210214085202.GA16780@delia \
--to=tdevries@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.com \
--cc=mark@gcc.gnu.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).