gdb/testsuite: Revert commit 843f4d93576eef02139f7b1b3fa1cea7b0f286f1
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / info-types.exp.in
CommitLineData
b811d2c2 1# Copyright 2019-2020 Free Software Foundation, Inc.
eb86c5e2
AB
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
eb86c5e2
AB
19# Run 'info types' test, compiling the test file for language LANG,
20# which should be either 'c' or 'c++'.
21proc run_test { lang } {
22 global testfile
23 global srcfile
24 global binfile
25 global subdir
26 global srcdir
27 global compile_flags
28
971a3747 29 standard_testfile info-types.c
eb86c5e2
AB
30
31 if {[prepare_for_testing "failed to prepare" \
971a3747 32 "${testfile}" $srcfile "debug $lang"]} {
eb86c5e2
AB
33 return -1
34 }
35
36 if ![runto_main] then {
37 fail "can't run to main"
38 return 0
39 }
40
41 if { $lang == "c++" } {
42 set output_re \
43 [multi_line \
a8e9d247
AB
44 "98:\[\t \]+CL;" \
45 "42:\[\t \]+anon_struct_t;" \
46 "65:\[\t \]+anon_union_t;" \
eb86c5e2
AB
47 "21:\[\t \]+baz_t;" \
48 "33:\[\t \]+enum_t;" \
a8e9d247
AB
49 "56:\[\t \]+union_t;" \
50 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
51 "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \
52 "68:\[\t \]+typedef anon_union_t anon_union_t;" \
eb86c5e2
AB
53 "28:\[\t \]+typedef baz_t baz;" \
54 "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
55 "27:\[\t \]+typedef baz_t baz_t;" \
56 "\[\t \]+double" \
57 "\[\t \]+float" \
58 "\[\t \]+int" \
a8e9d247 59 "103:\[\t \]+typedef CL my_cl;" \
eb86c5e2
AB
60 "38:\[\t \]+typedef enum_t my_enum_t;" \
61 "17:\[\t \]+typedef float my_float_t;" \
62 "16:\[\t \]+typedef int my_int_t;" \
a8e9d247
AB
63 "104:\[\t \]+typedef CL \\* my_ptr;" \
64 "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
65 "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \
66 "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \
eb86c5e2
AB
67 "30:\[\t \]+typedef baz_t nested_baz;" \
68 "29:\[\t \]+typedef baz_t nested_baz_t;" \
69 "39:\[\t \]+typedef enum_t nested_enum_t;" \
70 "19:\[\t \]+typedef float nested_float_t;" \
71 "18:\[\t \]+typedef int nested_int_t;" \
42275044 72 "62:\[\t \]+typedef union_t nested_union_t;(" \
09252140 73 "\[\t \]+unsigned int)?"]
eb86c5e2
AB
74 } else {
75 set output_re \
76 [multi_line \
a8e9d247
AB
77 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
78 "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
79 "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
eb86c5e2
AB
80 "28:\[\t \]+typedef struct baz_t baz;" \
81 "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
82 "21:\[\t \]+struct baz_t;" \
83 "\[\t \]+double" \
84 "33:\[\t \]+enum enum_t;" \
85 "\[\t \]+float" \
86 "\[\t \]+int" \
87 "38:\[\t \]+typedef enum enum_t my_enum_t;" \
88 "17:\[\t \]+typedef float my_float_t;" \
89 "16:\[\t \]+typedef int my_int_t;" \
a8e9d247
AB
90 "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
91 "47:\[\t \]+typedef struct {\\.\\.\\.} nested_anon_struct_t;" \
92 "70:\[\t \]+typedef union {\\.\\.\\.} nested_anon_union_t;" \
eb86c5e2
AB
93 "30:\[\t \]+typedef struct baz_t nested_baz;" \
94 "29:\[\t \]+typedef struct baz_t nested_baz_t;" \
95 "39:\[\t \]+typedef enum enum_t nested_enum_t;" \
96 "19:\[\t \]+typedef float nested_float_t;" \
97 "18:\[\t \]+typedef int nested_int_t;" \
a8e9d247 98 "62:\[\t \]+typedef union union_t nested_union_t;" \
42275044 99 "56:\[\t \]+union union_t;(" \
09252140 100 "\[\t \]+unsigned int)?"]
eb86c5e2
AB
101 }
102
09252140
TV
103 set state 0
104 gdb_test_multiple "info types" "" {
105 -re "\r\nAll defined types:" {
106 if { $state == 0 } { set state 1 }
107 exp_continue
108 }
109 -re "\r\n\r\nFile .*[string_to_regexp $srcfile]:" {
110 if { $state == 1 } { set state 2 }
111 exp_continue
112 }
113 -re $output_re {
114 if { $state == 2 } { set state 3 }
115 exp_continue
116 }
117 -re "\r\n\r\nFile \[^\r\n\]*:" {
118 exp_continue
119 }
120 -re -wrap "" {
121 if { $state == 3} {
122 pass $gdb_test_name
123 } else {
124 fail $gdb_test_name
125 }
126 }
127 }
eb86c5e2
AB
128}
129
971a3747 130run_test $lang
This page took 0.151335 seconds and 4 git commands to generate.