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]

[commit] Hack around broken PPC64 FPSCR macro


FYI,

Some of the older PPC-64 systems have a broken FPSCR macro. If that macro is used inferior function calls are totally busted.

The attached detects the broken macro and hacks around it.

committed,
Andrew
2005-02-08  Andrew Cagney  <cagney@gnu.org>

	* ppc-linux-nat.c (ppc_register_u_addr): Hack around 64-bit
	PT_FPSCR breakage.

Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.52
diff -p -u -r1.52 ppc-linux-nat.c
--- ppc-linux-nat.c	4 Aug 2004 17:45:30 -0000	1.52
+++ ppc-linux-nat.c	8 Feb 2005 20:59:00 -0000
@@ -212,8 +212,19 @@ ppc_register_u_addr (int regno)
     u_addr = PT_MSR * wordsize;
   if (tdep->ppc_fpscr_regnum >= 0
       && regno == tdep->ppc_fpscr_regnum)
-    u_addr = PT_FPSCR * wordsize;
-
+    {
+      /* NOTE: cagney/2005-02-08: On some 64-bit GNU/Linux systems the
+	 kernel headers incorrectly contained the 32-bit definition of
+	 PT_FPSCR.  For the 32-bit definition, floating-point
+	 registers occupy two 32-bit "slots", and the FPSCR lives in
+	 the secondhalf of such a slot-pair (hence +1).  For 64-bit,
+	 the FPSCR instead occupies the full 64-bit 2-word-slot and
+	 hence no adjustment is necessary.  Hack around this.  */
+      if (wordsize == 8 && PT_FPSCR == (48 + 32 + 1))
+	u_addr = (48 + 32) * wordsize;
+      else
+	u_addr = PT_FPSCR * wordsize;
+    }
   return u_addr;
 }
 

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