1 # Copyright 1998-1999, 2007-2012 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 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
18 # This file is part of the gdb testsuite
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
27 # source file "int-type.c"
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.
35 set testfile "int-type"
36 set srcfile ${testfile}.c
37 set binfile ${objdir}/${subdir}/${testfile}
39 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
40 untested eval-skip.exp
44 if [get_compiler_info] {
50 gdb_reinitialize_dir $srcdir/$subdir
54 if ![runto_main] then {
55 perror "couldn't run to breakpoint"
59 gdb_test_no_output "set variable x=14" "set variable x=14"
60 gdb_test_no_output "set variable y=2" "set variable y=2"
61 gdb_test_no_output "set variable z=2" "set variable z=2"
62 gdb_test_no_output "set variable w=3" "set variable w=3"
64 gdb_test "print (0 && (x+y))" ".$decimal = $false" \
65 "print value of (0 && (x+y))"
67 gdb_test "print (0 && (x-y))" ".$decimal = $false" \
68 "print value of (0 && (x-y))"
70 gdb_test "print (0 && (x*y))" ".$decimal = $false" \
71 "print value of (0 && (x*y))"
73 gdb_test "print (0 && (x/y))" ".$decimal = $false" \
74 "print value of (0 && (x/y))"
76 gdb_test "print (0 && (x%y))" ".$decimal = $false" \
77 "print value of (0 && (x%y))"
79 gdb_test "print (0 && (x&&y))" ".$decimal = $false" \
80 "print value of (0 && (x&&y))"
82 gdb_test "print (0 && (x||y))" ".$decimal = $false" \
83 "print value of (0 && (x||y))"
85 gdb_test "print (0 && (x&y))" ".$decimal = $false" \
86 "print value of (0 && (x&y))"
88 gdb_test "print (0 && (x|y))" ".$decimal = $false" \
89 "print value of (0 && (x|y))"
91 gdb_test "print (0 && (x^y))" ".$decimal = $false" \
92 "print value of (0 && (x^y))"
94 gdb_test "print (0 && (x < y))" ".$decimal = $false" \
95 "print value of (0 && (x < y))"
97 gdb_test "print (0 && (x <= y))" ".$decimal = $false" \
98 "print value of (0 && (x <= y))"
100 gdb_test "print (0 && (x>y))" ".$decimal = $false" \
101 "print value of (0 && (x>y))"
103 gdb_test "print (0 && (x>=y))" ".$decimal = $false" \
104 "print value of (0 && (x>=y))"
106 gdb_test "print (0 && (x==y))" ".$decimal = $false" \
107 "print value of (0 && (x==y))"
109 gdb_test "print (0 && (x!=y))" ".$decimal = $false" \
110 "print value of (0 && (x!=y))"
112 gdb_test "print (0 && (x<<31))" ".$decimal = $false" \
113 "print value of (0 && (x<<31))"
115 gdb_test "print (0 && (x>>31))" ".$decimal = $false" \
116 "print value of (0 && (x>>31))"
118 gdb_test "print (0 && (!x))" ".$decimal = $false" \
119 "print value of (0 && (!x))"
121 gdb_test "print (0 && (~x))" ".$decimal = $false" \
122 "print value of (0 && (~x))"
124 gdb_test "print (0 && (-x))" ".$decimal = $false" \
125 "print value of (0 && (-x))"
127 gdb_test "print (0 && (x++))" ".$decimal = $false" \
128 "print value of (0 && (x++))"
130 gdb_test "print (0 && (++x))" ".$decimal = $false" \
131 "print value of (0 && (++x))"
133 gdb_test "print (0 && (x--))" ".$decimal = $false" \
134 "print value of (0 && (x--))"
136 gdb_test "print (0 && (--x))" ".$decimal = $false" \
137 "print value of (0 && (--x))"
139 gdb_test "print (0 && (x+=7))" ".$decimal = $false" \
140 "print value of (0 && (x+=7))"
142 gdb_test "print (0 && (x=y))" ".$decimal = $false" \
143 "print value of (0 && (x=y))"