1 # Copyright 2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Check that 'info types' produces the expected output for an inferior
17 # containing a number of different types.
19 # Only test C++ if we are able. Always use C.
20 if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
28 remote_exec host "rm -rf [standard_output_file ${dir}]"
29 remote_exec host "mkdir -p [standard_output_file ${dir}]"
32 # Run 'info types' test, compiling the test file for language LANG,
33 # which should be either 'c' or 'c++'.
34 proc run_test { lang } {
44 if {[prepare_for_testing "failed to prepare" \
45 "${lang}/${testfile}" $srcfile "debug $lang"]} {
49 if ![runto_main] then {
50 fail "can't run to main"
54 if { $lang == "c++" } {
57 "All defined types:" \
61 "42:\[\t \]+anon_struct_t;" \
62 "65:\[\t \]+anon_union_t;" \
64 "33:\[\t \]+enum_t;" \
65 "56:\[\t \]+union_t;" \
66 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
67 "45:\[\t \]+typedef anon_struct_t anon_struct_t;" \
68 "68:\[\t \]+typedef anon_union_t anon_union_t;" \
69 "28:\[\t \]+typedef baz_t baz;" \
70 "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
71 "27:\[\t \]+typedef baz_t baz_t;" \
75 "103:\[\t \]+typedef CL my_cl;" \
76 "38:\[\t \]+typedef enum_t my_enum_t;" \
77 "17:\[\t \]+typedef float my_float_t;" \
78 "16:\[\t \]+typedef int my_int_t;" \
79 "104:\[\t \]+typedef CL \\* my_ptr;" \
80 "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
81 "47:\[\t \]+typedef anon_struct_t nested_anon_struct_t;" \
82 "70:\[\t \]+typedef anon_union_t nested_anon_union_t;" \
83 "30:\[\t \]+typedef baz_t nested_baz;" \
84 "29:\[\t \]+typedef baz_t nested_baz_t;" \
85 "39:\[\t \]+typedef enum_t nested_enum_t;" \
86 "19:\[\t \]+typedef float nested_float_t;" \
87 "18:\[\t \]+typedef int nested_int_t;" \
88 "62:\[\t \]+typedef union_t nested_union_t;" \
89 "\[\t \]+unsigned int"]
93 "All defined types:" \
96 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
97 "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
98 "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
99 "28:\[\t \]+typedef struct baz_t baz;" \
100 "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
101 "21:\[\t \]+struct baz_t;" \
103 "33:\[\t \]+enum enum_t;" \
106 "38:\[\t \]+typedef enum enum_t my_enum_t;" \
107 "17:\[\t \]+typedef float my_float_t;" \
108 "16:\[\t \]+typedef int my_int_t;" \
109 "54:\[\t \]+typedef enum {\\.\\.\\.} nested_anon_enum_t;" \
110 "47:\[\t \]+typedef struct {\\.\\.\\.} nested_anon_struct_t;" \
111 "70:\[\t \]+typedef union {\\.\\.\\.} nested_anon_union_t;" \
112 "30:\[\t \]+typedef struct baz_t nested_baz;" \
113 "29:\[\t \]+typedef struct baz_t nested_baz_t;" \
114 "39:\[\t \]+typedef enum enum_t nested_enum_t;" \
115 "19:\[\t \]+typedef float nested_float_t;" \
116 "18:\[\t \]+typedef int nested_int_t;" \
117 "62:\[\t \]+typedef union union_t nested_union_t;" \
118 "56:\[\t \]+union union_t;" \
119 "\[\t \]+unsigned int" ]
122 gdb_test "info types" $output_re
125 foreach_with_prefix l $lang {