]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/ctf-constvars.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / ctf-constvars.exp
CommitLineData
213516ef 1# Copyright 2019-2023 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
27if [skip_ctf_tests] {
1776e3e5 28 unsupported "no CTF debug format support, or CTF disabled in GDB"
30d0a636
AB
29 return 0
30}
30d1f018
WP
31
32standard_testfile .c
30d1f018 33
ffb3f587 34# Using `-gctf` generates full-fledged CTF debug information.
908a926e
TV
35set opts {}
36lappend opts additional_flags=-gctf
37lappend opts ldflags=-Wl,--strip-debug
38lappend opts ldflags=-Wl,--ctf-variables
39lappend opts nowarnings
40
30d1f018 41if { [prepare_for_testing "failed to prepare" ${testfile} \
908a926e 42 [list $srcfile] $opts] } {
30d1f018
WP
43 return 0
44}
45
46#
47# set it up at a breakpoint so we can play with the variable values
48#
65a33d75 49if {![runto_main]} {
cdd42066 50 return
30d1f018
WP
51}
52
53# test vars and pointers
54
55proc do_constvar_tests {} {
56 gdb_test "print vox" " = 66 'B'"
57 gdb_test "ptype vox" "type = volatile char"
58 gdb_test "print victuals" " = 67 'C'"
59 gdb_test "ptype victuals" "type = volatile unsigned char"
60 gdb_test "print vixen" " = 200"
61 gdb_test "ptype vixen" "type = volatile short.*"
62 gdb_test "print vitriol" " = 300"
63 gdb_test "ptype vitriol" "type = volatile (unsigned short|short unsigned)( int)?"
64 gdb_test "print vellum" " = 1000"
65 gdb_test "ptype vellum" "type = volatile long.*"
66 gdb_test "print valve" " = 2000"
67 gdb_test "ptype valve" "type = volatile (unsigned long|long unsigned)( int)?"
68 gdb_test "print vacuity" " = 3"
69 gdb_test "ptype vacuity" "type = volatile float"
70 gdb_test "print vertigo" " = 10"
71 gdb_test "ptype vertigo" "type = volatile double"
72 gdb_test "print laconic" " = 65 'A'"
73
74 gdb_test "ptype vampire" "type = volatile char.*"
75 gdb_test "ptype viper" "type = volatile unsigned char.*"
76 gdb_test "ptype vigour" "type = volatile short.*"
77 gdb_test "ptype vapour" "type = volatile (unsigned short|short unsigned)( int)?.*"
78 gdb_test "ptype ventricle" "type = volatile long.*"
79 gdb_test "ptype vigintillion" "type = volatile (unsigned long|long unsigned)( int)?.*"
80 gdb_test "ptype vocation" "type = volatile float.*"
81 gdb_test "ptype veracity" "type = volatile double.*"
82
83 gdb_test "ptype vapidity" "type = volatile char.* volatile"
84 gdb_test "ptype velocity" "type = volatile unsigned char.* volatile"
85 gdb_test "ptype veneer" "type = volatile short.* volatile"
86 gdb_test "ptype video" "type = volatile (unsigned short|short unsigned)( int)?.* volatile"
87 gdb_test "ptype vacuum" "type = volatile long.* volatile"
88 gdb_test "ptype veniality" "type = volatile (unsigned long|long unsigned)( int)?.* volatile"
89 gdb_test "ptype vitality" "type = volatile float.* volatile"
90 gdb_test "ptype voracity" "type = volatile double.* volatile"
91
92 gdb_test "ptype violent" "type = volatile char \\\[2\\\]"
93 gdb_test "ptype violet" "type = volatile unsigned char \\\[2\\\]"
94 gdb_test "ptype vips" "type = volatile short.* \\\[2\\\]"
95 gdb_test "ptype virgen" "type = volatile unsigned short.* \\\[2\\\]"
96 gdb_test "ptype vulgar" "type = volatile long.* \\\[2\\\]"
97 gdb_test "ptype vulture" "type = volatile (unsigned long|long unsigned)( int)? \\\[2\\\]"
98 gdb_test "ptype vilify" "type = volatile float \\\[2\\\]"
99 gdb_test "ptype villar" "type = volatile double \\\[2\\\]"
100
101 gdb_test "print victor" " = 89 'Y'"
102 gdb_test "ptype victor" "type = const volatile char"
103 gdb_test "ptype victory" "type = const volatile char.*"
104 gdb_test "ptype cavern" "type = const volatile char.* const"
105 gdb_test "ptype caveat" "type = const char.* volatile"
106 gdb_test "ptype covenant" "type = const unsigned char.* volatile"
107 gdb_test "ptype vanadium" "type = const volatile unsigned char.* volatile"
108
109 gdb_test "ptype cove" "type = const char.* const volatile"
110 gdb_test "ptype cavity" "type = const unsigned char.* const volatile"
111 gdb_test "ptype vagus" "type = volatile char.* const volatile"
112 gdb_test "ptype vagrancy" "type = volatile unsigned char.* const volatile"
113 gdb_test "ptype vagary" "type = const volatile char.* const volatile"
114 gdb_test "ptype vendor" "type = const volatile unsigned char.* const volatile"
115 gdb_test "ptype vindictive" "type = const volatile char \\\[2\\\]"
116 gdb_test "ptype vegetation" "type = const volatile unsigned char \\\[2\\\]"
117}
118
119do_constvar_tests