From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] Generalize gdb.reverse/aarch64.exp
Date: Wed, 24 Feb 2016 14:40:00 -0000 [thread overview]
Message-ID: <1456324818-25547-1-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <56CD9259.9040007@redhat.com>
I said we can generialize gdb.reverse/aarch64.exp for other
architectures https://sourceware.org/ml/gdb-patches/2015-05/msg00482.html
and here is the patch to change aarch64.exp so that it can be used to
test for other architectures as well.
gdb/testsuite:
2016-02-24 Yao Qi <yao.qi@linaro.org>
* gdb.reverse/aarch64.c: [__aarch64__] Include arm_neon.h.
(testcase_ftype): New.
(testcases): New array.
(n_testcases): New.
(main): Call each element in testcases.
* gdb.reverse/aarch64.exp: Remove is_aarch64_target check.
(read_testcase): New.
Do the tests in a loop.
---
gdb/testsuite/gdb.reverse/aarch64.c | 34 ++++++++++++++++++++++++-----
gdb/testsuite/gdb.reverse/aarch64.exp | 41 ++++++++++++++++++++++++-----------
2 files changed, 56 insertions(+), 19 deletions(-)
diff --git a/gdb/testsuite/gdb.reverse/aarch64.c b/gdb/testsuite/gdb.reverse/aarch64.c
index ae8509a..1bfb8b0 100644
--- a/gdb/testsuite/gdb.reverse/aarch64.c
+++ b/gdb/testsuite/gdb.reverse/aarch64.c
@@ -15,8 +15,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#if (defined __aarch64__)
#include <arm_neon.h>
+#endif
+#if (defined __aarch64__)
static void
load (void)
{
@@ -85,15 +88,34 @@ adv_simd_vect_shift (void)
{
asm ("fcvtzs s0, s0, #1");
}
+#endif
+
+typedef void (*testcase_ftype) (void);
+
+/* Functions testing instruction decodings. GDB will read n_testcases
+ to know how many functions to test. */
+
+static testcase_ftype testcases[] =
+{
+#if (defined __aarch64__)
+ load,
+ move,
+ adv_simd_mod_imm,
+ adv_simd_scalar_index,
+ adv_simd_smlal,
+ adv_simd_vect_shift,
+#endif
+};
+
+static int n_testcases = (sizeof (testcases) / sizeof (testcase_ftype));
int
main ()
{
- load ();
- move ();
- adv_simd_mod_imm ();
- adv_simd_scalar_index ();
- adv_simd_smlal ();
- adv_simd_vect_shift ();
+ int i = 0;
+
+ for (i = 0; i < n_testcases; i++)
+ testcases[i] ();
+
return 0;
}
diff --git a/gdb/testsuite/gdb.reverse/aarch64.exp b/gdb/testsuite/gdb.reverse/aarch64.exp
index 2906d4b..f52b40c 100644
--- a/gdb/testsuite/gdb.reverse/aarch64.exp
+++ b/gdb/testsuite/gdb.reverse/aarch64.exp
@@ -17,13 +17,6 @@ if ![supports_reverse] {
return
}
-# Test aarch64 instruction recording.
-
-if {![is_aarch64_target]} then {
- verbose "Skipping aarch64 instruction recording tests."
- return
-}
-
standard_testfile
if {[prepare_for_testing $testfile.exp $testfile $srcfile \
@@ -36,6 +29,22 @@ if { ![runto main] } then {
return
}
+# Read function name from testcases[N].
+
+proc read_testcase { n } {
+ global gdb_prompt
+
+ set result -1
+ gdb_test_multiple "print testcases\[${n}\]" "read name of test case ${n}" {
+ -re "\[$\].*= .*<(.*)>.*$gdb_prompt $" {
+ set result $expect_out(1,string)
+ }
+ -re "$gdb_prompt $" { }
+ }
+
+ return $result
+}
+
# In each function FUNC, GDB turns on process record, and single step
# until program goes to the end of the function. Then, single step
# backward. In each of forward single step and backward single step,
@@ -107,9 +116,15 @@ proc test { func } {
}
}
-test "load"
-test "move"
-test "adv_simd_mod_imm"
-test "adv_simd_scalar_index"
-test "adv_simd_smlal"
-test "adv_simd_vect_shift"
+set n_testcases [get_integer_valueof "n_testcases" 0]
+
+if { ${n_testcases} == 0 } {
+ untested "No test"
+ return 1
+}
+
+for { set i 0 } { ${i} < ${n_testcases} } { incr i } {
+ set testcase [read_testcase $i]
+
+ test $testcase
+}
--
1.9.1
next prev parent reply other threads:[~2016-02-24 14:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 16:53 [PATCH 0/3] Bug fixes in arm reverse debugging Yao Qi
2016-02-22 16:53 ` [PATCH 1/3] Generalize gdb.reverse/aarch64.exp Yao Qi
2016-02-24 11:22 ` Pedro Alves
2016-02-24 14:40 ` Yao Qi [this message]
2016-02-24 14:40 ` [PATCH 1.5/3] Rename gdb.reverse/aarch64.{exp,c} to gdb.reverse/insn-reverse.{exp,c} Yao Qi
2016-02-24 19:37 ` [PATCH 1/3] Generalize gdb.reverse/aarch64.exp Pedro Alves
2016-02-22 16:53 ` [PATCH 3/3] Fix various bugs in arm_record_exreg_ld_st_insn Yao Qi
2016-02-23 19:59 ` Luis Machado
2016-02-26 14:54 ` Yao Qi
2016-02-22 16:53 ` [PATCH 2/3] Record right reg num of thumb special data instructions Yao Qi
2016-02-26 15:01 ` [PATCH 0/3] Bug fixes in arm reverse debugging 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=1456324818-25547-1-git-send-email-yao.qi@linaro.org \
--to=qiyaoltc@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).