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: Victor Kamensky X-Patchwork-Id: 3391 Received: (qmail 12127 invoked by alias); 27 Oct 2014 03:16:38 -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 11753 invoked by uid 89); 27 Oct 2014 03:16:35 -0000 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5hfF9uhjWKP2zDKmOiwyqKts8cUT3OyzyDjtKg/25s8=; b=XceDhnSx0o0P+awwQjmyrM6jvQPx/70wsre37wCuRa9hK+sC8BiAxron24iGAagc0L hprpO4gqdpGLTsTnpSBjC4PIG+rbFkKotPNQ5ARRzHs4vj+UoUKMkSqtQ49YxCiVnD7q zUoBdgGOBa6WTyduUQkAiZQJogDAAH09IW6fyaIjuulgXbcSg6fV0G3FhVQWZWfWZfrQ h6V4oGvYeUTPdF+WGNKl1OYQLKv8uLKyR/+21mlxrvkknipsbAv2pTwbV51Romp3T5yf XUSfsufXoX1pWnThcu86pDTPjA4xODcl6gcVuo9CZSqNJ6N5bCtP15rodkWvIxNy19Nk EvDg== X-Gm-Message-State: ALoCoQmOtdc1QQykyJitUwkepg0hSYbhHWSE7cik51FBr3fTjWAXIE6c9ZAbuq+AOcAj+28uJDpn 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> 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"