From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 850 invoked by alias); 18 Jul 2011 18:23:59 -0000 Received: (qmail 841 invoked by uid 22791); 18 Jul 2011 18:23:58 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ 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; Mon, 18 Jul 2011 18:23:38 +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.14.4/8.14.4) with ESMTP id p6IINaLY005688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 18 Jul 2011 14:23:36 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6IINaXb001019; Mon, 18 Jul 2011 14:23:36 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p6IINYLp017641; Mon, 18 Jul 2011 14:23:35 -0400 From: Tom Tromey To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org Subject: Re: [1/4] RFC: skip DIEs which only declare an enum References: Date: Mon, 18 Jul 2011 20:14:00 -0000 In-Reply-To: (Tom Tromey's message of "Mon, 18 Jul 2011 10:51:26 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00430.txt.bz2 >>>>> "Tom" == Tom Tromey writes: Tom> I am going withdraw this patch and look at other ways to fix this Tom> problem. Here is what I came up with. It seems to me that the bad case is exactly when we are reading a .debug_types CU and the enum type we are reading is not the signatured type. In this case, the enum type is needed for other types in the CU, but doesn't need a symbol, as presumably there is some other .debug_types CU that has the true definition. So, this patch implements just this exception. I rebased on it on patch #2, so the series ordering is different now. Built and regtested by the buildbot. In the absence of comments I plan to commit this in a couple of days. Tom 2011-07-18 Tom Tromey * dwarf2read.c (process_enumeration_scope): Do not call new_symbol in some declaration-only cases. >From 79fc44c91390d14bcf0f98f7e19d9b8888952595 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 18 Jul 2011 11:54:45 -0600 Subject: [PATCH 2/2] fix enum declaration regression --- gdb/ChangeLog | 5 +++++ gdb/dwarf2read.c | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 0 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4c8a732..e6cc94a 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1204,6 +1204,11 @@ static struct die_info *follow_die_sig (struct die_info *, struct attribute *, struct dwarf2_cu **); +static struct signatured_type *lookup_signatured_type_at_offset + (struct objfile *objfile, + struct dwarf2_section_info *section, + unsigned int offset); + static void read_signatured_type_at_offset (struct objfile *objfile, struct dwarf2_section_info *sect, unsigned int offset); @@ -7714,6 +7719,27 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) TYPE_UNSIGNED (this_type) = 1; } + /* If we are reading an enum from a .debug_types unit, and the enum + is a declaration, and the enum is not the signatured type in the + unit, then we do not want to add a symbol for it. Adding a + symbol would in some cases obscure the true definition of the + enum, giving users an incomplete type when the definition is + actually available. Note that we do not want to do this for all + enums which are just declarations, because C++0x allows forward + enum declarations. */ + if (cu->per_cu->debug_type_section + && die_is_declaration (die, cu)) + { + struct signatured_type *type_sig; + + type_sig + = lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile, + cu->per_cu->debug_type_section, + cu->per_cu->offset); + if (type_sig->type_offset != die->offset) + return; + } + new_symbol (die, this_type, cu); } -- 1.7.6