Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / info-types.exp.tcl
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 # Check that 'info types' produces the expected output for an inferior
17 # containing a number of different types.
18
19 # Run 'info types' test, compiling the test file for language LANG,
20 # which should be either 'c' or 'c++'.
21 proc run_test { lang } {
22 global testfile
23 global srcfile
24 global binfile
25 global subdir
26 global srcdir
27 global compile_flags
28
29 standard_testfile info-types.c
30
31 if {[prepare_for_testing "failed to prepare" \
32 "${testfile}" $srcfile "debug $lang"]} {
33 return -1
34 }
35
36 if ![runto_main] then {
37 fail "can't run to main"
38 return 0
39 }
40
41 set file_re "File .*[string_to_regexp $srcfile]:"
42
43 if { $lang == "c++" } {
44 set output_lines \
45 [list \
46 "^All defined types:" \
47 ".*" \
48 $file_re \
49 "98:\[\t \]+CL;" \
50 "42:\[\t \]+anon_struct_t;" \
51 "65:\[\t \]+anon_union_t;" \
52 "21:\[\t \]+baz_t;" \
53 "33:\[\t \]+enum_t;" \
54 "56:\[\t \]+union_t;" \
55 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
56 "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \
57 "68:\[\t \]+typedef anon_union_t anon_union_t;" \
58 "28:\[\t \]+typedef baz_t baz;" \
59 "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
60 "27:\[\t \]+typedef baz_t baz_t;" \
61 "\[\t \]+double" \
62 "\[\t \]+float" \
63 "\[\t \]+int" \
64 "103:\[\t \]+typedef CL my_cl;" \
65 "38:\[\t \]+typedef enum_t my_enum_t;" \
66 "17:\[\t \]+typedef float my_float_t;" \
67 "16:\[\t \]+typedef int my_int_t;" \
68 "104:\[\t \]+typedef CL \\* my_ptr;" \
69 "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
70 "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \
71 "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \
72 "30:\[\t \]+typedef baz_t nested_baz;" \
73 "29:\[\t \]+typedef baz_t nested_baz_t;" \
74 "39:\[\t \]+typedef enum_t nested_enum_t;" \
75 "19:\[\t \]+typedef float nested_float_t;" \
76 "18:\[\t \]+typedef int nested_int_t;" \
77 "62:\[\t \]+typedef union_t nested_union_t;(" \
78 "\[\t \]+unsigned int)?" \
79 "($|\r\n.*)"]
80 } else {
81 set output_lines \
82 [list \
83 "^All defined types:" \
84 ".*" \
85 $file_re \
86 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
87 "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
88 "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
89 "28:\[\t \]+typedef struct baz_t baz;" \
90 "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
91 "21:\[\t \]+struct baz_t;" \
92 "\[\t \]+double" \
93 "33:\[\t \]+enum enum_t;" \
94 "\[\t \]+float" \
95 "\[\t \]+int" \
96 "38:\[\t \]+typedef enum enum_t my_enum_t;" \
97 "17:\[\t \]+typedef float my_float_t;" \
98 "16:\[\t \]+typedef int my_int_t;" \
99 "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
100 "47:\[\t \]+typedef struct {\\.\\.\\.} nested_anon_struct_t;" \
101 "70:\[\t \]+typedef union {\\.\\.\\.} nested_anon_union_t;" \
102 "30:\[\t \]+typedef struct baz_t nested_baz;" \
103 "29:\[\t \]+typedef struct baz_t nested_baz_t;" \
104 "39:\[\t \]+typedef enum enum_t nested_enum_t;" \
105 "19:\[\t \]+typedef float nested_float_t;" \
106 "18:\[\t \]+typedef int nested_int_t;" \
107 "62:\[\t \]+typedef union union_t nested_union_t;" \
108 "56:\[\t \]+union union_t;(" \
109 "\[\t \]+unsigned int)?" \
110 "($|\r\n.*)"]
111 }
112
113 gdb_test_lines "info types" "" [multi_line {*}$output_lines]
114 }
115
116 run_test $lang
This page took 0.033187 seconds and 4 git commands to generate.