From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24672 invoked by alias); 15 Jul 2011 18:07:15 -0000 Received: (qmail 24664 invoked by uid 22791); 15 Jul 2011 18:07:14 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_GD 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; Fri, 15 Jul 2011 18:07:01 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6FI71xH013903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Jul 2011 14:07:01 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6FI70xb007245; Fri, 15 Jul 2011 14:07:00 -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 p6FI6xhW013887; Fri, 15 Jul 2011 14:06:59 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [1/4] RFC: skip DIEs which only declare an enum Date: Fri, 15 Jul 2011 18:08:00 -0000 Message-ID: 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/msg00391.txt.bz2 With -gdwarf-4: -PASS: gdb.cp/classes.exp: print ('ClassWithEnum::PrivEnum') 42 -PASS: gdb.cp/classes.exp: print (ClassWithEnum::PrivEnum) 42 +FAIL: gdb.cp/classes.exp: print ('ClassWithEnum::PrivEnum') 42 +FAIL: gdb.cp/classes.exp: print (ClassWithEnum::PrivEnum) 42 What happens here is that gcc emits multiple .debug_type CUs. While reading one such CU, we see an empty declaration for PrivEnum. This gets turned into a symbol, and later we end up with an incomplete type. This patch fixes the problem by simply skipping declaration-only enums. This makes it so only the full definition is put into the symbol table, letting check_typedef work. This is one of the patches I am less sure about. Is it really safe? It also may change the error a user sees in some obscure case -- but to my mind there is not much practical difference between "type not found" and "type found but useless". Built and regtested by the buildbot. Tom b/gdb/ChangeLog: 2011-07-15 Tom Tromey * dwarf2read.c (process_enumeration_scope): Do nothing if DIE is a declaration. >From 70edf0b3d0c20619964be5692f4782efec033c94 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 14 Jul 2011 14:48:47 -0600 Subject: [PATCH 1/4] do not process an enum which is just a declaration --- gdb/ChangeLog | 5 +++++ gdb/dwarf2read.c | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index fde5b6a..0fd3845 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7612,6 +7612,9 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) { struct type *this_type; + if (die_is_declaration (die, cu)) + return; + this_type = get_die_type (die, cu); if (this_type == NULL) this_type = read_enumeration_type (die, cu); -- 1.7.6