From patchwork Thu Oct 4 18:32:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Koning X-Patchwork-Id: 189244 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 D9D972C03CF for ; Fri, 5 Oct 2012 04:32:43 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349980364; h=Comment: DomainKey-Signature:Received:Received:Received:From:To:CC: Subject:Date:Message-ID:References:In-Reply-To:Content-Type: Content-ID:Content-Transfer-Encoding:MIME-Version:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=tUX3JRl1c6bylxqg4BVlsy/FvPI=; b=d0sDy1glWOLOw/o1YZZoomVS+9ku/WLDIo1ns4721oQcluBGGJoQ+068d7MJvY DYsW+4VRxFHNAFqOo22sU6lrVgqm9d9fPtQUubi0BOsgudJPthPIFt/GHzRdYB5h 1i8Ck5gYvoIuHn2RVtTSCUWHQ1NuEt0tlu74LplGX4q0s= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:X-Loopcount0:From:To:CC:Subject:Date:Message-ID:References:In-Reply-To:Content-Type:Content-ID:Content-Transfer-Encoding:MIME-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=tcQI1WWNeq0V2eCkRIcxWqJvLLcNxVL/I8STxG7HcXgrA0TTtNnyMxlWSpa0qX WPh7ACVFj3MbJVkJUDUxnnojqprERS36HUTkAhI3JImBHMncJCtu8Qo3wamx3IzM d0r9rouXuERrl6lFTDzC95rMCnPRYkrN4yaJYUADHSibo=; Received: (qmail 13255 invoked by alias); 4 Oct 2012 18:32:38 -0000 Received: (qmail 13243 invoked by uid 22791); 4 Oct 2012 18:32:36 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, KHOP_THREADED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausxipps301.us.dell.com (HELO ausxipps301.us.dell.com) (143.166.148.223) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Oct 2012 18:32:32 +0000 X-Loopcount0: from 10.175.216.251 From: To: CC: , Subject: Re: PING^2: [patch] pr/54508: fix incomplete debug information for class Date: Thu, 4 Oct 2012 18:32:20 +0000 Message-ID: References: In-Reply-To: Content-ID: <6FF7AC4A4324C44F8FE2F016ED3B56AA@dell.com> 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 On Oct 4, 2012, at 1:38 PM, Cary Coutant wrote: >> /* We also have to mark its parents as used. >> - (But we don't want to mark our parents' kids due to this.) */ >> + (But we don't want to mark our parent's kids due to this, >> + unless it is a class.) */ >> if (die->die_parent) >> - prune_unused_types_mark (die->die_parent, 0); >> + prune_unused_types_mark (die->die_parent, >> + (die->die_parent->die_tag == DW_TAG_class_type || >> + die->die_parent->die_tag == DW_TAG_structure_type || >> + die->die_parent->die_tag == DW_TAG_union_type)); > > I'd suggest replacing these conditions with a call to class_scope_p(). > That will also cover DW_TAG_interface_type, which might be irrelevant > for this particular case, but is probably good to cover in the general > case. > > -cary Thanks, that makes it very simple. Here is the updated patch. Ok to commit with this change? paul ChangeLog: 2012-10-04 Paul Koning * dwarf2out.c (prune_unused_types_mark): Mark all of parent's children if parent is a class. testsuite/ChangeLog: 2012-10-04 Paul Koning * g++.dg/debug/dwarf2/pr54508.C: New. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 192048) +++ gcc/dwarf2out.c (working copy) @@ -21035,9 +21035,11 @@ prune_unused_types_mark_generic_parms_dies (die); /* We also have to mark its parents as used. - (But we don't want to mark our parents' kids due to this.) */ + (But we don't want to mark our parent's kids due to this, + unless it is a class.) */ if (die->die_parent) - prune_unused_types_mark (die->die_parent, 0); + prune_unused_types_mark (die->die_parent, + class_scope_p (die->die_parent)); /* Mark any referenced nodes. */ prune_unused_types_walk_attribs (die); Index: testsuite/g++.dg/debug/dwarf2/pr54508.C =================================================================== --- testsuite/g++.dg/debug/dwarf2/pr54508.C (revision 0) +++ testsuite/g++.dg/debug/dwarf2/pr54508.C (revision 0) @@ -0,0 +1,67 @@ +// PR debug/54508 +// { dg-do compile } +// { dg-options "-g2 -dA" } + +// { dg-final { scan-assembler "\"cbase\\\\0\"\[ \t\]+\[#;/!|@\]+ DW_AT_name\|DW_AT_name: \"cbase\"" } } +// { dg-final { scan-assembler "\"OPCODE\\\\0\"\[ \t\]+\[#;/!|@\]+ DW_AT_name\|DW_AT_name: \"OPCODE\"" } } +// { dg-final { scan-assembler "\"bi\\\\0\"\[ \t\]+\[#;/!|@\]+ DW_AT_name" } } +// { dg-final { scan-assembler "\"si\\\\0\"\[ \t\]+\[#;/!|@\]+ DW_AT_name" } } +// { dg-final { scan-assembler "\"f1\\\\0\"\[ \t\]+\[#;/!|@\]+ DW_AT_name" } } +// { dg-final { scan-assembler "\"f2\\\\0\"\[ \t\]+\[#;/!|@\]+ DW_AT_name" } } +// { dg-final { scan-assembler-not "\"nc\\\\0\"\[ \t\]+\# DW_AT_name\|DW_AT_name: \"nc\"" } } + +class cbase + +{ +public: + static int si; + int bi; +}; + +class c : public cbase + +{ +public: + enum + { + OPCODE = 251 + }; + int i ; + static const char *testc (void) { return "foo"; } +}; + +struct s +{ + int f1; + static const char *tests (void) { return "test"; } +}; + +union u +{ + int f2; + double d; + static const char *testu (void) { return "test union"; } +}; + +namespace n +{ + const char *ntest (void) { return "test n"; } + + class nc + { + public: + int i; + static int sj; + }; +} + +extern void send (int, int, const void *, int); + +void test (int src) +{ + int cookie = 1; + send(src, c::OPCODE, c::testc (), cookie); + send(src, c::OPCODE, s::tests (), cookie); + send(src, c::OPCODE, u::testu (), cookie); + send(src, c::OPCODE, n::ntest (), cookie); +}