]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/whatis-exp.exp
run copyright.sh for 2011.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / whatis-exp.exp
CommitLineData
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# tests for whatis command on expressions.
22# used in file eval.c. This flavor of whatis
23# command performs evaluation of expressions w/o actually
24# computing the value, but just the type
25# of the result. It goes through the evaluate_subexp_standard
26# with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL
27#
28
29if $tracelevel then {
30 strace $tracelevel
31 }
32
33#
34# test running programs
35#
c906108c 36
aa81e255
JK
37if { [prepare_for_testing whatis-exp.exp whatis-exp int-type.c {debug nowarnings}] } {
38 return -1
39}
c906108c
SS
40
41#
42# set it up at a breakpoint so we can play with the variable values
43#
44
45if ![runto_main] then {
46 perror "couldn't run to breakpoint"
47 continue
48}
49
50#
51# test expressions with "int" types
52#
53
27d3a1a2
MS
54gdb_test_no_output "set variable x=14" "set variable x=14"
55gdb_test_no_output "set variable y=2" "set variable y=2"
56gdb_test_no_output "set variable z=2" "set variable z=2"
57gdb_test_no_output "set variable w=3" "set variable w=3"
c906108c 58
b72374d8
MS
59gdb_test "print x" " = 14" "print value of x"
60gdb_test "print y" " = 2" "print value of y"
61gdb_test "print z" " = 2" "print value of z"
62gdb_test "print w" " = 3" "print value of w"
63
64gdb_test "whatis x+y" "type = int" "whatis value of x+y"
65gdb_test "whatis x-y" "type = int" "whatis value of x-y"
66gdb_test "whatis x*y" "type = int" "whatis value of x*y"
67gdb_test "whatis x/y" "type = int" "whatis value of x/y"
68gdb_test "whatis x%y" "type = int" "whatis value of x%y"
69gdb_test "whatis x=y" "type = int" "whatis value of x=y"
70
71gdb_test "whatis x+=2" "type = int" "whatis value of x+=2"
72gdb_test "whatis ++x" "type = int" "whatis value of ++x"
73gdb_test "whatis --x" "type = int" "whatis value of --x"
74gdb_test "whatis x++" "type = int" "whatis value of x++"
75gdb_test "whatis x--" "type = int" "whatis value of x--"
c906108c
SS
76
77gdb_exit
78return 0