From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3424 invoked by alias); 29 Oct 2007 18:59:11 -0000 Received: (qmail 3414 invoked by uid 22791); 29 Oct 2007 18:59:10 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.29.155) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 29 Oct 2007 18:59:04 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.8/8.13.8) with ESMTP id l9TIx1Ng182908 for ; Mon, 29 Oct 2007 18:59:01 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.5) with ESMTP id l9TIx1981831114 for ; Mon, 29 Oct 2007 19:59:01 +0100 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 l9TIx0HV006360 for ; Mon, 29 Oct 2007 19:59:01 +0100 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 l9TIx0k9006357; Mon, 29 Oct 2007 19:59:00 +0100 Message-Id: <200710291859.l9TIx0k9006357@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 29 Oct 2007 19:59:00 +0100 Subject: Re: [rfc] PowerPC ABI detection and overrides To: drow@false.org (Daniel Jacobowitz) Date: Mon, 29 Oct 2007 19:02:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <20071029183229.GA10700@caradoc.them.org> from "Daniel Jacobowitz" at Oct 29, 2007 02:32:29 PM 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-10/txt/msg00766.txt.bz2 Daniel Jacobowitz wrote: > > Hmmm, I would have hoped we could get away from directly refering > > to the BFD in the gdbarch_init routine ... It would be nicer to > > more strictly distinguish between detecting ABI properties from > > the BFD (in the *sniffer*), and installing an gdbarch handler > > supporting a particular set of ABI properties (in the gdbarch_init > > routine). > > > > This would allow to request a specific gdbarch in the situation > > where you know exactly which ABI properties you need, but don't > > have any BFD handy ... > > Can you give me an example of when you want to do that? In general > I've been moving away from it - there's too much extra bookkeeping > that the BFD does for us. The situation came up in the context of the multi-architecture Cell debugger, where you have to switch between SPU and PPC gdbarchs. Now, in most case, you'll have an appropriate BFD available anyway, but in some cases you don't: e.g. when debugging a "stand-alone" SPU executable, the only BFD you have at start-up is SPU, but the inferior process is actually still a PPC, and the underlying infrastucture has in fact loaded PPC-side ld.so and libraries. In this situation, I want to get at those by starting from the PT_DYNAMIC header retrieved from the AT_PHDR AUXV entries, and finding my way to the ld.so structures. But to even properly access the target, I need to switch to a PPC gdbarch even before I have any PPC BFD available. Thinking about the problem I had at the time, maybe the real issue is that those features detected from the BFD are not considered as distinuishing factors when deciding whether to set up a new gdbarch or return a cached one: /* Find a candidate among extant architectures. */ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL; arches = gdbarch_list_lookup_by_info (arches->next, &info)) { /* Word size in the various PowerPC bfd_arch_info structs isn't meaningful, because 64-bit CPUs can run in 32-bit mode. So, perform separate word size check. */ tdep = gdbarch_tdep (arches->gdbarch); if (tdep && tdep->wordsize == wordsize) { if (tdesc_data != NULL) tdesc_data_cleanup (tdesc_data); return arches->gdbarch; } } Note that gdbarch_list_lookup_by_info ignores the info.abfd field. This means that if you first looked up any PPC gdbarch without specifying a BFD, and later on you look up a PPC gdbarch with BFD, you'll get that first gdbarch returned from the cache, even though it doesn't actually fit the current properties. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com