GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
[binutils-gdb.git] / gdb / testsuite / gdb.rust / onetwoeight.exp
blob8b73f169f449418177c8b3901eb98b1f49446ff2
1 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Test expression parsing and evaluation that requires Rust compiler.
18 load_lib rust-support.exp
19 require allow_rust_tests
20 require {can_compile rust}
22 set v [split [rust_compiler_version] .]
23 if {[lindex $v 0] == 1 && [lindex $v 1] < 43} {
24 untested "128-bit ints require rust 1.43 or greater"
25 return -1
28 standard_testfile .rs
29 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
30 return -1
33 set line [gdb_get_line_number "BREAK"]
34 if {![runto ${srcfile}:$line]} {
35 untested "could not run to breakpoint"
36 return -1
39 gdb_test "print x" " = 340282366920938463463374607431768211455"
40 gdb_test "print y" " = 170141183460469231731687303715884105727"
42 gdb_test "print x / 2" " = 170141183460469231731687303715884105727"
43 gdb_test "print sm * 2" " = 170141183460469231731687303715884105726"
44 gdb_test "print sm + sm" " = 170141183460469231731687303715884105726"
45 gdb_test "print x - y" " = 170141183460469231731687303715884105728"
46 gdb_test "print -y" " = -170141183460469231731687303715884105727"
47 gdb_test "print +y" " = 170141183460469231731687303715884105727"
49 gdb_test "print/x x" " = 0xffffffffffffffffffffffffffffffff"
50 gdb_test "print x % 4" " = 3"
51 gdb_test "print !x" " = 0"
53 gdb_test "print x < 0" " = false"
54 gdb_test "print -y < 0" " = true"
55 gdb_test "print x > y" " = true"
56 gdb_test "print y >= y" " = true"
57 gdb_test "print y <= y" " = true"
58 gdb_test "print y == y" " = true"
59 gdb_test "print x != y" " = true"
61 gdb_test "print sm << 2" "= 340282366920938463463374607431768211452"
62 gdb_test "print x >> 2" "= 85070591730234615865843651857942052863"
64 gdb_test "print/x x & mask" " = 0xf0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0"
65 gdb_test "print/x x ^ mask" " = 0xf0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f"
66 gdb_test "print/x mask | (mask >> 4)" " = 0xffffffffffffffffffffffffffffffff"
68 gdb_test "print 170141183460469231731687303715884105727" \
69 " = 170141183460469231731687303715884105727"
70 gdb_test "ptype 23i128" "type = i128"