aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.c92
-rw-r--r--gdb/testsuite/gdb.base/callfuncs.exp4
3 files changed, 103 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a12b7ec..86c0068 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -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,
diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c
index 160c5da..5a150b0 100644
--- a/gdb/testsuite/gdb.base/callfuncs.c
+++ b/gdb/testsuite/gdb.base/callfuncs.c
@@ -46,9 +46,35 @@ long long_val2 = -321;
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 @@ t_float_values2 (float float_arg1, float float_arg2)
&& (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 double_arg1, double_arg2;
&& (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
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 6faf00f..1a4da6e 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -155,6 +155,8 @@ proc do_function_calls {} {
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 @@ proc do_function_calls {} {
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"