Commit | Line | Data |
---|---|---|
7b6bb8da JB |
1 | # Copyright 1998, 1999, 2007, 2008, 2009, 2010, 2011 |
2 | # Free Software Foundation, Inc. | |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
18 | ||
19 | # This file is part of the gdb testsuite | |
20 | ||
21 | # | |
22 | # tests to cover evaluate_subexp_standard with the EVAL_SKIP flag set. | |
23 | # this happens for instance when there is short circuit evaluation in the && and || | |
24 | # operators, or in the non returned part of a (x ? y: z) expression. | |
25 | # the part that is not evaluated is parsed and evaluated anyway, but with | |
26 | # the EVAL_SKIP flag set | |
27 | # | |
28 | # source file "int-type.c" | |
29 | # | |
30 | ||
31 | ||
32 | if $tracelevel then { | |
33 | strace $tracelevel | |
34 | } | |
35 | ||
36 | # Check to see if we have an executable to test. If not, then either we | |
37 | # haven't tried to compile one, or the compilation failed for some reason. | |
38 | # In either case, just notify the user and skip the tests in this file. | |
39 | ||
40 | set testfile "int-type" | |
41 | set srcfile ${testfile}.c | |
42 | set binfile ${objdir}/${subdir}/${testfile} | |
43 | ||
fc91c6c2 | 44 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
45 | untested eval-skip.exp |
46 | return -1 | |
c906108c SS |
47 | } |
48 | ||
085dd6e6 JM |
49 | if [get_compiler_info $binfile] { |
50 | return -1 | |
51 | } | |
c906108c SS |
52 | |
53 | gdb_exit | |
54 | gdb_start | |
55 | gdb_reinitialize_dir $srcdir/$subdir | |
56 | gdb_load ${binfile} | |
57 | ||
58 | ||
59 | if ![runto_main] then { | |
60 | perror "couldn't run to breakpoint" | |
61 | continue | |
62 | } | |
63 | ||
27d3a1a2 MS |
64 | gdb_test_no_output "set variable x=14" "set variable x=14" |
65 | gdb_test_no_output "set variable y=2" "set variable y=2" | |
66 | gdb_test_no_output "set variable z=2" "set variable z=2" | |
67 | gdb_test_no_output "set variable w=3" "set variable w=3" | |
c906108c | 68 | |
a76e022a MS |
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>y))" ".$decimal = $false" \ | |
106 | "print value of (0 && (x>y))" | |
107 | ||
108 | gdb_test "print (0 && (x>=y))" ".$decimal = $false" \ | |
109 | "print value of (0 && (x>=y))" | |
110 | ||
111 | gdb_test "print (0 && (x==y))" ".$decimal = $false" \ | |
112 | "print value of (0 && (x==y))" | |
113 | ||
114 | gdb_test "print (0 && (x!=y))" ".$decimal = $false" \ | |
115 | "print value of (0 && (x!=y))" | |
116 | ||
117 | gdb_test "print (0 && (x<<31))" ".$decimal = $false" \ | |
118 | "print value of (0 && (x<<31))" | |
119 | ||
120 | gdb_test "print (0 && (x>>31))" ".$decimal = $false" \ | |
121 | "print value of (0 && (x>>31))" | |
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++))" ".$decimal = $false" \ | |
133 | "print value of (0 && (x++))" | |
134 | ||
135 | gdb_test "print (0 && (++x))" ".$decimal = $false" \ | |
136 | "print value of (0 && (++x))" | |
137 | ||
138 | gdb_test "print (0 && (x--))" ".$decimal = $false" \ | |
139 | "print value of (0 && (x--))" | |
140 | ||
141 | gdb_test "print (0 && (--x))" ".$decimal = $false" \ | |
142 | "print value of (0 && (--x))" | |
143 | ||
144 | gdb_test "print (0 && (x+=7))" ".$decimal = $false" \ | |
145 | "print value of (0 && (x+=7))" | |
146 | ||
147 | gdb_test "print (0 && (x=y))" ".$decimal = $false" \ | |
148 | "print value of (0 && (x=y))" | |
149 | ||
c906108c SS |
150 | |
151 | gdb_exit | |
152 | return 0 | |
153 | ||
154 | ||
155 | ||
156 | ||
157 | ||
158 | ||
159 |