]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/ctf-constvars.exp
gdb/testsuite: remove use of then keyword from gdb.base/*.exp
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / ctf-constvars.exp
1 # Copyright 2019-2022 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 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.
12 #
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/>. */
15
16 # This file is a subset of constvars.exp, written by
17 # Elena Zannoni (elz@apollo.hp.com)
18 #
19 # This file is part of the gdb testsuite
20 #
21 # Tests for: const variables,
22 # const pointers to vars
23 # pointers to const variables
24 # const pointers to const vars
25 # with mixed types.
26
27 if [skip_ctf_tests] {
28 unsupported "no CTF debug format support, or CTF disabled in GDB"
29 return 0
30 }
31
32 standard_testfile .c
33
34 # Using `-gctf` generates full-fledged CTF debug information.
35 set opts {}
36 lappend opts additional_flags=-gctf
37 lappend opts ldflags=-Wl,--strip-debug
38 lappend opts ldflags=-Wl,--ctf-variables
39 lappend opts nowarnings
40
41 if { [prepare_for_testing "failed to prepare" ${testfile} \
42 [list $srcfile] $opts] } {
43 return 0
44 }
45
46 #
47 # set it up at a breakpoint so we can play with the variable values
48 #
49 if {![runto_main]} {
50 perror "couldn't run to breakpoint"
51 return
52 }
53
54 # test vars and pointers
55
56 proc do_constvar_tests {} {
57 gdb_test "print vox" " = 66 'B'"
58 gdb_test "ptype vox" "type = volatile char"
59 gdb_test "print victuals" " = 67 'C'"
60 gdb_test "ptype victuals" "type = volatile unsigned char"
61 gdb_test "print vixen" " = 200"
62 gdb_test "ptype vixen" "type = volatile short.*"
63 gdb_test "print vitriol" " = 300"
64 gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?"
65 gdb_test "print vellum" " = 1000"
66 gdb_test "ptype vellum" "type = volatile long.*"
67 gdb_test "print valve" " = 2000"
68 gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?"
69 gdb_test "print vacuity" " = 3"
70 gdb_test "ptype vacuity" "type = volatile float"
71 gdb_test "print vertigo" " = 10"
72 gdb_test "ptype vertigo" "type = volatile double"
73 gdb_test "print laconic" " = 65 'A'"
74
75 gdb_test "ptype vampire" "type = volatile char.*"
76 gdb_test "ptype viper" "type = volatile unsigned char.*"
77 gdb_test "ptype vigour" "type = volatile short.*"
78 gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)?.*"
79 gdb_test "ptype ventricle" "type = volatile long.*"
80 gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)?.*"
81 gdb_test "ptype vocation" "type = volatile float.*"
82 gdb_test "ptype veracity" "type = volatile double.*"
83
84 gdb_test "ptype vapidity" "type = volatile char.* volatile"
85 gdb_test "ptype velocity" "type = volatile unsigned char.* volatile"
86 gdb_test "ptype veneer" "type = volatile short.* volatile"
87 gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int)?.* volatile"
88 gdb_test "ptype vacuum" "type = volatile long.* volatile"
89 gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)?.* volatile"
90 gdb_test "ptype vitality" "type = volatile float.* volatile"
91 gdb_test "ptype voracity" "type = volatile double.* volatile"
92
93 gdb_test "ptype violent" "type = volatile char \\\[2\\\]"
94 gdb_test "ptype violet" "type = volatile unsigned char \\\[2\\\]"
95 gdb_test "ptype vips" "type = volatile short.* \\\[2\\\]"
96 gdb_test "ptype virgen" "type = volatile unsigned short.* \\\[2\\\]"
97 gdb_test "ptype vulgar" "type = volatile long.* \\\[2\\\]"
98 gdb_test "ptype vulture" "type = volatile (unsigned long|long unsigned)( int)? \\\[2\\\]"
99 gdb_test "ptype vilify" "type = volatile float \\\[2\\\]"
100 gdb_test "ptype villar" "type = volatile double \\\[2\\\]"
101
102 gdb_test "print victor" " = 89 'Y'"
103 gdb_test "ptype victor" "type = const volatile char"
104 gdb_test "ptype victory" "type = const volatile char.*"
105 gdb_test "ptype cavern" "type = const volatile char.* const"
106 gdb_test "ptype caveat" "type = const char.* volatile"
107 gdb_test "ptype covenant" "type = const unsigned char.* volatile"
108 gdb_test "ptype vanadium" "type = const volatile unsigned char.* volatile"
109
110 gdb_test "ptype cove" "type = const char.* const volatile"
111 gdb_test "ptype cavity" "type = const unsigned char.* const volatile"
112 gdb_test "ptype vagus" "type = volatile char.* const volatile"
113 gdb_test "ptype vagrancy" "type = volatile unsigned char.* const volatile"
114 gdb_test "ptype vagary" "type = const volatile char.* const volatile"
115 gdb_test "ptype vendor" "type = const volatile unsigned char.* const volatile"
116 gdb_test "ptype vindictive" "type = const volatile char \\\[2\\\]"
117 gdb_test "ptype vegetation" "type = const volatile unsigned char \\\[2\\\]"
118 }
119
120 do_constvar_tests