From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 87C2B3858D37; Thu, 1 Dec 2022 06:25:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87C2B3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669875908; bh=/ySwWSoUY+ubHmIT2g8rmkSe4+6ZLBmCd/fnFDuiwes=; h=From:To:Subject:Date:From; b=XbvBOJQcNTR+WtlCJrUBQV54OfT3UGb82m1zCTHzZOYfrne8S3B6E1n5/pDyqZnju qnxJ5S7SAjuqEXndYOo18rmDrkT4d2aBEP5P4AUhHKcfcB9J/q3/8ajJnOPFMUHl7E WNIEbi/DRmb/xRiF48VnvOm0ZQLUM5XkCjMuz5fk= 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.ada/float-bits.exp for powerpc64le X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 8a1c55cdfb2d17208cacfc6c34af4693d6956693 X-Git-Newrev: 32a5aa2625686a709b22db19300a578d96285dd1 Message-Id: <20221201062508.87C2B3858D37@sourceware.org> Date: Thu, 1 Dec 2022 06:25:08 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D32a5aa262568= 6a709b22db19300a578d96285dd1 commit 32a5aa2625686a709b22db19300a578d96285dd1 Author: Tom de Vries Date: Thu Dec 1 07:25:04 2022 +0100 [gdb/testsuite] Fix gdb.ada/float-bits.exp for powerpc64le =20 On powerpc64le-linux, I run into: ... (gdb) print 16llf#4000921fb54442d18469898cc51701b8#^M $9 =3D ^M (gdb) FAIL: gdb.ada/float-bits.exp: print \ 16llf#4000921fb54442d18469898cc51701b8# ... =20 The problem is that we're using a hex string for the 128-bit IEEE quad = long double format, but the actual long double float format is: ... gdbarch_dump: long_double_format =3D floatformat_ibm_long_double_little= ^M ... =20 Fix this by using the hex string obtained by compiling test.c: ... long double a =3D 5.0e+25L; ... like so: ... $ gcc -mlittle test.c -c -g ... and running gdb: ... $ gdb -q -batch test.o -ex "p /x a" $1 =3D 0xc1e1c000000000004544adf4b7320335 ... and likewise for -mbig: ... $ gdb -q -batch test.o -ex "p /x a" $1 =3D 0x4544adf4b7320335c1e1c00000000000 ... =20 Tested on powerpc64le-linux. =20 I excercised the case of floatformat_ibm_long_double_big by using "set endian big" in the test-case. =20 Note that for this patch to work correctly, recent commit aaa79cd62b8 (= "[gdb] Improve printing of float formats") is required. =20 PR testsuite/29816 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29816 Approved-By: Tom Tromey Diff: --- gdb/testsuite/gdb.ada/float-bits.exp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gdb/testsuite/gdb.ada/float-bits.exp b/gdb/testsuite/gdb.ada/f= loat-bits.exp index 55a0566580c..921fe36a4bd 100644 --- a/gdb/testsuite/gdb.ada/float-bits.exp +++ b/gdb/testsuite/gdb.ada/float-bits.exp @@ -73,12 +73,40 @@ set gdb_long_double_size [float_size "16llf#0#" ] # example, IEEE quad versus i387 long doubles. Account for that in the # tests below. =20 +# Get the used long double format. +set long_double_format "" +gdb_test_multiple "maint print architecture" "" { + -re "\r\ngdbarch_dump: long_double_format =3D (\[^\r\n\]*)" { + set long_double_format $expect_out(1,string) + exp_continue + } + -re -wrap "" { + pass $gdb_test_name + } +} + # Set default values for 128-bit IEEE quad long doubles. set valid_long_double "16llf#4000921fb54442d18469898cc51701b8#" set printed_long_double "3.1415926535897932384626433832795028" set invalid_long_double "" set has_invalid_long_double 0 =20 +switch -glob $long_double_format { + floatformat_ibm_long_double_* { + set w1 c1e1c00000000000 + set w2 4544adf4b7320335 + switch $long_double_format { + floatformat_ibm_long_double_big { + set valid_long_double "16llf#$w2$w1#" + } + floatformat_ibm_long_double_little { + set valid_long_double "16llf#$w1$w2#" + } + } + set printed_long_double "50000000000000000000000000.0" + } +} + if { [istarget x86_64-*-* ] || [istarget i?86-*-*] } { # i387 long double have invalid values set has_invalid_long_double 1