From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4684 invoked by alias); 12 Jun 2007 16:24:46 -0000 Received: (qmail 4668 invoked by uid 22791); 12 Jun 2007 16:24:45 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Jun 2007 16:24:43 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id l5CGOd7O164438 for ; Tue, 12 Jun 2007 16:24:39 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l5CGOdIX4001862 for ; Tue, 12 Jun 2007 18:24:39 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l5CGOd81019860 for ; Tue, 12 Jun 2007 18:24:39 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l5CGOd9q019856; Tue, 12 Jun 2007 18:24:39 +0200 Message-Id: <200706121624.l5CGOd9q019856@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Tue, 12 Jun 2007 18:24:39 +0200 Subject: Re: [5/10] Add "explicit size" types to builtin_type To: drow@false.org (Daniel Jacobowitz) Date: Tue, 12 Jun 2007 16:24:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20070612152235.GC16068@caradoc.them.org> from "Daniel Jacobowitz" at Jun 12, 2007 11:22:35 AM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-06/txt/msg00197.txt.bz2 Daniel Jacobowitz wrote: > This one may be a problem. From tdesc_named_type: > > /* Next try some predefined types. Note that none of these types > depend on the current architecture; some of the builtin_type_foo > variables are swapped based on the architecture. */ > if (strcmp (id, "int8") == 0) > return builtin_type_int8; > > This function is returning types for register values, before we have > constructed the corresponding gdbarch. We'll now grab them from some > other random gdbarch (of course, we were sort of doing that before, > but it worked - in practice these types are never used anywhere that > their address can be taken). > > I wonder if we could fix this by moving the pointer and reference type > caches out of the types themselves, and into per-architecture data? > Or perhaps use tables based only on the pointer size and other > attributes; they do not really need to be per-architecture, just > cached. An i386 and i686 can use the same void *. Hmmm. One thing I liked about the approach in my patch was that it in effect made *all* types gdbarch-specific. This would have allowed in the end to implement something like a get_type_arch () routine, which could be quite useful to push references to current_gdbarch out of the symbol parts of the debugger (where we often do not have a local gdbarch / frame / regcache argument, but where we typically operate on types or values). If we have genuinely architecture-independent types, a routine like lookup_pointer_type cannot be implemented without reference to a global current_gdbarch (unless it receives an explicit gdbarch argument and all callers are modified) ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com