]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/eval-skip.exp
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / eval-skip.exp
1 # Copyright 1998-2024 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
16 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18 # This file is part of the gdb testsuite
19
20 #
21 # tests to cover evaluate_subexp_standard with the EVAL_SKIP flag set.
22 # this happens for instance when there is short circuit evaluation in the && and ||
23 # operators, or in the non returned part of a (x ? y: z) expression.
24 # the part that is not evaluated is parsed and evaluated anyway, but with
25 # the EVAL_SKIP flag set
26 #
27 # source file "int-type.c"
28 #
29
30
31 # Check to see if we have an executable to test. If not, then either we
32 # haven't tried to compile one, or the compilation failed for some reason.
33 # In either case, just notify the user and skip the tests in this file.
34
35 standard_testfile int-type.c
36
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
38 untested "failed to compile"
39 return -1
40 }
41
42 clean_restart ${binfile}
43
44
45 if {![runto_main]} {
46 return
47 }
48
49 # This is used as an expected result value.
50 set false 0
51
52 gdb_test_no_output "set variable x=14" "set variable x=14"
53 gdb_test_no_output "set variable y=2" "set variable y=2"
54 gdb_test_no_output "set variable z=2" "set variable z=2"
55 gdb_test_no_output "set variable w=3" "set variable w=3"
56
57 gdb_test "print (0 && (x+y))" ".$decimal = $false" \
58 "print value of (0 && (x+y))"
59
60 gdb_test "print (0 && (x-y))" ".$decimal = $false" \
61 "print value of (0 && (x-y))"
62
63 gdb_test "print (0 && (x*y))" ".$decimal = $false" \
64 "print value of (0 && (x*y))"
65
66 gdb_test "print (0 && (x/y))" ".$decimal = $false" \
67 "print value of (0 && (x/y))"
68
69 gdb_test "print (0 && (x%y))" ".$decimal = $false" \
70 "print value of (0 && (x%y))"
71
72 gdb_test "print (0 && (x&&y))" ".$decimal = $false" \
73 "print value of (0 && (x&&y))"
74
75 gdb_test "print (0 && (x||y))" ".$decimal = $false" \
76 "print value of (0 && (x||y))"
77
78 gdb_test "print (0 && (x&y))" ".$decimal = $false" \
79 "print value of (0 && (x&y))"
80
81 gdb_test "print (0 && (x|y))" ".$decimal = $false" \
82 "print value of (0 && (x|y))"
83
84 gdb_test "print (0 && (x^y))" ".$decimal = $false" \
85 "print value of (0 && (x^y))"
86
87 gdb_test "print (0 && (x < y))" ".$decimal = $false" \
88 "print value of (0 && (x < y))"
89
90 gdb_test "print (0 && (x <= y))" ".$decimal = $false" \
91 "print value of (0 && (x <= y))"
92
93 gdb_test "print (0 && (x>y))" ".$decimal = $false" \
94 "print value of (0 && (x>y))"
95
96 gdb_test "print (0 && (x>=y))" ".$decimal = $false" \
97 "print value of (0 && (x>=y))"
98
99 gdb_test "print (0 && (x==y))" ".$decimal = $false" \
100 "print value of (0 && (x==y))"
101
102 gdb_test "print (0 && (x!=y))" ".$decimal = $false" \
103 "print value of (0 && (x!=y))"
104
105 gdb_test "print (0 && (x<<31))" ".$decimal = $false" \
106 "print value of (0 && (x<<31))"
107
108 gdb_test "print (0 && (x>>31))" ".$decimal = $false" \
109 "print value of (0 && (x>>31))"
110
111 gdb_test "print (0 && (!x))" ".$decimal = $false" \
112 "print value of (0 && (!x))"
113
114 gdb_test "print (0 && (~x))" ".$decimal = $false" \
115 "print value of (0 && (~x))"
116
117 gdb_test "print (0 && (-x))" ".$decimal = $false" \
118 "print value of (0 && (-x))"
119
120 gdb_test "print (0 && (x++))" ".$decimal = $false" \
121 "print value of (0 && (x++))"
122
123 gdb_test "print (0 && (++x))" ".$decimal = $false" \
124 "print value of (0 && (++x))"
125
126 gdb_test "print (0 && (x--))" ".$decimal = $false" \
127 "print value of (0 && (x--))"
128
129 gdb_test "print (0 && (--x))" ".$decimal = $false" \
130 "print value of (0 && (--x))"
131
132 gdb_test "print (0 && (x+=7))" ".$decimal = $false" \
133 "print value of (0 && (x+=7))"
134
135 gdb_test "print (0 && (x=y))" ".$decimal = $false" \
136 "print value of (0 && (x=y))"
137
138
139 gdb_exit