From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9274 invoked by alias); 20 Aug 2002 22:38:27 -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 9253 invoked from network); 20 Aug 2002 22:38:26 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 20 Aug 2002 22:38:26 -0000 Received: by localhost.redhat.com (Postfix, from userid 469) id 44F1210DCC; Tue, 20 Aug 2002 18:36:32 -0400 (EDT) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15714.50288.526139.379896@localhost.redhat.com> Date: Tue, 20 Aug 2002 15:38:00 -0000 To: gdb-patches@sources.redhat.com Subject: [RFA] rs6000-tdep.c: figure out e500 machine from bfd. X-SW-Source: 2002-08/txt/msg00629.txt.bz2 A powerpc executable doesn't have indications of which variant it is meant to run on. The design choice was that in theory everything should run on any version of the processor. For gdb's purposes we have now a new section that is specific to e500, which can help us identify the executable and set all the architecture dependents bits in the correct way. Elena [sorry Kevin, it's almost over...:-)] 2002-08-20 Elena Zannoni * rs6000-tdep.c (rs6000_gdbarch_init): Figure out whether we have an e500 executable. Index: rs6000-tdep.c =================================================================== RCS file: /cvs/uberbaum/gdb/rs6000-tdep.c,v retrieving revision 1.75 diff -u -p -r1.75 rs6000-tdep.c --- rs6000-tdep.c 20 Aug 2002 22:24:29 -0000 1.75 +++ rs6000-tdep.c 20 Aug 2002 22:36:03 -0000 @@ -2426,6 +2426,7 @@ rs6000_gdbarch_init (struct gdbarch_info bfd abfd; int sysv_abi; enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; + asection *sect; from_xcoff_exec = info.abfd && info.abfd->format == bfd_object && bfd_get_flavour (info.abfd) == bfd_target_xcoff_flavour; @@ -2499,6 +2500,20 @@ rs6000_gdbarch_init (struct gdbarch_info tdep = xmalloc (sizeof (struct gdbarch_tdep)); tdep->wordsize = wordsize; tdep->osabi = osabi; + + /* For e500 executables, the apuinfo section is of help here. */ + if (info.abfd) + { + sect = bfd_get_section_by_name (info.abfd, ".PPC.EMB.apuinfo"); + if (sect) + { + arch = info.bfd_arch_info->arch; + mach = bfd_mach_ppc_e500; + bfd_default_set_arch_mach (&abfd, arch, mach); + info.bfd_arch_info = bfd_get_arch_info (&abfd); + } + } + gdbarch = gdbarch_alloc (&info, tdep); power = arch == bfd_arch_rs6000;