From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14936 invoked by alias); 19 Jun 2003 19:09:23 -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 14896 invoked from network); 19 Jun 2003 19:09:21 -0000 Received: from unknown (HELO crack.them.org) (146.82.138.56) by sources.redhat.com with SMTP; 19 Jun 2003 19:09:21 -0000 Received: from dsl093-172-017.pit1.dsl.speakeasy.net ([66.93.172.17] helo=nevyn.them.org ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 19T4nM-0001wJ-00; Thu, 19 Jun 2003 14:10:04 -0500 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 19T4mD-0000ao-00; Thu, 19 Jun 2003 15:08:53 -0400 Date: Thu, 19 Jun 2003 19:09:00 -0000 From: Daniel Jacobowitz To: Kris Warkentin Cc: kettenis@gnu.org, "Gdb-Patches@Sources.Redhat.Com" Subject: Re: [Patch] arch recognition fix for osabi.c Message-ID: <20030619190853.GA25755@nevyn.them.org> Mail-Followup-To: Kris Warkentin , kettenis@gnu.org, "Gdb-Patches@Sources.Redhat.Com" References: <08c201c334e6$ccb8c750$0202040a@catdog> <20030617155147.GA25280@nevyn.them.org> <08d801c334ea$23fd99c0$0202040a@catdog> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <08d801c334ea$23fd99c0$0202040a@catdog> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-06/txt/msg00632.txt.bz2 On Tue, Jun 17, 2003 at 12:04:32PM -0400, Kris Warkentin wrote: > > This half I'm not convinced by. From our previous exchange I don't > > think you've fully justified it. Not approved without more discussion. > > Okay. Let's use mips as an example. The 'compatible' check returns true if > they have the same arch (ie. bfd_arch_mips). There will be many different > values for the arch_info pointer, all with bfd_arch_mips and various other > pieces of info such as which machine type (10k, 4300, etc.) of mips it is. > The handler was registered for bfd_arch_mips with no other information. In > the absence of the ABILITY to do anything smarter, we have to assume that if > the handler is for bfd_arch_mips, it should be run. > > As it stands, if the bfd reads a file and says 'this is a tx3900' or some > such, the pointers won't be the same and my backend init_abi won't be run > even though I want it to run for all mips targets. All calls to gdbarch_register_osabi in GDB except for two use mach == 0. The two are mips-linux-tdep.c, which appears to be solving the same problem - what a coincidence: for (arch_info = bfd_lookup_arch (bfd_arch_mips, 0); arch_info != NULL; arch_info = arch_info->next) { gdbarch_register_osabi (bfd_arch_mips, arch_info->mach, GDB_OSABI_LINUX, mips_linux_init_abi); } and x86-64. For x86-64 your change is correct since BFD will catch the different bits-per-word and return NULL. For mips-linux-tdep it would let you remove that loop, which I have a vague memory of being annoyed at when it became necessary. The check came from 2002-12-14 Mark Kettenis * osabi.c: Include "gdb_assert.h" and "gdb_string.h". (struct gdb_osabi_handler): Remove member `arch'. Add member `arch_info'. (gdbarch_register_osabi): Add new argument `machine'. Use ot to construct a `struct bfd_arch_info' and store it in the `struct gdb_osabi_handler' that is created. (gdbarch_init_osabi): Check for compatibility based on machine type and architecture. * osabi.h (gdbarch_register_osabi): Adjust prototype and update comment. So I'm not going to approve it until Mark comments. Mark, Kris is suggesting that the "arch_info ==" in the ->compatible check should simply be a "NULL !=". > > > (generic_elf_osabi_sniff_abi_tag_sections): Add check for QNX > Neutrino > > > binaries. > > > > This bit looks fine, except for two things: you've missed the coding > > standards by four space characters (before left parens), and your > > "safety first" check overruns the buffer (missing +1 in the alloca). > > Doh! Not very safe was it? Sorry about that. Fixed. > > cheers, > > Kris > > > -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer