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:" \
62 "33:\[\t \]+enum_t;" \
63 "28:\[\t \]+typedef baz_t baz;" \
64 "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
65 "27:\[\t \]+typedef baz_t baz_t;" \
69 "64:\[\t \]+typedef CL my_cl;" \
70 "38:\[\t \]+typedef enum_t my_enum_t;" \
71 "17:\[\t \]+typedef float my_float_t;" \
72 "16:\[\t \]+typedef int my_int_t;" \
73 "65:\[\t \]+typedef CL \\* my_ptr;" \
74 "30:\[\t \]+typedef baz_t nested_baz;" \
75 "29:\[\t \]+typedef baz_t nested_baz_t;" \
76 "39:\[\t \]+typedef enum_t nested_enum_t;" \
77 "19:\[\t \]+typedef float nested_float_t;" \
78 "18:\[\t \]+typedef int nested_int_t;" \
79 "\[\t \]+unsigned int"]
83 "All defined types:" \
86 "28:\[\t \]+typedef struct baz_t baz;" \
87 "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
88 "21:\[\t \]+struct baz_t;" \
90 "33:\[\t \]+enum enum_t;" \
93 "38:\[\t \]+typedef enum enum_t my_enum_t;" \
94 "17:\[\t \]+typedef float my_float_t;" \
95 "16:\[\t \]+typedef int my_int_t;" \
96 "30:\[\t \]+typedef struct baz_t nested_baz;" \
97 "29:\[\t \]+typedef struct baz_t nested_baz_t;" \
98 "39:\[\t \]+typedef enum enum_t nested_enum_t;" \
99 "19:\[\t \]+typedef float nested_float_t;" \
100 "18:\[\t \]+typedef int nested_int_t;" \
101 "\[\t \]+unsigned int" ]
104 gdb_test "info types" $output_re
107 foreach_with_prefix l $lang {