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