1 # Copyright 2019-2021 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 # Run 'info types' test, compiling the test file for language LANG,
20 # which should be either 'c' or 'c++'.
21 proc run_test
{ lang
} {
29 standard_testfile info-types.c
31 if {[prepare_for_testing
"failed to prepare" \
32 "${testfile}" $srcfile "debug $lang"]} {
36 if ![runto_main
] then
{
37 fail
"can't run to main"
41 if { $lang == "c++" } {
45 "42:\[\t \]+anon_struct_t;" \
46 "65:\[\t \]+anon_union_t;" \
48 "33:\[\t \]+enum_t;" \
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;" \
53 "28:\[\t \]+typedef baz_t baz;" \
54 "31:\[\t \]+typedef baz_t \\* baz_ptr;" \
55 "27:\[\t \]+typedef baz_t baz_t;" \
59 "103:\[\t \]+typedef CL my_cl;" \
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;" \
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;" \
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;" \
72 "62:\[\t \]+typedef union_t nested_union_t;(" \
73 "\[\t \]+unsigned int)?"]
77 "52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
78 "45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
79 "68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
80 "28:\[\t \]+typedef struct baz_t baz;" \
81 "31:\[\t \]+typedef struct baz_t \\* baz_ptr;" \
82 "21:\[\t \]+struct baz_t;" \
84 "33:\[\t \]+enum enum_t;" \
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;" \
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;" \
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;" \
98 "62:\[\t \]+typedef union union_t nested_union_t;" \
99 "56:\[\t \]+union union_t;(" \
100 "\[\t \]+unsigned int)?"]
104 gdb_test_multiple
"info types" "" {
105 -re "\r\nAll defined types:" {
106 if { $state == 0 } { set state
1 }
109 -re "\r\n\r\nFile .*[string_to_regexp $srcfile]:" {
110 if { $state == 1 } { set state
2 }
114 if { $state == 2 } { set state
3 }
117 -re "\r\n\r\nFile \[^\r\n\]*:" {