]>
Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2019-2020 Free Software Foundation, Inc. |
30d1f018 WP |
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 | # | |
30d0a636 AB |
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" | |
29 | return 0 | |
30 | } | |
30d1f018 WP |
31 | |
32 | standard_testfile .c | |
30d1f018 | 33 | |
30d0a636 AB |
34 | # Using `-gt` generates full-fledged CTF debug information. |
35 | set opts "additional_flags=-gt" | |
30d1f018 WP |
36 | if { [prepare_for_testing "failed to prepare" ${testfile} \ |
37 | [list $srcfile] [list $opts nowarnings]] } { | |
38 | return 0 | |
39 | } | |
40 | ||
41 | # | |
42 | # set it up at a breakpoint so we can play with the variable values | |
43 | # | |
44 | if ![runto_main] then { | |
45 | perror "couldn't run to breakpoint" | |
46 | continue | |
47 | } | |
48 | ||
49 | # test vars and pointers | |
50 | ||
51 | proc do_constvar_tests {} { | |
52 | gdb_test "print vox" " = 66 'B'" | |
53 | gdb_test "ptype vox" "type = volatile char" | |
54 | gdb_test "print victuals" " = 67 'C'" | |
55 | gdb_test "ptype victuals" "type = volatile unsigned char" | |
56 | gdb_test "print vixen" " = 200" | |
57 | gdb_test "ptype vixen" "type = volatile short.*" | |
58 | gdb_test "print vitriol" " = 300" | |
59 | gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?" | |
60 | gdb_test "print vellum" " = 1000" | |
61 | gdb_test "ptype vellum" "type = volatile long.*" | |
62 | gdb_test "print valve" " = 2000" | |
63 | gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?" | |
64 | gdb_test "print vacuity" " = 3" | |
65 | gdb_test "ptype vacuity" "type = volatile float" | |
66 | gdb_test "print vertigo" " = 10" | |
67 | gdb_test "ptype vertigo" "type = volatile double" | |
68 | gdb_test "print laconic" " = 65 'A'" | |
69 | ||
70 | gdb_test "ptype vampire" "type = volatile char.*" | |
71 | gdb_test "ptype viper" "type = volatile unsigned char.*" | |
72 | gdb_test "ptype vigour" "type = volatile short.*" | |
73 | gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)?.*" | |
74 | gdb_test "ptype ventricle" "type = volatile long.*" | |
75 | gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)?.*" | |
76 | gdb_test "ptype vocation" "type = volatile float.*" | |
77 | gdb_test "ptype veracity" "type = volatile double.*" | |
78 | ||
79 | gdb_test "ptype vapidity" "type = volatile char.* volatile" | |
80 | gdb_test "ptype velocity" "type = volatile unsigned char.* volatile" | |
81 | gdb_test "ptype veneer" "type = volatile short.* volatile" | |
82 | gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int)?.* volatile" | |
83 | gdb_test "ptype vacuum" "type = volatile long.* volatile" | |
84 | gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)?.* volatile" | |
85 | gdb_test "ptype vitality" "type = volatile float.* volatile" | |
86 | gdb_test "ptype voracity" "type = volatile double.* volatile" | |
87 | ||
88 | gdb_test "ptype violent" "type = volatile char \\\[2\\\]" | |
89 | gdb_test "ptype violet" "type = volatile unsigned char \\\[2\\\]" | |
90 | gdb_test "ptype vips" "type = volatile short.* \\\[2\\\]" | |
91 | gdb_test "ptype virgen" "type = volatile unsigned short.* \\\[2\\\]" | |
92 | gdb_test "ptype vulgar" "type = volatile long.* \\\[2\\\]" | |
93 | gdb_test "ptype vulture" "type = volatile (unsigned long|long unsigned)( int)? \\\[2\\\]" | |
94 | gdb_test "ptype vilify" "type = volatile float \\\[2\\\]" | |
95 | gdb_test "ptype villar" "type = volatile double \\\[2\\\]" | |
96 | ||
97 | gdb_test "print victor" " = 89 'Y'" | |
98 | gdb_test "ptype victor" "type = const volatile char" | |
99 | gdb_test "ptype victory" "type = const volatile char.*" | |
100 | gdb_test "ptype cavern" "type = const volatile char.* const" | |
101 | gdb_test "ptype caveat" "type = const char.* volatile" | |
102 | gdb_test "ptype covenant" "type = const unsigned char.* volatile" | |
103 | gdb_test "ptype vanadium" "type = const volatile unsigned char.* volatile" | |
104 | ||
105 | gdb_test "ptype cove" "type = const char.* const volatile" | |
106 | gdb_test "ptype cavity" "type = const unsigned char.* const volatile" | |
107 | gdb_test "ptype vagus" "type = volatile char.* const volatile" | |
108 | gdb_test "ptype vagrancy" "type = volatile unsigned char.* const volatile" | |
109 | gdb_test "ptype vagary" "type = const volatile char.* const volatile" | |
110 | gdb_test "ptype vendor" "type = const volatile unsigned char.* const volatile" | |
111 | gdb_test "ptype vindictive" "type = const volatile char \\\[2\\\]" | |
112 | gdb_test "ptype vegetation" "type = const volatile unsigned char \\\[2\\\]" | |
113 | } | |
114 | ||
115 | do_constvar_tests |