From patchwork Wed Oct 8 12:18:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Udma X-Patchwork-Id: 3137 Received: (qmail 5240 invoked by alias); 8 Oct 2014 12:23:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5229 invoked by uid 89); 8 Oct 2014 12:23:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: na01-bn1-obe.outbound.protection.outlook.com Received: from mail-bn1bon0114.outbound.protection.outlook.com (HELO na01-bn1-obe.outbound.protection.outlook.com) (157.56.111.114) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 08 Oct 2014 12:23:25 +0000 Received: from CO2PR03CA0041.namprd03.prod.outlook.com (10.141.194.168) by BY2PR03MB176.namprd03.prod.outlook.com (10.242.36.153) with Microsoft SMTP Server (TLS) id 15.0.1044.10; Wed, 8 Oct 2014 12:23:20 +0000 Received: from BN1AFFO11FD021.protection.gbl (2a01:111:f400:7c10::108) by CO2PR03CA0041.outlook.office365.com (2a01:111:e400:1414::40) with Microsoft SMTP Server (TLS) id 15.0.1044.10 via Frontend Transport; Wed, 8 Oct 2014 12:23:20 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD021.mail.protection.outlook.com (10.58.52.81) with Microsoft SMTP Server (TLS) id 15.0.1039.16 via Frontend Transport; Wed, 8 Oct 2014 12:23:20 +0000 Received: from udp122517uds.ea.freescale.net (udp122517uds.ea.freescale.net [10.171.74.8]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s98CNHbb017966; Wed, 8 Oct 2014 05:23:18 -0700 From: Catalin Udma To: CC: Catalin Udma Subject: [PATCH] testsuite: add testsuite for aarch64 floating point Date: Wed, 8 Oct 2014 15:18:37 +0300 Message-ID: <1412770717-18290-1-git-send-email-catalin.udma@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(377424004)(104016003)(77156001)(110136001)(36756003)(229853001)(97736003)(120916001)(89996001)(76482002)(92566001)(6806004)(50986999)(86362001)(102836001)(92726001)(4396001)(44976005)(50226001)(33646002)(93916002)(15202345003)(20776003)(80022003)(64706001)(26826002)(46102003)(69596002)(68736004)(21056001)(84676001)(19580395003)(15975445006)(19580405001)(85306004)(62966002)(99396003)(48376002)(81156004)(47776003)(95666004)(104166001)(88136002)(87936001)(87286001)(105606002)(31966008)(106466001)(2351001)(107046002)(50466002)(85852003)(2004002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR03MB176; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB176; X-Forefront-PRVS: 0358535363 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=catalin.udma@freescale.com; X-OriginatorOrg: freescale.com Bug 17457: validate correct floating point registers index and fpsr/fpcr registers gdb/testsuite/ 2014-10-08 Catalin Udma * gdb.arch/aarch64-fp.c: New file. * gdb.arch/aarch64-fp.exp: New file. Signed-off-by: Catalin Udma --- gdb/testsuite/gdb.arch/aarch64-fp.c | 39 ++++++++++++++ gdb/testsuite/gdb.arch/aarch64-fp.exp | 89 +++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.arch/aarch64-fp.c create mode 100644 gdb/testsuite/gdb.arch/aarch64-fp.exp diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.c b/gdb/testsuite/gdb.arch/aarch64-fp.c new file mode 100644 index 0000000..d217784 --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-fp.c @@ -0,0 +1,39 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2008-2014 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +int main (void) +{ + char buf0[] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f}; + char buf1[] = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f}; + long val; + void *addr; + + addr = &buf0[0]; + __asm __volatile ("ldr %x0, [%1]" : "=r" (val) : "r" (&addr)); + __asm __volatile ("ldr q0, [x0]"); + + addr = &buf1[0]; + __asm __volatile ("ldr %x0, [%1]" : "=r" (val) : "r" (&addr)); + __asm __volatile ("ldr q1, [x0]"); + + return 1; +} + diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.exp b/gdb/testsuite/gdb.arch/aarch64-fp.exp new file mode 100644 index 0000000..7bd2804 --- /dev/null +++ b/gdb/testsuite/gdb.arch/aarch64-fp.exp @@ -0,0 +1,89 @@ +# Copyright 2008-2014 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# This file is part of the gdb testsuite. + +# Bug 17457 +# Test aarch64 floating point registers q0, q1, v0, v1, fpsr, fpcr + +if {![istarget "aarch64*"]} { + verbose "Skipping ${gdb_test_file_name}." + return +} + +standard_testfile +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { + return -1 +} + +if ![runto_main] { + untested "could not run to main" + return -1 +} + +send_gdb "show endian\n" +gdb_expect { + -re "(.* )(big|little)( endian.*)$gdb_prompt $" { + pass "endianness" + set endianness $expect_out(2,string) + } + -re ".*$gdb_prompt $" { + fail "couldn't get endianness" + } + timeout { fail "(timeout) endianness" } +} + + +gdb_test "break ${srcfile}:37" \ + "Breakpoint $decimal at 0x\[0-9a-fA-F\]+: file .*${srcfile}, line 37\\\." \ + "Set the breakpoint after setting the fp registers" + +gdb_test "continue" \ + "Continuing.*Breakpoint $decimal.*" \ + "Continue until breakpoint" + +if {$endianness == "little"} { + set reg_value0 "0x1f1e1d1c1b1a19181716151413121110" + set reg_value1 "0x2f2e2d2c2b2a29282726252423222120" +} else { + set reg_value0 "0x101112131415161718191a1b1c1d1e1f" + set reg_value1 "0x202122232425262728292a2b2c2d2e2f" +} + +gdb_test "info registers q0" \ + "q0.*{u = $reg_value0, s = $reg_value0.*" \ + "Check register q0 value" + +gdb_test "info registers q1" \ + "q1.*{u = $reg_value1, s = $reg_value1.*" \ + "Check register q1 value" + +gdb_test "info registers v0" \ + "v0.*$reg_value0}}}" \ + "Check register v0 value" + +gdb_test "info registers v1" \ + "v1.*$reg_value1}}}" \ + "Check register v1 value" + +gdb_test "info registers fpsr" \ + "fpsr.*0x\[0-9a-fA-F\].*" \ + "Check register fpsr value" + +gdb_test "info registers fpcr" \ + "fpcr.*0x\[0-9a-fA-F\].*" \ + "Check register fpcr value" +