This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add DIE addresses to debug_dwarf_die
- From: Dodji Seketeli <dodji at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 14 Nov 2010 19:23:11 +0100
- Subject: [PATCH] Add DIE addresses to debug_dwarf_die
Hello,
While working on another patch, I felt the need to add the addresses
of the DIEs to the output of debug_dwarf_die, similar to what
debug_tree does. Maybe this could be useful to others.
Now the output looks like [note the (0x7ffff19a70f0)]:
(gdb) call debug_dwarf_die(type_die)
DIE 0: DW_TAG_typedef (0x7ffff19a70f0)
abbrev id: 0 offset: 0 mark: 0
DW_AT_name: "A"
DW_AT_decl_file: "../../prtests/test.cc" (1)
DW_AT_decl_line: 4
DW_AT_type: die -> 0 (0x7ffff19a7140)
Tested on x86_64-unknown-linux-gnu against trunk.
--
Dodji
>From d0f16a0c851094eb6865849d5638b39280ea37e4 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@redhat.com>
Date: Sun, 14 Nov 2010 13:57:10 +0100
Subject: [PATCH 2/2] Add addresses of DIEs to debug_dwarf_die
gcc/
* dwarf2out.c (print_die): Print the address of the current DIE or
of any DIE referenced by the current one.
---
gcc/dwarf2out.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 1094a9f..ebeff3c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -8337,11 +8337,14 @@ print_die (dw_die_ref die, FILE *outfile)
unsigned ix;
print_spaces (outfile);
- fprintf (outfile, "DIE %4ld: %s\n",
- die->die_offset, dwarf_tag_name (die->die_tag));
+ fprintf (outfile, "DIE %4ld: %s (%p)\n",
+ die->die_offset, dwarf_tag_name (die->die_tag),
+ (void*) die);
print_spaces (outfile);
fprintf (outfile, " abbrev id: %lu", die->die_abbrev);
- fprintf (outfile, " offset: %ld\n", die->die_offset);
+ fprintf (outfile, " offset: %ld", die->die_offset);
+ fprintf (outfile, " mark: %d\n", die->die_mark);
+
if (dwarf_version >= 4 && die->die_id.die_type_node)
{
print_spaces (outfile);
@@ -8405,6 +8408,7 @@ print_die (dw_die_ref die, FILE *outfile)
AT_ref (a)->die_id.die_symbol);
else
fprintf (outfile, "die -> %ld", AT_ref (a)->die_offset);
+ fprintf (outfile, " (%p)", (void *) AT_ref (a));
}
else
fprintf (outfile, "die -> <null>");
--
1.7.2.3