Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.base / whatis-exp.exp
blobf4a1966e1d23a51acc6fe75711384a18d18d6ef6
1 # Copyright 1998, 1999 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 2 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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
22 # This file is part of the gdb testsuite
24 # tests for whatis command on expressions.
25 # used in file eval.c. This flavor of whatis
26 # command performs evaluation of expressions w/o actually
27 # computing the value, but just the type
28 # of the result. It goes through the evaluate_subexp_standard
29 # with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL
32 if $tracelevel then {
33 strace $tracelevel
37 # test running programs
39 set prms_id 0
40 set bug_id 0
42 set testfile "int-type"
43 set srcfile ${testfile}.c
44 set binfile ${objdir}/${subdir}/${testfile}
45 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
46 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
50 gdb_exit
51 gdb_start
52 gdb_reinitialize_dir $srcdir/$subdir
53 gdb_load ${binfile}
57 # set it up at a breakpoint so we can play with the variable values
60 if ![runto_main] then {
61 perror "couldn't run to breakpoint"
62 continue
66 # test expressions with "int" types
69 gdb_test "set variable x=14" "" "set variable x=14"
70 gdb_test "set variable y=2" "" "set variable y=2"
71 gdb_test "set variable z=2" "" "set variable z=2"
72 gdb_test "set variable w=3" "" "set variable w=3"
74 send_gdb "print x\n"
75 gdb_expect {
76 -re ".*14.*$gdb_prompt $" {
77 pass "print value of x"
79 -re ".*$gdb_prompt $" { fail "print value of x" }
80 timeout { fail "(timeout) print value of x" }
84 send_gdb "print y\n"
85 gdb_expect {
86 -re ".*2.*$gdb_prompt $" {
87 pass "print value of y"
89 -re ".*$gdb_prompt $" { fail "print value of y" }
90 timeout { fail "(timeout) print value of y" }
93 send_gdb "print z\n"
94 gdb_expect {
95 -re ".*2.*$gdb_prompt $" {
96 pass "print value of z"
98 -re ".*$gdb_prompt $" { fail "print value of z" }
99 timeout { fail "(timeout) print value of z" }
102 send_gdb "print w\n"
103 gdb_expect {
104 -re ".*3.*$gdb_prompt $" {
105 pass "print value of w"
107 -re ".*$gdb_prompt $" { fail "print value of w" }
108 timeout { fail "(timeout) print value of w" }
113 send_gdb "whatis x+y\n"
114 gdb_expect {
115 -re ".*type = long.*$gdb_prompt $" {
116 pass "whatis value of x+y"
118 -re ".*$gdb_prompt $" { fail "whatis value of x+y" }
119 timeout { fail "(timeout) whatis value of x+y" }
122 send_gdb "whatis x-y\n"
123 gdb_expect {
124 -re ".*type = long.*$gdb_prompt $" {
125 pass "whatis value of x-y"
127 -re ".*$gdb_prompt $" { fail "whatis value of x-y" }
128 timeout { fail "(timeout) whatis value of x-y" }
131 send_gdb "whatis x*y\n"
132 gdb_expect {
133 -re ".*type = long.*$gdb_prompt $" {
134 pass "whatis value of x*y"
136 -re ".*$gdb_prompt $" { fail "whatis value of x*y" }
137 timeout { fail "(timeout) whatis value of x*y" }
140 send_gdb "whatis x/y\n"
141 gdb_expect {
142 -re ".*type = int.*$gdb_prompt $" {
143 pass "whatis value of x/y"
145 -re ".*$gdb_prompt $" { fail "whatis value of x/y" }
146 timeout { fail "(timeout) whatis value of x/y" }
149 send_gdb "whatis x%y\n"
150 gdb_expect {
151 -re ".*type = int.*$gdb_prompt $" {
152 pass "whatis value of x%y"
154 -re ".*$gdb_prompt $" { fail "whatis value of x%y" }
155 timeout { fail "(timeout) whatis value of x%y" }
160 send_gdb "whatis x=y\n"
161 gdb_expect {
162 -re ".*type = int.*$gdb_prompt $" {
163 pass "whatis value of x=y"
165 -re ".*$gdb_prompt $" { fail "whatis value of x=y" }
166 timeout { fail "(timeout) whatis value of x=y" }
170 send_gdb "whatis x+=2\n"
171 gdb_expect {
172 -re ".*type = int.*$gdb_prompt $" {
173 pass "whatis value of x+=2"
175 -re ".*$gdb_prompt $" { fail "whatis value of x+=2" }
176 timeout { fail "(timeout) whatis value of x+=2" }
180 send_gdb "whatis ++x\n"
181 gdb_expect {
182 -re ".*type = int.*$gdb_prompt $" {
183 pass "whatis value of ++x"
185 -re ".*$gdb_prompt $" { fail "whatis value of ++x" }
186 timeout { fail "(timeout) whatis value of ++x" }
189 send_gdb "whatis --x\n"
190 gdb_expect {
191 -re ".*type = int.*$gdb_prompt $" {
192 pass "whatis value of --x"
194 -re ".*$gdb_prompt $" { fail "whatis value of --x" }
195 timeout { fail "(timeout) whatis value of --x" }
198 send_gdb "whatis x++\n"
199 gdb_expect {
200 -re ".*type = int.*$gdb_prompt $" {
201 pass "whatis value of x++"
203 -re ".*$gdb_prompt $" { fail "whatis value of x++" }
204 timeout { fail "(timeout) whatis value of x++" }
207 send_gdb "whatis x--\n"
208 gdb_expect {
209 -re ".*type = int.*$gdb_prompt $" {
210 pass "whatis value of x--"
212 -re ".*$gdb_prompt $" { fail "whatis value of x--" }
213 timeout { fail "(timeout) whatis value of x--" }
216 gdb_exit
217 return 0