revert previous patch
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.exp
CommitLineData
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# tests for arithmetic, logical and relational operators
21# with mixed types
22#
23
24
25
26if $tracelevel then {
27 strace $tracelevel
28 }
29
30#
31# test running programs
32#
c906108c
SS
33
34set testfile "all-types"
35set srcfile ${testfile}.c
36set binfile ${objdir}/${subdir}/${testfile}
37
fc91c6c2 38if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
39 untested all-bin.exp
40 return -1
c906108c
SS
41 }
42
085dd6e6
JM
43if [get_compiler_info ${binfile}] {
44 return -1
45}
46
c906108c
SS
47gdb_exit
48gdb_start
49gdb_reinitialize_dir $srcdir/$subdir
50gdb_load ${binfile}
51
52
53#
54# set it up at a breakpoint so we can play with the variable values
55#
56
57if ![runto_main] then {
58 perror "couldn't run to breakpoint"
59 continue
60}
61
62gdb_test "next" "return 0;" "continuing after dummy()"
63
6acb16a2
MS
64gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char"
65
66gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short"
67
68gdb_test "print v_int+v_signed_char" " = 72" \
69 "print value of v_int+v_signed_char"
70
71gdb_test "print v_int+v_unsigned_char" " = 73" \
72 "print value of v_int+v_unsigned_char"
73
74gdb_test "print v_int+v_signed_short" " = 10" \
75 "print value of v_int+v_signed_short"
76
77gdb_test "print v_int+v_unsigned_short" " = 11" \
78 "print value of v_int+v_unsigned_short"
79
80gdb_test "print v_int+v_signed_int" " = 13" \
81 "print value of v_int+v_signed_int"
82
83gdb_test "print v_int+v_unsigned_int" " = 14" \
84 "print value of v_int+v_unsigned_int"
85
86gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long"
87
88gdb_test "print v_int+v_signed_long" " = 16" \
89 "print value of v_int+v_signed_long"
90
91gdb_test "print v_int+v_unsigned_long" " = 17" \
92 "print value of v_int+v_unsigned_long"
93
94gdb_test "print v_int+v_float" " = 106.34343.*" \
95 "print value of v_int+v_float"
96
97gdb_test "print v_int+v_double" " = 206.565.*" \
98 "print value of v_int+v_double"
c906108c
SS
99
100
101#
102# test the relational operators with mixed types
103#
104
6acb16a2
MS
105gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char"
106
107gdb_test "print v_int <= v_short" " = $false" \
108 "print value of v_int<=v_short"
109
110gdb_test "print v_int <= v_signed_char" " = 1" \
111 "print value of v_int<=v_signed_char"
112
113gdb_test "print v_int <= v_unsigned_char" " = 1" \
114 "print value of v_int<=v_unsigned_char"
115
116gdb_test "print v_int <= v_signed_short" " = $false" \
117 "print value of v_int<=v_signed_short"
118
119gdb_test "print v_int <= v_unsigned_short" " = $false" \
120 "print value of v_int<=v_unsigned_short"
c906108c 121
6acb16a2
MS
122gdb_test "print v_int <= v_signed_int" " = $true" \
123 "print value of v_int<=v_signed_int"
c906108c 124
6acb16a2
MS
125gdb_test "print v_int <= v_unsigned_int" " = $true" \
126 "print value of v_int<=v_unsigned_int"
127
128gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long"
129
130gdb_test "print v_int <= v_signed_long" " = $true" \
131 "print value of v_int<=v_signed_long"
132
133gdb_test "print v_int <= v_unsigned_long" " = $true" \
134 "print value of v_int<=v_unsigned_long"
135
136gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float"
137
138gdb_test "print v_int <= v_double" " = $true" \
139 "print value of v_int<=v_double"
c906108c
SS
140
141#
142# test the logical operators with mixed types
143#
144
6acb16a2
MS
145gdb_test_no_output "set variable v_char=0" "set v_char=0"
146gdb_test_no_output "set variable v_double=0.0" "set v_double=0"
147gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0"
148
149gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char"
150
151gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short"
152
153gdb_test "print v_int && v_signed_char" " = $true" \
154 "print value of v_int&&v_signed_char"
155
156gdb_test "print v_int && v_unsigned_char" " = $true" \
157 "print value of v_int&&v_unsigned_char"
158
159gdb_test "print v_int && v_signed_short" " = $true" \
160 "print value of v_int&&v_signed_short"
161
162gdb_test "print v_int && v_unsigned_short" " = $true" \
163 "print value of v_int&&v_unsigned_short"
164
165gdb_test "print v_int && v_signed_int" " = $true" \
166 "print value of v_int&&v_signed_int"
167
168gdb_test "print v_int && v_unsigned_int" " = $true" \
169 "print value of v_int&&v_unsigned_int"
170
171gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long"
172
173gdb_test "print v_int && v_signed_long" " = $true" \
174 "print value of v_int&&v_signed_long"
175
176gdb_test "print v_int && v_unsigned_long" " = $false" \
177 "print value of v_int&&v_unsigned_long"
178
179gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float"
180
181gdb_test "print v_int && v_double" " = $false" \
182 "print value of v_int&&v_double"
c906108c
SS
183
184
185
186
187
This page took 1.021215 seconds and 4 git commands to generate.