From patchwork Sun Nov 14 18:23:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 71142 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7BA9FB7117 for ; Mon, 15 Nov 2010 05:23:57 +1100 (EST) Received: (qmail 10078 invoked by alias); 14 Nov 2010 18:23:56 -0000 Received: (qmail 10069 invoked by uid 22791); 14 Nov 2010 18:23:55 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Nov 2010 18:23:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAEINE7B013831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 14 Nov 2010 13:23:15 -0500 Received: from adjoa.redhat.com ([10.3.113.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oAEINCuV009458; Sun, 14 Nov 2010 13:23:13 -0500 From: Dodji Seketeli To: Jason Merrill Cc: GCC Patches Subject: [PATCH] Add DIE addresses to debug_dwarf_die X-URL: http://www.seketeli.net/~dodji Date: Sun, 14 Nov 2010 19:23:11 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 -> ");