From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9136 invoked by alias); 6 Dec 2006 20:04:32 -0000 Received: (qmail 9115 invoked by uid 22791); 6 Dec 2006 20:04:30 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Dec 2006 20:04:24 +0000 Received: (qmail 9248 invoked from network); 6 Dec 2006 20:04:23 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Dec 2006 20:04:23 -0000 To: gdb-patches@sourceware.org Subject: Re: Now I know why we used to swap builtin_type_void. References: <20061206195227.GA9228@nevyn.them.org> From: Jim Blandy Date: Wed, 06 Dec 2006 20:04:00 -0000 In-Reply-To: <20061206195227.GA9228@nevyn.them.org> (Daniel Jacobowitz's message of "Wed, 6 Dec 2006 14:52:27 -0500") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes 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: 2006-12/txt/msg00073.txt.bz2 Daniel Jacobowitz writes: > (top-gdb) p *builtin_type_void_data_ptr > $24 = {pointer_type = 0x0, reference_type = 0x0, chain = 0x7b50d0, > instance_flags = 0, length = 8, main_type = 0x7b5100} > (top-gdb) p current_gdbarch.ptr_bit > $25 = 32 > > Because we didn't swap out "void", we followed the cached pointer link > in builtin_type_void when we tried to create a pointer to void. My > initial default gdbarch was 64-bit, because I built a 64-bit GDB > binary. So the cached pointer type is 64-bit. > > This is a mess. I think we may need to revert the builtin_type_void > patch unless you have a better idea. I see --- because types point to their pointer types, if we need to swap pointer types, we must also swap target types. Why doesn't the same logic apply to the other types created in _initialize_gdbtypes? I believe they're never referred to by debug information, and the user has no way to refer to them from the command line, so that keeps us out of trouble in those cases. But if some architecture-specific code ever calls lookup_pointer_type on them, won't we have the same problem you've discovered above with void? I'll revert the patch. It was just a cleanup; I don't actually need it for anything.