This is the mail archive of the gdb-patches@sourceware.org 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]

Re: [RFC] Linux-specific ppc32 ABI


On Sat, 2008-02-02 at 01:08 +0100, Mark Kettenis wrote:
> Thiago/Luis, can you commit the testsuite change?

Sure. I committed the attached patch.
-- 
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1567
diff -u -r1.1567 ChangeLog
--- ChangeLog	5 Feb 2008 22:20:51 -0000	1.1567
+++ ChangeLog	6 Feb 2008 03:52:41 -0000
@@ -1,3 +1,10 @@
+2008-02-06  Thiago Jung Bauermann  <bauerman@br.ibm.com>
+
+	* gdb.base/callfuncs.c (t_float_many_args): New function.
+	(t_double_many_args): New function.
+	* gdb.base/callfuncs.exp: Add tests for exceeding float
+	and double parameters passed through the stack.
+
 2008-02-05  Joel Brobecker  <brobecker@adacore.com>
 
 	* gdb.ada/complete/pck.ads, gdb.ada/complete/pck.adb,
Index: gdb.base/callfuncs.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.c,v
retrieving revision 1.10
diff -u -r1.10 callfuncs.c
--- gdb.base/callfuncs.c	1 Jan 2008 22:53:18 -0000	1.10
+++ gdb.base/callfuncs.c	6 Feb 2008 03:52:41 -0000
@@ -46,9 +46,35 @@
 
 float float_val1 = 3.14159;
 float float_val2 = -2.3765;
+float float_val3 = 0.25;
+float float_val4 = 1.25;
+float float_val5 = 2.25;
+float float_val6 = 3.25;
+float float_val7 = 4.25;
+float float_val8 = 5.25;
+float float_val9 = 6.25;
+float float_val10 = 7.25;
+float float_val11 = 8.25;
+float float_val12 = 9.25;
+float float_val13 = 10.25;
+float float_val14 = 11.25;
+float float_val15 = 12.25;
 
 double double_val1 = 45.654;
 double double_val2 = -67.66;
+double double_val3 = 0.25;
+double double_val4 = 1.25;
+double double_val5 = 2.25;
+double double_val6 = 3.25;
+double double_val7 = 4.25;
+double double_val8 = 5.25;
+double double_val9 = 6.25;
+double double_val10 = 7.25;
+double double_val11 = 8.25;
+double double_val12 = 9.25;
+double double_val13 = 10.25;
+double double_val14 = 11.25;
+double double_val15 = 12.25;
 
 #define DELTA (0.001)
 
@@ -298,6 +324,39 @@
 	  && (float_arg2 - float_val2) > -DELTA);
 }
 
+/* This function has many arguments to force some of them to be passed via
+   the stack instead of registers, to test that GDB can construct correctly
+   the parameter save area. Note that Linux/ppc32 has 8 float registers to use
+   for float parameter passing and Linux/ppc64 has 13, so the number of
+   arguments has to be at least 14 to contemplate these platforms.  */
+
+float
+#ifdef NO_PROTOTYPES
+t_float_many_args (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13,
+		   f14, f15)
+     float f1, float f2, float f3, float f4, float f5, float f6, float f7,
+     float f8, float f9, float f10, float f11, float f12, float f13, float f14,
+     float f15;
+#else
+t_float_many_args (float f1, float f2, float f3, float f4, float f5, float f6,
+		   float f7, float f8, float f9, float f10, float f11,
+		   float f12, float f13, float f14, float f15)
+#endif
+{
+  float sum_args;
+  float sum_values;
+
+  sum_args = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12
+	     + f13 + f14 + f15;
+  sum_values = float_val1 + float_val2 + float_val3 + float_val4 + float_val5
+	       + float_val6 + float_val7 + float_val8 + float_val9
+	       + float_val10 + float_val11 + float_val12 + float_val13
+	       + float_val14 + float_val15;
+
+  return ((sum_args - sum_values) < DELTA
+	  && (sum_args - sum_values) > -DELTA);
+}
+
 #ifdef PROTOTYPES
 int t_double_values (double double_arg1, double double_arg2)
 #else
@@ -311,6 +370,39 @@
 	  && (double_arg2 - double_val2) > -DELTA);
 }
 
+/* This function has many arguments to force some of them to be passed via
+   the stack instead of registers, to test that GDB can construct correctly
+   the parameter save area. Note that Linux/ppc32 has 8 float registers to use
+   for float parameter passing and Linux/ppc64 has 13, so the number of
+   arguments has to be at least 14 to contemplate these platforms.  */
+
+double
+#ifdef NO_PROTOTYPES
+t_double_many_args (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13,
+		   f14, f15)
+     double f1, double f2, double f3, double f4, double f5, double f6,
+     double f7, double f8, double f9, double f10, double f11, double f12,
+     double f13, double f14, double f15;
+#else
+t_double_many_args (double f1, double f2, double f3, double f4, double f5,
+		    double f6, double f7, double f8, double f9, double f10,
+		    double f11, double f12, double f13, double f14, double f15)
+#endif
+{
+  double sum_args;
+  double sum_values;
+
+  sum_args = f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + f10 + f11 + f12
+	     + f13 + f14 + f15;
+  sum_values = double_val1 + double_val2 + double_val3 + double_val4
+	       + double_val5 + double_val6 + double_val7 + double_val8
+	       + double_val9 + double_val10 + double_val11 + double_val12
+	       + double_val13 + double_val14 + double_val15;
+
+  return ((sum_args - sum_values) < DELTA
+	  && (sum_args - sum_values) > -DELTA);
+}
+
 #ifdef PROTOTYPES
 int t_string_values (char *string_arg1, char *string_arg2)
 #else
Index: gdb.base/callfuncs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfuncs.exp,v
retrieving revision 1.23
diff -u -r1.23 callfuncs.exp
--- gdb.base/callfuncs.exp	1 Jan 2008 22:53:18 -0000	1.23
+++ gdb.base/callfuncs.exp	6 Feb 2008 03:52:41 -0000
@@ -155,6 +155,8 @@
         
 	gdb_test "p t_float_values2(3.14159,float_val2)" " = 1"
 
+	gdb_test "p t_float_many_args (float_val1, float_val2, float_val3, float_val4, float_val5, float_val6, float_val7, float_val8, float_val9, float_val10, float_val11, float_val12, float_val13, float_val14, float_val15)" " = 1" "Call function with many float arguments."
+
 	gdb_test "p t_small_values(1,2,3,4,5,6,7,8,9,10)" " = 55"
 
 	gdb_test "p t_double_values(0.0,0.0)" " = 0"
@@ -163,6 +165,8 @@
 	gdb_test "p t_double_values(45.654,double_val2)" " = 1"
 	gdb_test "p t_double_values(double_val1,-67.66)" " = 1"
 
+	gdb_test "p t_double_many_args (double_val1, double_val2, double_val3, double_val4, double_val5, double_val6, double_val7, double_val8, double_val9, double_val10, double_val11, double_val12, double_val13, double_val14, double_val15)" " = 1" "Call function with many double arguments."
+
 	gdb_test "p t_double_int(99.0, 1)" " = 0"
 	gdb_test "p t_double_int(99.0, 99)" " = 1"
 	gdb_test "p t_int_double(99, 1.0)" " = 0"

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