From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35734 invoked by alias); 24 Feb 2016 14:40:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 35672 invoked by uid 89); 24 Feb 2016 14:40:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=1511, 1079 X-HELO: mail-pf0-f172.google.com Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 24 Feb 2016 14:40:28 +0000 Received: by mail-pf0-f172.google.com with SMTP id c10so14473931pfc.2 for ; Wed, 24 Feb 2016 06:40:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=vnlSkoZGa5sOjeOlP+poVHfqSbjLmEex/Op7HQ1RJho=; b=FzhgPFIpac4qSat7kNQsN3QnK5C4X7ABLWKBrby1OaklsI9tZNH6VE4aS+ym+QEHHk VHhjKsJ5Ly8uvn3FLG07JgOIlWHPXCyr/pbZWDcSjGJASrtuUnM+O0E7feYk/3CsZEiI /zfWR2Fk2etQbJjqwZe6wSqMBgDEp6Pvm23CnTY0nH3W0LHQ0KiWHc9021ggJQNWjx35 rjaueodElYjft8dNNSj0mPleS4uLDQoMGNhFH7ja6tVpgbkHEpHDppk0T62/Zg1ts9jM 25RgzReg+VKPVXGf1KSJO3ZRQSLBSJnnx7bVUWGTsgUSAMD8KBILm5NSrrYWUCG7Dt0u PxKw== X-Gm-Message-State: AG10YOQd7mzhOvWb4q0hlJ98roBT1zhPdba9x1GdHDgn0nV4Gw/krJg2R6gvsvhjbXAA6Q== X-Received: by 10.98.10.65 with SMTP id s62mr55651293pfi.119.1456324826485; Wed, 24 Feb 2016 06:40:26 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id b63sm5646881pfj.25.2016.02.24.06.40.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 06:40:25 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 1/3] Generalize gdb.reverse/aarch64.exp Date: Wed, 24 Feb 2016 14:40:00 -0000 Message-Id: <1456324818-25547-1-git-send-email-yao.qi@linaro.org> In-Reply-To: <56CD9259.9040007@redhat.com> References: <56CD9259.9040007@redhat.com> X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00728.txt.bz2 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 * 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 . */ +#if (defined __aarch64__) #include +#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