From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4672 invoked by alias); 18 Dec 2009 13:06:36 -0000 Received: (qmail 4661 invoked by uid 22791); 18 Dec 2009 13:06:35 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Dec 2009 13:06:31 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E746C2BABFE; Fri, 18 Dec 2009 08:06:29 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id X9O0WvN6MF9a; Fri, 18 Dec 2009 08:06:29 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 6AD5D2BABAB; Fri, 18 Dec 2009 08:06:29 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 8BE6BF58CF; Fri, 18 Dec 2009 14:06:12 +0100 (CET) Date: Fri, 18 Dec 2009 13:06:00 -0000 From: Joel Brobecker To: Vladimir Prus Cc: gdb-patches@sourceware.org Subject: Re: RFA: unbreak typedefed bitfield Message-ID: <20091218130612.GD2788@adacore.com> References: <200912181541.30891.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912181541.30891.vladimir@codesourcery.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2009-12/txt/msg00251.txt.bz2 > And here's a trivial patch to fix this problem. I would claim this > clearly indicates a design bug in GDB type mechanism -- and it bites > us repeatedly, but I'm not ready to propose a specific way to fix it, > yet. I have noticed the same issue repeatedly in the Ada section of the code, and it's been really annoying to bump into this. As a result, we've seen an explosion of check_typedef (or the Ada equivalent ada_check_typedef), and I also feel that something's not right. I have a general feeling that most of the time, the typedef should have never been passed down. But I haven't spent the time and effort to try to think globally. I did have some thoughts for the Ada side, where things are a little more codified (and where every type is also a typedef), but that requires a revamp of the Ada code, which I'm leaving for later, when most of AdaCore's code in the FSF tree. In your case, we are being repeatdly bitten because we still manipulate a raw struct gdb_type. If we have an opaque structure, it would probably be easier to have a more general solution. Right now, we access everything directly, so we have to be careful, depending on the situation. > --- a/gdb/value.c > +++ b/gdb/value.c > @@ -1873,6 +1873,7 @@ value_primitive_field (struct value *arg1, int offset, > > CHECK_TYPEDEF (arg_type); > type = TYPE_FIELD_TYPE (arg_type, fieldno); > + check_typedef (type); > > /* Handle packed fields */ Looks OK to me (you forgot the ChangeLog entry, btw). -- Joel