1 # Copyright
1998-2019 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
3 of the License
, or
6 #
(at your option
) any later version.
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
, see
<http
://www.gnu.org
/licenses
/>.
16 # This file was written by Elena Zannoni
(ezannoni@cygnus.com
)
18 # This file is part of the gdb testsuite
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
29 # test running programs
32 if { [prepare_for_testing
"failed to prepare" whatis-exp int-type.c {debug nowarnings}] } {
37 #
set it up at a breakpoint so we can play with the
variable values
40 if ![runto_main
] then {
41 perror
"couldn't run to breakpoint"
46 # test expressions with
"int" types
49 gdb_test_no_output
"set variable x=14" "set variable x=14"
50 gdb_test_no_output
"set variable y=2" "set variable y=2"
51 gdb_test_no_output
"set variable z=2" "set variable z=2"
52 gdb_test_no_output
"set variable w=3" "set variable w=3"
54 gdb_test
"print x" " = 14" "print value of x"
55 gdb_test
"print y" " = 2" "print value of y"
56 gdb_test
"print z" " = 2" "print value of z"
57 gdb_test
"print w" " = 3" "print value of w"
59 gdb_test
"whatis x+y" "type = int" "whatis value of x+y"
60 gdb_test
"whatis x-y" "type = int" "whatis value of x-y"
61 gdb_test
"whatis x*y" "type = int" "whatis value of x*y"
62 gdb_test
"whatis x/y" "type = int" "whatis value of x/y"
63 gdb_test
"whatis x%y" "type = int" "whatis value of x%y"
64 gdb_test
"whatis x=y" "type = int" "whatis value of x=y"
66 gdb_test
"whatis x+=2" "type = int" "whatis value of x+=2"
67 gdb_test
"whatis ++x" "type = int" "whatis value of ++x"
68 gdb_test
"whatis --x" "type = int" "whatis value of --x"
69 gdb_test
"whatis x++" "type = int" "whatis value of x++"
70 gdb_test
"whatis x--" "type = int" "whatis value of x--"