Message ID | m3wpdrus83.fsf@oc1027705133.ibm.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 29901 invoked by alias); 19 Jan 2017 12:52:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 29589 invoked by uid 89); 19 Jan 2017 12:52:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*o:Research, Bigendian, Big-endian, HX-Proofpoint-Spam-Details:main-1701190173 X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Jan 2017 12:52:52 +0000 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v0JCnv4w030569 for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 07:52:51 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 282b5jtexb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 07:52:50 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <gdb-patches@sourceware.org> from <arnez@linux.vnet.ibm.com>; Thu, 19 Jan 2017 12:52:49 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 19 Jan 2017 12:52:47 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9EB042190019 for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 12:51:53 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v0JCql0s1179920 for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 12:52:47 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E029B42049 for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 11:50:39 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CEAEB42042 for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 11:50:39 +0000 (GMT) Received: from oc1027705133.ibm.com (unknown [9.152.212.222]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS for <gdb-patches@sourceware.org>; Thu, 19 Jan 2017 11:50:39 +0000 (GMT) From: Andreas Arnez <arnez@linux.vnet.ibm.com> To: gdb-patches@sourceware.org Subject: [PATCH] Big-endian targets: Fix implptrpiece.exp Date: Thu, 19 Jan 2017 13:52:44 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17011912-0040-0000-0000-00000318CCB1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17011912-0041-0000-0000-000023DCCF78 Message-Id: <m3wpdrus83.fsf@oc1027705133.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-01-19_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701190173 X-IsSubscribed: yes |
Commit Message
Andreas Arnez
Jan. 19, 2017, 12:52 p.m. UTC
The test case implptrpiece.exp accesses the second byte of the short integer number 1 and expects it to be zero. This is valid for little-endian targets, but fails on big-endian targets. This is fixed by determining the expected value in an endianness-independent way. gdb/testsuite/ChangeLog: * gdb.dwarf2/implptrpiece.exp: Fix check for big-endian targets. --- gdb/testsuite/gdb.dwarf2/implptrpiece.exp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Comments
Hi Andreas, Sorry for the delayed review. I read this patch at least twice in the last month, but didn't review because I can't understand it fully, and was interrupted to do something else. On Thu, Jan 19, 2017 at 12:52 PM, Andreas Arnez <arnez@linux.vnet.ibm.com> wrote: > The test case implptrpiece.exp accesses the second byte of the short > integer number 1 and expects it to be zero. This is valid for > little-endian targets, but fails on big-endian targets. > > This is fixed by determining the expected value in an > endianness-independent way. This is quite clever, but I don't like it, :) because every time I read it, it takes me a while what is the test trying to do. > > gdb/testsuite/ChangeLog: > > * gdb.dwarf2/implptrpiece.exp: Fix check for big-endian targets. > --- > gdb/testsuite/gdb.dwarf2/implptrpiece.exp | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp > index af7dd37..3f6e0d6 100644 > --- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp > +++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp > @@ -119,4 +119,7 @@ if ![runto_main] { > return -1 > } > > -gdb_test "print/d p\[-1\]" " = 0" > +# Access the second byte of s through an implicit pointer to the third > +# byte of s, using a negative offset. Compare that to the second byte of > +# the short integer 1 in target byte order. > +gdb_test "p/d p\[-1\] - ((signed char *)(short\[1\]){1})\[1\]" " = 0" > -- Can we check the result of p[-1] explicitly for different endianness? We can fill in the first two bytes of s with 0x5678, for example, and it is expected to see different results of p[-1] for different endianness.
diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp index af7dd37..3f6e0d6 100644 --- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp +++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp @@ -119,4 +119,7 @@ if ![runto_main] { return -1 } -gdb_test "print/d p\[-1\]" " = 0" +# Access the second byte of s through an implicit pointer to the third +# byte of s, using a negative offset. Compare that to the second byte of +# the short integer 1 in target byte order. +gdb_test "p/d p\[-1\] - ((signed char *)(short\[1\]){1})\[1\]" " = 0"