This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] rs6000-tdep.c: figure out e500 machine from bfd.


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]