From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25508 invoked by alias); 7 Oct 2013 14:31:20 -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 25496 invoked by uid 89); 7 Oct 2013 14:31:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS,T_FRT_LITTLE,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 07 Oct 2013 14:31:12 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r97EVAte027607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Oct 2013 14:31:11 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r97EV9mN024304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 7 Oct 2013 14:31:10 GMT Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r97EV8oc026982 for ; Mon, 7 Oct 2013 14:31:09 GMT Received: from termi.oracle.com (/10.175.34.9) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Oct 2013 07:31:08 -0700 From: jose.marchesi@oracle.com (Jose E. Marchesi) To: gdb-patches@sourceware.org Subject: [PATCH] testsuite: endianness in gnu_vector.exp Date: Mon, 07 Oct 2013 14:31:00 -0000 Message-ID: <87bo31m9r7.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00188.txt.bz2 Hi. Small patch making gnu_vector.exp to work properly in big-endian machines. Tested in sparc64-*-linux-gnu. 2013-10-07 Jose E. Marchesi * gdb.base/gnu_vector.exp: Care about endianness when casting scalars to vectors. Index: testsuite/gdb.base/gnu_vector.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/gnu_vector.exp,v retrieving revision 1.13 diff -u -r1.13 gnu_vector.exp --- testsuite/gdb.base/gnu_vector.exp 27 Jun 2013 18:50:30 -0000 1.13 +++ testsuite/gdb.base/gnu_vector.exp 7 Oct 2013 14:25:35 -0000 @@ -40,6 +40,14 @@ return -1 } +# Get endianess for the scalar->vector casts +gdb_test_multiple "show endian" "show endian" { + -re ".* (big|little) endian.*$gdb_prompt $" { + set endian $expect_out(1,string) + pass "endianness: $endian" + } +} + # Test printing of character vector types gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}" gdb_test "print c4\[2\]" "\\\$$decimal = 3" @@ -83,9 +91,14 @@ # When casting to vector the input type must have the same length as # the total length of the vector. gdb_test "print (char4) 0x01010101" "\\\$$decimal = \\{1, 1, 1, 1\\}" -gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}" gdb_test "print (int2) lla" "\\\$$decimal = \\{1, 1\\}" +if { ![string compare $endian big] } then { + gdb_test "print (char4) ia" "\\\$$decimal = \\{0, 0, 0, 2\\}" +} else { + gdb_test "print (char4) ia" "\\\$$decimal = \\{2, 0, 0, 0\\}" +} + gdb_test "print (int2) 1" "can only cast scalar to vector of same size" gdb_test "print (longlong2) 2" "can only cast scalar to vector of same size" gdb_test "print (float2) 3" "can only cast scalar to vector of same size"