From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Get DIE names from specification and abstract origin
Date: Tue, 01 Jan 2019 00:00:00 -0000 [thread overview]
Message-ID: <20191203195627.GA24528@delia> (raw)
Hi,
Use DW_AT_specification and DW_AT_abstract_origin to get more DIE names in
dump_die:
...
- 6a5c357 X a89b7a11 0 subprogram
- 6a5c372 X 832dcdeb 0 formal_parameter
- 6a5c37f X 9e07c946 0 GNU_call_site
+ 6a5c357 X a89b7a11 0 __deregister_frame_info subprogram
+ 6a5c372 X 832dcdeb 0 begin formal_parameter
+ 6a5c37f X 9e07c946 0 __deregister_frame_info_bases GNU_call_site
...
Committed to trunk.
Thanks,
- Tom
Get DIE names from specification and abstract origin
2019-12-02 Tom de Vries <tdevries@suse.de>
* dwz.c (get_name): New function.
(dump_type, dump_die_with_indent): Use get_name.
---
dwz.c | 40 +++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/dwz.c b/dwz.c
index e533993..8eb676c 100644
--- a/dwz.c
+++ b/dwz.c
@@ -4132,6 +4132,40 @@ find_dups_fi (dw_die_ref parent)
return 0;
}
+/* Return value of DW_AT_name for DIE, or for its specification or abstract
+ origin. */
+static const char *
+get_name (dw_die_ref die)
+{
+ const char *name = get_AT_string (die, DW_AT_name);
+ if (name)
+ return name;
+ dw_cu_ref cu = die_cu (die);
+ bool present;
+ enum dwarf_form form;
+ unsigned int value = get_AT_int (die, DW_AT_specification, &present, &form);
+ if (present)
+ {
+ dw_die_ref ref;
+ if (form != DW_FORM_ref_addr)
+ value = cu->cu_offset + value;
+ ref = off_htab_lookup (cu, value);
+ if (ref)
+ return get_name (ref);
+ }
+ value = get_AT_int (die, DW_AT_abstract_origin, &present, &form);
+ if (present)
+ {
+ dw_die_ref ref;
+ if (form != DW_FORM_ref_addr)
+ value = cu->cu_offset + value;
+ ref = off_htab_lookup (die_cu (die), value);
+ if (ref)
+ return get_name (ref);
+ }
+ return NULL;
+}
+
/* Dump type of DIE to stderr. */
static void
dump_type (dw_die_ref die)
@@ -4155,7 +4189,7 @@ dump_type (dw_die_ref die)
ref = off_htab_lookup (cu, value);
if (ref != NULL && !ref->die_collapsed_child)
{
- const char *type_name = get_AT_string (ref, DW_AT_name);
+ const char *type_name = get_name (ref);
if (type_name)
fprintf (stderr, " %s", type_name);
fprintf (stderr, " %s", get_DW_TAG_name (ref->die_tag) + 7);
@@ -4177,7 +4211,7 @@ dump_die_with_indent (int indent, dw_die_ref die)
dw_die_ref d = die->die_nextdup;
while (d)
{
- const char *name = get_AT_string (d, DW_AT_name);
+ const char *name = get_name (d);
fprintf (stderr, " -> %x %s %s", d->die_offset, name ? name : "",
get_DW_TAG_name (d->die_tag) + 7);
d = d->die_nextdup;
@@ -4190,7 +4224,7 @@ dump_die_with_indent (int indent, dw_die_ref die)
}
else
{
- const char *name = get_AT_string (die, DW_AT_name);
+ const char *name = get_name (die);
fprintf (stderr, "%*s %x %c %x %x %s %s", indent, "", die->die_offset,
die->die_ck_state == CK_KNOWN ? 'O' : 'X',
(unsigned) die->u.p1.die_hash,
reply other threads:[~2019-12-03 19:56 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=20191203195627.GA24528@delia \
--to=tdevries@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.com \
/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).