From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26927 invoked by alias); 23 Oct 2003 23:41:51 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26920 invoked from network); 23 Oct 2003 23:41:50 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 23 Oct 2003 23:41:50 -0000 Received: from drow by nevyn.them.org with local (Exim 4.24 #1 (Debian)) id 1ACp5S-0004EO-91 for ; Thu, 23 Oct 2003 19:41:50 -0400 Date: Thu, 23 Oct 2003 23:41:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: [patch/rfc,rfa:ppc64] Add osabi wildcard support Message-ID: <20031023234150.GA16173@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <3F986371.9060708@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F986371.9060708@redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-10/txt/msg00712.txt.bz2 On Thu, Oct 23, 2003 at 07:25:37PM -0400, Andrew Cagney wrote: > Hello, > > The attached patch adds the ability to specify a wildcard machine when > registering an OSABI / arch / machine. It then updates PPC64 GNU/Linux > to specify that wild card (-1) instead of zero as the default machine. > > Looking at the PPC64 GNU/Linux code: > > gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_LINUX, > ppc_linux_init_abi); > > I believe that the call is attempting to register ppc_linux_init_abi as > the OSABI handler for all arch/machine conbinations. The problem is > that machine "0" gets turned into bfd_mach_ppc or bfd_mach_ppc64 > dependant on how GDB is built, and they are both incompatible with each > other and incompatible . And that in turn restricts the support to just > one half of the ISA family making it impossible for GDB to debug both 32 > and 64 bit :-( > > I know of two ways to fix this. First is the attached patch which > modifies osabi.[hc] so that a wildcard machine (-1) can be specified vis: > > gdbarch_register_osabi (bfd_arch_powerpc, -1, GDB_OSABI_LINUX, > ppc_linux_init_abi); > > and the second is to explicitly register both of these architecture > variants vis: > > gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, ... > gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, ... > > (possibly also splitting ppc_linux_init_abi into ppc_linux_init_abi_32 > and ppc_linux_init_abi_32). > > There are pros and cons to both. > > The former will always match, making the code somewhat future proof, the > later is far simplier. > > preferences? My preference is for registering both. This is really a special case; normally 0 is correct. It wouldn't have worked before but will with Jim's recent change to can_run_code_for. > Andrew > > PS: I'm also wondering if the existing ppc arch/machine table is > complete. I think it will indicate that e500 is "compatible" with "ppc" > when it is not. The table is almost certainly not complete, but that's not the problem here. The e500 is compatible with ppc - the e500 can run ppc code. Vice versa is not necessarily true. There's a FIXME in osabi.c saying that we should look for the most compatible architecture: > type that is compatible with the desired machine type. Right > now we simply return the first match, which is fine for now. > However, we might want to do something smarter in the future. */ > - compatible = arch_info->compatible (arch_info, handler->arch_info); > + compatible = info.bfd_arch_info->compatible (info.bfd_arch_info, > + handler->arch_info); > if (compatible == handler->arch_info) > { > (*handler->init_osabi) (info, gdbarch); -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer