From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2501 invoked by alias); 17 May 2007 18:51:21 -0000 Received: (qmail 2492 invoked by uid 22791); 17 May 2007 18:51:20 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 17 May 2007 18:51:17 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id 26F7748CC93 for ; Thu, 17 May 2007 14:51:15 -0400 (EDT) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 13815-01-9 for ; Thu, 17 May 2007 14:51:15 -0400 (EDT) Received: from joel.gnat.com (unknown [70.71.0.212]) by nile.gnat.com (Postfix) with ESMTP id 89BF448CEC1 for ; Thu, 17 May 2007 14:51:13 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 47483E7B4F; Thu, 17 May 2007 11:51:44 -0700 (PDT) Date: Thu, 17 May 2007 18:51:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [RFA] wrong pointer type length part 2 (of 2) Message-ID: <20070517185144.GD508@adacore.com> References: <20070517161919.GA508@adacore.com> <20070517162737.GA29527@caradoc.them.org> <20070517163951.GB508@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/WwmFnJnmDyWGHa4" Content-Disposition: inline In-Reply-To: <20070517163951.GB508@adacore.com> User-Agent: Mutt/1.4.2.2i 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: 2007-05/txt/msg00298.txt.bz2 --/WwmFnJnmDyWGHa4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 720 > > > As a followup to this patch, I think that the same needs to be done > > > for at least make_reference_type, but I don't have hard evidence that > > > this will ever be needed right now. If it is agreed that this function > > > also needs an update, it can be made independently in a followup patch. > > > > Yes please. > > I'm working on the second part right now... OK, here is the second part that deals with reference types. 2007-05-17 Joel Brobecker * gdbtypes.c (make_reference_type): Preserve the type chain and set the length of all the variants of the pointer type. Tested on x86-linux (elf/dwarf), and ppc-aix (xcoff/stabs). OK to commit? Thanks, -- Joel --/WwmFnJnmDyWGHa4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="reftype.diff" Content-length: 1173 Index: gdbtypes.c =================================================================== RCS file: /cvs/src/src/gdb/gdbtypes.c,v retrieving revision 1.115 diff -u -p -r1.115 gdbtypes.c --- gdbtypes.c 17 May 2007 16:38:25 -0000 1.115 +++ gdbtypes.c 17 May 2007 16:40:53 -0000 @@ -354,6 +354,7 @@ make_reference_type (struct type *type, { struct type *ntype; /* New type */ struct objfile *objfile; + struct type *chain; ntype = TYPE_REFERENCE_TYPE (type); @@ -379,7 +380,9 @@ make_reference_type (struct type *type, { ntype = *typeptr; objfile = TYPE_OBJFILE (ntype); + chain = TYPE_CHAIN (ntype); smash_type (ntype); + TYPE_CHAIN (ntype) = chain; TYPE_OBJFILE (ntype) = objfile; } @@ -395,6 +398,14 @@ make_reference_type (struct type *type, if (!TYPE_REFERENCE_TYPE (type)) /* Remember it, if don't have one. */ TYPE_REFERENCE_TYPE (type) = ntype; + /* Update the length of all the other variants of this type. */ + chain = TYPE_CHAIN (ntype); + while (chain != ntype) + { + TYPE_LENGTH (chain) = TYPE_LENGTH (ntype); + chain = TYPE_CHAIN (chain); + } + return ntype; } --/WwmFnJnmDyWGHa4--