From patchwork Sun May 13 03:38:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 158801 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 0601CB700D for ; Sun, 13 May 2012 13:39:11 +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=1337485152; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=Ccg8v3/ 3d9e2FWNUPS6Kvecr2b0=; b=qQ2MgVBSGI6VugmACg1rpICYvPB2E1SDLhs6Cpy X77ottLzxlj7Z4hKnEFjsjJCSmA+47Syt/SAL/6JWI3jN5RF2xoLEVaCpv/d8gTn dhmrkfZeVPkzq4iYOrShqDqWY98tuqb0uVpCbJRoPKTI0YJsz22c9z1djNuMMofS j5Eo= 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:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WXSalnnUIf3JCecKXXAhK3wMS/9VsIVdE9W29pwudlopbz6P2qpKW87hsYiq5v CNV1DlXpU0gGfaVLURXbZp3FjyRHKKy3rCaqvMWGDhLbz6CeGwXHKLMVUeVBS45L DNBha8ALFNx50HivktZGCv1qpvnA0WkaBrzKNcWFpvJn4=; Received: (qmail 19805 invoked by alias); 13 May 2012 03:39:07 -0000 Received: (qmail 19797 invoked by uid 22791); 13 May 2012 03:39:06 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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, 13 May 2012 03:38:49 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4D3cnpY007077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 12 May 2012 23:38:49 -0400 Received: from [10.3.113.44] (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4D3cmw8019181 for ; Sat, 12 May 2012 23:38:48 -0400 Message-ID: <4FAF2CC8.90309@redhat.com> Date: Sat, 12 May 2012 23:38:48 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: dwarf2out PATCH for debug/53235 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 According to discussion in the PR, GDB would prefer a DW_TAG_structure_type with DW_AT_signature to a DW_TAG_typedef with DW_AT_type when the type in question is a class. I haven't been able to reproduce the failure with current GDB, but it passes the testsuite after the change as well. Tested x86_64-pc-linux-gnu, applied to trunk. commit d03ef85f43045bd98e0b6c0e2c811896fbc10a3f Author: Jason Merrill Date: Tue May 8 06:15:13 2012 -0400 PR debug/53235 * dwarf2out.c (build_local_stub): Prefer DW_AT_signature for comdat types. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1e5e335..9ba65fb 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6929,36 +6929,31 @@ static int build_local_stub (void **slot, void *data) { struct external_ref *ref_p = (struct external_ref *)*slot; - dw_die_ref cu = (dw_die_ref) data; - dw_die_ref type = ref_p->type; - dw_die_ref stub = NULL; - if (ref_p->stub == NULL && ref_p->n_refs > 1) + if (ref_p->stub == NULL && ref_p->n_refs > 1 && !dwarf_strict) { - if (!dwarf_strict) + /* We have multiple references to this type, so build a small stub. + Both of these forms are a bit dodgy from the perspective of the + DWARF standard, since technically they should have names. */ + dw_die_ref cu = (dw_die_ref) data; + dw_die_ref type = ref_p->type; + dw_die_ref stub = NULL; + + if (type->comdat_type_p) { - /* If we aren't being strict, use a typedef with no name - to just forward to the real type. In strict DWARF, a - typedef must have a name. */ - stub = new_die (DW_TAG_typedef, cu, NULL_TREE); - add_AT_die_ref (stub, DW_AT_type, type); - } - else if (type->comdat_type_p) - { - /* If we refer to this type via sig8, we can use a simple - declaration; this is larger than the typedef, but strictly - correct. */ + /* If we refer to this type via sig8, use AT_signature. */ stub = new_die (type->die_tag, cu, NULL_TREE); - add_AT_string (stub, DW_AT_name, get_AT_string (type, DW_AT_name)); - add_AT_flag (stub, DW_AT_declaration, 1); add_AT_die_ref (stub, DW_AT_signature, type); } - - if (stub) + else { - stub->die_mark++; - ref_p->stub = stub; + /* Otherwise, use a typedef with no name. */ + stub = new_die (DW_TAG_typedef, cu, NULL_TREE); + add_AT_die_ref (stub, DW_AT_type, type); } + + stub->die_mark++; + ref_p->stub = stub; } return 1; }