* [PATCH] [gdb/testsuite] Fix gdb.ada/verylong.exp on 32-bit target
@ 2024-03-29 12:37 Tom de Vries
2024-04-01 15:52 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-03-29 12:37 UTC (permalink / raw)
To: gdb-patches
In an aarch32-linux chroot on an aarch64-linux system, I run into:
...
(gdb) print x^M
$1 = 9223372036854775807^M
(gdb) FAIL: gdb.ada/verylong.exp: print x
...
A passing version on aarch64-linux looks like:
...
(gdb) print x^M
$1 = 170141183460469231731687303715884105727^M
(gdb) PASS: gdb.ada/verylong.exp: print x
...
The difference is caused by the size of the type Long_Long_Long_Integer, which
is:
- a 128-bit signed on 64-bit targets, and
- a 64-bit signed on 32-bit target.
Fix this by detecting the size of the Long_Long_Long_Integer type, and
handling it.
Tested on aarch64-linux and aarch32-linux.
PR testsuite/31574
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31574
[1] https://gcc.gnu.org/onlinedocs/gnat_rm/Implementation-Defined-Characteristics.html
---
gdb/testsuite/gdb.ada/verylong.exp | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/verylong.exp b/gdb/testsuite/gdb.ada/verylong.exp
index 28b65a10f64..4a3e0b9eeb2 100644
--- a/gdb/testsuite/gdb.ada/verylong.exp
+++ b/gdb/testsuite/gdb.ada/verylong.exp
@@ -29,15 +29,29 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/prog.adb]
runto "prog.adb:$bp_location"
-gdb_test "print x" " = 170141183460469231731687303715884105727"
-gdb_test "print x / 2" " = 85070591730234615865843651857942052863"
-gdb_test "print (x / 4) * 2" " = 85070591730234615865843651857942052862"
+set lll_int_size 0
+gdb_test_multiple "ptype Long_Long_Long_Integer" "" {
+ -re -wrap "type = <8-byte integer>" {
+ set lll_int_size 8
+ set max 9223372036854775807
+ }
+ -re -wrap "type = <16-byte integer>" {
+ set lll_int_size 16
+ set max 170141183460469231731687303715884105727
+ }
+}
+
+require {expr $lll_int_size == 8 || $lll_int_size == 16}
+
+gdb_test "print x" " = $max"
+gdb_test "print x / 2" " = [expr $max / 2]"
+gdb_test "print (x / 4) * 2" " = [expr ($max / 4) * 2]"
gdb_test "print x - x" " = 0"
-gdb_test "print x - 99 + 1" " = 170141183460469231731687303715884105629"
-gdb_test "print -x" " = -170141183460469231731687303715884105727"
-gdb_test "print +x" " = 170141183460469231731687303715884105727"
+gdb_test "print x - 99 + 1" " = [expr $max - 99 + 1]"
+gdb_test "print -x" " = -$max"
+gdb_test "print +x" " = $max"
gdb_test "print 170141183460469231731687303715884105727" \
" = 170141183460469231731687303715884105727"
-gdb_test "print x = 170141183460469231731687303715884105727" \
+gdb_test "print x = $max" \
" = true"
base-commit: 221918140b0b4a52674491d7ab4487da02d063a7
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [gdb/testsuite] Fix gdb.ada/verylong.exp on 32-bit target
2024-03-29 12:37 [PATCH] [gdb/testsuite] Fix gdb.ada/verylong.exp on 32-bit target Tom de Vries
@ 2024-04-01 15:52 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-04-01 15:52 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Fix this by detecting the size of the Long_Long_Long_Integer type, and
Tom> handling it.
Tom> Tested on aarch64-linux and aarch32-linux.
Tom> PR testsuite/31574
Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31574
Tom> [1] https://gcc.gnu.org/onlinedocs/gnat_rm/Implementation-Defined-Characteristics.html
Thank you. This is ok.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-01 15:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-29 12:37 [PATCH] [gdb/testsuite] Fix gdb.ada/verylong.exp on 32-bit target Tom de Vries
2024-04-01 15:52 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).