From patchwork Mon Oct 27 03:16:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vkamensky X-Patchwork-Id: 39542 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0606724026 for ; Mon, 27 Oct 2014 03:16:52 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf891557lbj.3 for ; Sun, 26 Oct 2014 20:16:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=5hfF9uhjWKP2zDKmOiwyqKts8cUT3OyzyDjtKg/25s8=; b=Dbp9SA7EN9vsBPvz8gyxVKgGr5x6nEbjuuUKfVcIhLPLUB2fJlg7S9fiPceLZpAxoG Lr3+iQUhGx2cDJYCV52L8kgC+rq7NIoCi8gh0uVICHFN4ckg/y2qvOqeL7AJpWsyn/y0 9yxKCWauiiIUlQAmq5Q1T2rw7pe2K3Mdhp0PL/lr4dDdF7E/Ok7+F0msmNETF9Ht9pFj TiYUb3wuZL7/s64O1vdHKdhTZRvnlaF7iUAwSsL9KKMFuS4wckSoDv3pJuvH9A6x184Y xO/jBGlKZS9LNUkyuirT85P6eufChhTTX87a81KQTeiIantJ1d3yHyWfno0VdL95k7l8 3lhQ== X-Gm-Message-State: ALoCoQkwkQn3875qeuYKfg0X4XcLYoJurGYrtU7mX9cW4J/OA2i929/55enOyMi1mtvFy+qvM92p X-Received: by 10.112.140.132 with SMTP id rg4mr9203lbb.12.1414379811514; Sun, 26 Oct 2014 20:16:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.74 with SMTP id a10ls628301laa.82.gmail; Sun, 26 Oct 2014 20:16:50 -0700 (PDT) X-Received: by 10.112.157.194 with SMTP id wo2mr20287662lbb.55.1414379810831; Sun, 26 Oct 2014 20:16:50 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com. [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id rs4si17897156lbb.12.2014.10.26.20.16.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 26 Oct 2014 20:16:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by mail-la0-f45.google.com with SMTP id gm9so3612702lab.4 for ; Sun, 26 Oct 2014 20:16:50 -0700 (PDT) X-Received: by 10.112.173.100 with SMTP id bj4mr20594498lbc.78.1414379810746; Sun, 26 Oct 2014 20:16:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp224304lbz; Sun, 26 Oct 2014 20:16:49 -0700 (PDT) X-Received: by 10.66.150.102 with SMTP id uh6mr53138pab.141.1414379809186; Sun, 26 Oct 2014 20:16:49 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id ko1si9412312pbd.111.2014.10.26.20.16.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Oct 2014 20:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-return-117042-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 12127 invoked by alias); 27 Oct 2014 03:16:38 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 11753 invoked by uid 89); 27 Oct 2014 03:16:35 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f50.google.com Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 27 Oct 2014 03:16:33 +0000 Received: by mail-pa0-f50.google.com with SMTP id eu11so4608304pac.9 for ; Sun, 26 Oct 2014 20:16:31 -0700 (PDT) X-Received: by 10.68.227.104 with SMTP id rz8mr21440194pbc.4.1414379791107; Sun, 26 Oct 2014 20:16:31 -0700 (PDT) Received: from kamensky-w530.cisco.com (128-107-239-233.cisco.com. [128.107.239.233]) by mx.google.com with ESMTPSA id sq2sm2509238pbc.73.2014.10.26.20.16.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Oct 2014 20:16:30 -0700 (PDT) From: Victor Kamensky To: gdb-patches@sourceware.org, Yao Qi Cc: Andrew Pinski , victor.kamensky@linaro.org Subject: [RFC PATCH 2/2] fix py-value-cc.exp test for big endian target Date: Sun, 26 Oct 2014 20:16:18 -0700 Message-Id: <1414379778-5478-3-git-send-email-victor.kamensky@linaro.org> In-Reply-To: <1414379778-5478-1-git-send-email-victor.kamensky@linaro.org> References: <1414379778-5478-1-git-send-email-victor.kamensky@linaro.org> X-Original-Sender: victor.kamensky@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 On any big endian target py-value-cc.exp fails like this: FAIL: gdb.python/py-value-cc.exp: u's second field via field python print(u[u_fields[1]]) 0 '\000' (gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field The reason is that test case is not endian agnostic. Test program variable 'u' has type of 'union U { int a; char c; };'. Test program writes 99 into u.a and expects to see it in field 'u.c'. But it would only work on little endian system where 'c' field of U union conicide with least significant byte of 'a' field. Proposed fix stores "symetric" value into 'a' field of 'u', so most siginificant byte and least siginifican byte of are the same, so 'c' field would have the same value regardless whether test runs on big endian or little endian system. gdb/testsuite/ChangeLog: 2014-10-24 Victor Kamensky * gdb.python/py-value-cc.cc (func): Store in u.a value with same most and least significant bytes. * gdb.python/py-value-cc.exp: Fix test for big endian target. --- gdb/testsuite/gdb.python/py-value-cc.cc | 2 +- gdb/testsuite/gdb.python/py-value-cc.exp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc index 7ea4f5d..d6d4d35 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.cc +++ b/gdb/testsuite/gdb.python/py-value-cc.cc @@ -77,7 +77,7 @@ func (const A &a) Btd &b_td = b1; U u; - u.a = 99; + u.a = 0x55000055; /* c is the same for big and little endian */ X x; x.x = 101; diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp index 949f04f..56003c3 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.exp +++ b/gdb/testsuite/gdb.python/py-value-cc.exp @@ -85,8 +85,8 @@ gdb_test "python print(b_td\[b_fields\[0\]\].type.target())" "A" \ gdb_test "python print(b_td\[b_fields\[0\]\]\['a'\])" "100" \ "b_td.A::a via field" -gdb_test "python print(u\[u_fields\[0\]\])" "99.*" "u's first field via field" -gdb_test "python print(u\[u_fields\[1\]\])" "99.*" "u's second field via field" +gdb_test "python print(u\[u_fields\[0\]\])" "1426063445.*" "u's first field via field" +gdb_test "python print(u\[u_fields\[1\]\])" "85.*" "u's second field via field" gdb_test "python print len(x_fields)" "2" "number for fields in u" gdb_test "python print x\[x_fields\[0\]\]\['x'\]" "101" "x.x via field"