Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] rs6000-tdep.c: figure out e500 machine from bfd.
@ 2002-08-20 15:38 Elena Zannoni
  2002-08-20 16:31 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2002-08-20 15:38 UTC (permalink / raw)
  To: gdb-patches


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  <ezannoni@redhat.com>

	* 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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-21 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20 15:38 [RFA] rs6000-tdep.c: figure out e500 machine from bfd Elena Zannoni
2002-08-20 16:31 ` Kevin Buettner
2002-08-21 15:58   ` Elena Zannoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox