From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [patch, testsuite] Tests to _Complex type
Date: Fri, 06 May 2011 14:13:00 -0000 [thread overview]
Message-ID: <4DC401D0.1050500@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]
When I am fixing GDB's inf-call in one port, I find tests to _Complex
type is quite limited, especially on argument passing, there is none.
This patch is to add more tests to _Complex type on argument passing and
vararg support.
Of course, these changes can be split, and moved to callfuncs.exp and
varargs.exp respectively. I don't know to what extent _Complex is
supported on all GDB ports, so I put all _Complex related stuff into
complex.exp.
I run this case on these three systems I have, and some problems are
exposed:
i686-pc-linux-gnu: two SIGSEGV
FAIL: gdb.base/complex.exp: print find_max_double_real(4, dc1, dc2, dc3,
dc4)
FAIL: gdb.base/complex.exp: print complex_double_on_stackprint
armv7l-unknown-linux-gnueabi: four SIGSEGV
FAIL: gdb.base/complex.exp: print find_max_float_real(4, fc1, fc2, f3, f4)
FAIL: gdb.base/complex.exp: print find_max_double_real(4, dc1, dc2, dc3,
dc4)
FAIL: gdb.base/complex.exp: print complex_float_on_stackprint
FAIL: gdb.base/complex.exp: print complex_double_on_stackprint
x86_64-unknown-linux-gnu:
FAIL: gdb.base/complex.exp: print find_max_float_real(4, fc1, fc2, f3, f4)
FAIL: gdb.base/complex.exp: print find_max_double_real(4, dc1, dc2, dc3,
dc4)
FAIL: gdb.base/complex.exp: print complex_float_on_stackprint
FAIL: gdb.base/complex.exp: print complex_double_on_stackprint
This case causes new fails, so shall I kfail it? Comments are welcome.
--
Yao (é½å°§)
[-- Attachment #2: 0003-complex-test-case.patch --]
[-- Type: text/x-patch, Size: 3885 bytes --]
gdb/testsuite/
2011-05-06 Yao Qi <yao@codesourcery.com>
* gdb.base/complex.c (find_max_float_real): New.
(find_max_double_real, complex_double_on_stack): New.
(complex_float_on_stack): New.
* gdb.base/complex.exp: Call these new functions in complex.c.
---
gdb/testsuite/gdb.base/complex.c | 78 ++++++++++++++++++++++++++++++++++++
gdb/testsuite/gdb.base/complex.exp | 19 +++++++++
2 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/gdb/testsuite/gdb.base/complex.c b/gdb/testsuite/gdb.base/complex.c
index 9b890c9..7623b6d 100644
--- a/gdb/testsuite/gdb.base/complex.c
+++ b/gdb/testsuite/gdb.base/complex.c
@@ -20,6 +20,7 @@ Free Software Foundation, Inc.
a complex number. */
#include <stdlib.h>
+#include <stdarg.h>
typedef __complex__ float cf;
struct x { char c; cf f; } __attribute__ ((__packed__));
@@ -28,11 +29,14 @@ extern void f4 (struct unpacked_x*);
extern void f3 (void);
extern void f2 (struct x*);
extern void f1 (void);
+extern void marker (void);
int
main (void)
{
f1 ();
f3 ();
+ marker ();
+
exit (0);
}
@@ -67,3 +71,77 @@ f4 (struct unpacked_x *y)
if (y->f != 1 || y->c != 42)
abort ();
}
+
+
+extern float crealf (float _Complex);
+
+float _Complex fc1 = 1.0F + 1.0iF;
+float _Complex fc2 = 2.0F + 2.0iF;
+float _Complex fc3 = 3.0F + 3.0iF;
+float _Complex fc4 = 4.0F + 4.0iF;
+
+float _Complex
+find_max_float_real (int num_vals, ...)
+{
+ float _Complex max = 0.0F + 0.0iF;
+ float _Complex x;
+ va_list argp;
+ int i;
+
+ va_start(argp, num_vals);
+ for (i = 0; i < num_vals; i++)
+ {
+ x = va_arg (argp, float _Complex);
+ if (crealf (max) < crealf (x)) max = x;
+ }
+
+ return max;
+}
+
+extern double creal (double _Complex);
+double _Complex dc1 = 1.0 + 1.0i;
+double _Complex dc2 = 2.0 + 2.0i;
+double _Complex dc3 = 3.0 + 3.0i;
+double _Complex dc4 = 4.0 + 4.0i;
+
+double _Complex
+find_max_double_real (int num_vals, ...)
+{
+ double _Complex max = 0.0F + 0.0iF;
+ double _Complex x;
+ va_list argp;
+ int i;
+
+ va_start(argp, num_vals);
+ for (i = 0; i < num_vals; i++)
+ {
+ x = va_arg (argp, double _Complex);
+ if (creal (max) < creal (x)) max = x;
+ }
+
+ return max;
+}
+
+/* Force DC is passed on stack. */
+_Complex double
+complex_double_on_stack (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, _Complex double dc)
+{
+ return dc;
+};
+
+/* Force FC is passed on stack. */
+_Complex float
+complex_float_on_stack (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, _Complex float fc)
+{
+ return fc;
+};
+
+void marker ()
+{
+}
diff --git a/gdb/testsuite/gdb.base/complex.exp b/gdb/testsuite/gdb.base/complex.exp
index 27af703..cb16fa5 100644
--- a/gdb/testsuite/gdb.base/complex.exp
+++ b/gdb/testsuite/gdb.base/complex.exp
@@ -55,4 +55,23 @@ if [runto f4] then {
"print complex value in C"
}
+if [runto marker] then {
+ gdb_test "print find_max_float_real(4, fc1, fc2, fc3, fc4)" \
+ ".*= 4 \\+ 4 \\* I" \
+ "print find_max_float_real(4, fc1, fc2, f3, f4)"
+
+ gdb_test "print find_max_double_real(4, dc1, dc2, dc3, dc4)" \
+ ".*= 4 \\+ 4 \\* I" \
+ "print find_max_double_real(4, dc1, dc2, dc3, dc4)"
+
+ gdb_test "print complex_float_on_stack (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, fc1)" \
+ ".*= 1 \\+ 1 \\* I" \
+ "print complex_float_on_stackprint"
+
+ gdb_test "print complex_double_on_stack (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, dc1)" \
+ ".*= 1 \\+ 1 \\* I" \
+ "print complex_double_on_stackprint"
+
+}
+
return 0
--
1.7.0.4
next reply other threads:[~2011-05-06 14:13 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 14:13 Yao Qi [this message]
2011-05-06 14:33 ` Joseph S. Myers
2011-05-09 2:24 ` Yao Qi
2011-05-09 15:06 ` Tom Tromey
2011-05-19 4:26 ` [_Complex test 1/4] support_complex_tests in gdb.exp and pass _Complex args to func Yao Qi
2011-05-19 8:16 ` Mark Kettenis
2011-05-19 10:16 ` Joseph S. Myers
2011-05-19 13:26 ` Yao Qi
2011-05-19 17:10 ` Tom Tromey
2011-05-20 8:10 ` Yao Qi
2011-05-26 17:07 ` Tom Tromey
2011-05-30 2:53 ` [committed] " Yao Qi
2011-05-19 13:01 ` Yao Qi
2011-05-19 13:24 ` Mark Kettenis
2011-05-19 13:38 ` Mark Kettenis
2011-05-19 10:12 ` Joseph S. Myers
2011-05-19 4:34 ` [_Complex test 2/4] _Complex type in varargs.exp Yao Qi
2011-05-19 10:13 ` Joseph S. Myers
2011-05-19 13:42 ` Yao Qi
2011-05-19 15:27 ` Joseph S. Myers
2011-05-20 9:09 ` Pedro Alves
2011-05-20 15:22 ` Yao Qi
2011-05-20 15:37 ` Pedro Alves
2011-05-23 4:09 ` Yao Qi
2011-05-23 10:27 ` Pedro Alves
2011-05-30 2:55 ` [committed] " Yao Qi
2011-05-19 17:12 ` Tom Tromey
2011-05-20 8:11 ` Yao Qi
2011-05-19 4:46 ` [_Complex test 3/4] Isolate each test's effect in callfuncs.exp Yao Qi
2011-05-19 18:46 ` Tom Tromey
2011-05-30 2:56 ` [committed] " Yao Qi
2011-05-19 5:09 ` [_Complex test 4/4] _Complex tests " Yao Qi
2011-05-20 8:17 ` Yao Qi
2011-05-24 1:46 ` [_Complex test 4/4 V3] " Yao Qi
2011-05-24 9:00 ` Mark Kettenis
2011-05-24 9:34 ` Yao Qi
2011-05-24 10:00 ` Mark Kettenis
2011-05-24 13:54 ` Yao Qi
2011-05-26 17:07 ` [_Complex test 4/4] " Tom Tromey
2011-05-30 2:57 ` [committed] " Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DC401D0.1050500@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox