Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 1998, 1999, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 15 | |
c906108c SS |
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 | if $tracelevel then { | |
32 | strace $tracelevel | |
33 | } | |
34 | ||
35 | # Check to see if we have an executable to test. If not, then either we | |
36 | # haven't tried to compile one, or the compilation failed for some reason. | |
37 | # In either case, just notify the user and skip the tests in this file. | |
38 | ||
39 | set testfile "int-type" | |
40 | set srcfile ${testfile}.c | |
41 | set binfile ${objdir}/${subdir}/${testfile} | |
42 | ||
fc91c6c2 | 43 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
44 | untested eval-skip.exp |
45 | return -1 | |
c906108c SS |
46 | } |
47 | ||
085dd6e6 JM |
48 | if [get_compiler_info $binfile] { |
49 | return -1 | |
50 | } | |
c906108c SS |
51 | |
52 | gdb_exit | |
53 | gdb_start | |
54 | gdb_reinitialize_dir $srcdir/$subdir | |
55 | gdb_load ${binfile} | |
56 | ||
57 | ||
58 | if ![runto_main] then { | |
59 | perror "couldn't run to breakpoint" | |
60 | continue | |
61 | } | |
62 | ||
27d3a1a2 MS |
63 | gdb_test_no_output "set variable x=14" "set variable x=14" |
64 | gdb_test_no_output "set variable y=2" "set variable y=2" | |
65 | gdb_test_no_output "set variable z=2" "set variable z=2" | |
66 | gdb_test_no_output "set variable w=3" "set variable w=3" | |
c906108c | 67 | |
a76e022a MS |
68 | gdb_test "print (0 && (x+y))" ".$decimal = $false" \ |
69 | "print value of (0 && (x+y))" | |
70 | ||
71 | gdb_test "print (0 && (x-y))" ".$decimal = $false" \ | |
72 | "print value of (0 && (x-y))" | |
73 | ||
74 | gdb_test "print (0 && (x*y))" ".$decimal = $false" \ | |
75 | "print value of (0 && (x*y))" | |
76 | ||
77 | gdb_test "print (0 && (x/y))" ".$decimal = $false" \ | |
78 | "print value of (0 && (x/y))" | |
79 | ||
80 | gdb_test "print (0 && (x%y))" ".$decimal = $false" \ | |
81 | "print value of (0 && (x%y))" | |
82 | ||
83 | gdb_test "print (0 && (x&&y))" ".$decimal = $false" \ | |
84 | "print value of (0 && (x&&y))" | |
85 | ||
86 | gdb_test "print (0 && (x||y))" ".$decimal = $false" \ | |
87 | "print value of (0 && (x||y))" | |
88 | ||
89 | gdb_test "print (0 && (x&y))" ".$decimal = $false" \ | |
90 | "print value of (0 && (x&y))" | |
91 | ||
92 | gdb_test "print (0 && (x|y))" ".$decimal = $false" \ | |
93 | "print value of (0 && (x|y))" | |
94 | ||
95 | gdb_test "print (0 && (x^y))" ".$decimal = $false" \ | |
96 | "print value of (0 && (x^y))" | |
97 | ||
98 | gdb_test "print (0 && (x < y))" ".$decimal = $false" \ | |
99 | "print value of (0 && (x < y))" | |
100 | ||
101 | gdb_test "print (0 && (x <= y))" ".$decimal = $false" \ | |
102 | "print value of (0 && (x <= y))" | |
103 | ||
104 | gdb_test "print (0 && (x>y))" ".$decimal = $false" \ | |
105 | "print value of (0 && (x>y))" | |
106 | ||
107 | gdb_test "print (0 && (x>=y))" ".$decimal = $false" \ | |
108 | "print value of (0 && (x>=y))" | |
109 | ||
110 | gdb_test "print (0 && (x==y))" ".$decimal = $false" \ | |
111 | "print value of (0 && (x==y))" | |
112 | ||
113 | gdb_test "print (0 && (x!=y))" ".$decimal = $false" \ | |
114 | "print value of (0 && (x!=y))" | |
115 | ||
116 | gdb_test "print (0 && (x<<31))" ".$decimal = $false" \ | |
117 | "print value of (0 && (x<<31))" | |
118 | ||
119 | gdb_test "print (0 && (x>>31))" ".$decimal = $false" \ | |
120 | "print value of (0 && (x>>31))" | |
121 | ||
122 | gdb_test "print (0 && (!x))" ".$decimal = $false" \ | |
123 | "print value of (0 && (!x))" | |
124 | ||
125 | gdb_test "print (0 && (~x))" ".$decimal = $false" \ | |
126 | "print value of (0 && (~x))" | |
127 | ||
128 | gdb_test "print (0 && (-x))" ".$decimal = $false" \ | |
129 | "print value of (0 && (-x))" | |
130 | ||
131 | gdb_test "print (0 && (x++))" ".$decimal = $false" \ | |
132 | "print value of (0 && (x++))" | |
133 | ||
134 | gdb_test "print (0 && (++x))" ".$decimal = $false" \ | |
135 | "print value of (0 && (++x))" | |
136 | ||
137 | gdb_test "print (0 && (x--))" ".$decimal = $false" \ | |
138 | "print value of (0 && (x--))" | |
139 | ||
140 | gdb_test "print (0 && (--x))" ".$decimal = $false" \ | |
141 | "print value of (0 && (--x))" | |
142 | ||
143 | gdb_test "print (0 && (x+=7))" ".$decimal = $false" \ | |
144 | "print value of (0 && (x+=7))" | |
145 | ||
146 | gdb_test "print (0 && (x=y))" ".$decimal = $false" \ | |
147 | "print value of (0 && (x=y))" | |
148 | ||
c906108c SS |
149 | |
150 | gdb_exit | |
151 | return 0 | |
152 | ||
153 | ||
154 | ||
155 | ||
156 | ||
157 | ||
158 |