From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 0993E3858C52; Thu, 19 Jan 2023 12:44:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0993E3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674132258; bh=bxn9OvCs2S7dzO5perHRAK4P8QTe6KiHCqa0HHJ/IsU=; h=From:To:Subject:Date:From; b=W7FyMjS3xk2qQG5eigtMVRzTXKhQe3bgPZ4/RkfPJPNV3KdQHlzPUbHrq8+IdH93q MKh/Ac+bmx8+ON4eV6y05xLwWc8kaKmUNVTEhxj8Ee2mbcBWKWbhBe639/ymwL4BUx amvQ9JderTjAc8WBUZNaa0WU6RmTY1Hx077/XooU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.python/py-value-cc.exp for big endian X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 75c2efc6f19fe454413aa70d2c37e543f04a67e1 X-Git-Newrev: a0d5ef869da20e023e4b75860012c56273f26d92 Message-Id: <20230119124418.0993E3858C52@sourceware.org> Date: Thu, 19 Jan 2023 12:44:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da0d5ef869da2= 0e023e4b75860012c56273f26d92 commit a0d5ef869da20e023e4b75860012c56273f26d92 Author: Tom de Vries Date: Thu Jan 19 13:44:13 2023 +0100 [gdb/testsuite] Fix gdb.python/py-value-cc.exp for big endian =20 On s390x-linux, I run into: ... (gdb) python print(u[u_fields[0]])^M 99^M (gdb) PASS: gdb.python/py-value-cc.exp: u's first field via field python print(u[u_fields[1]])^M 0 '\000'^M (gdb) FAIL: gdb.python/py-value-cc.exp: u's second field via field ... =20 There's a var u of this type: ... union U { int a; char c; }; ... and after assigning 99 to u.a, the test-case expects u.c to contain 99 = (which it does on x86_64), but instead it contains 0. =20 Fix this by instead assigning 0x63636363, to ensure that u.c =3D=3D 99 = for both little and big endian. =20 Tested on x86_64-linux and s390x-linux. Diff: --- gdb/testsuite/gdb.python/py-value-cc.cc | 2 +- gdb/testsuite/gdb.python/py-value-cc.exp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.py= thon/py-value-cc.cc index 817b089c35f..d82e385d6c5 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 =3D b1; =20 U u; - u.a =3D 99; + u.a =3D 0x63636363; =20 X x; x.x =3D 101; diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.p= ython/py-value-cc.exp index 1ea10ad0058..b6571cd8297 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.exp +++ b/gdb/testsuite/gdb.python/py-value-cc.exp @@ -80,7 +80,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" =20 -gdb_test "python print(u\[u_fields\[0\]\])" "99.*" "u's first field via fi= eld" +gdb_test "python print(hex(u\[u_fields\[0\]\]))" "0x63636363.*" \ + "u's first field via field" gdb_test "python print(u\[u_fields\[1\]\])" "99.*" "u's second field via f= ield" =20 gdb_test "python print(len(x_fields))" "2" "number for fields in u"