From patchwork Sun Nov 14 18:23:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Add DIE addresses to debug_dwarf_die Date: Sun, 14 Nov 2010 08:23:11 -0000 From: Dodji Seketeli X-Patchwork-Id: 71142 Message-Id: To: Jason Merrill Cc: GCC Patches 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. 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 -> ");