1 # Copyright
2012-2022 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
/>.
18 if { [skip_cplus_tests
] } { continue }
20 load_lib
"cp-support.exp"
24 if {[prepare_for_testing
"failed to prepare" $testfile $srcfile {debug c++}]} {
28 if ![runto_main
] then {
29 perror
"couldn't run to breakpoint"
33 gdb_test_no_output
"set language c++" ""
34 gdb_test_no_output
"set width 0" ""
36 proc do_check_holder
{name {flags
""} {show_typedefs 1} {show_methods 1}
40 { base
"public Base<T>" }
41 { field public
"Simple<T> t;" }
42 { field public
"Simple<T*> tstar;" }
46 lappend contents
{ field public
"Holder<int>::Z z;" }
48 lappend contents
{ field public
"Z z;" }
52 lappend contents
{ typedef public
"typedef Simple<Simple<T> > Z;" }
56 lappend contents
{ method public
"double method();" }
60 regsub
-all
-- "T" $contents "int" contents
63 cp_test_ptype_class value $
name "class" "Holder<int>" $contents \
67 proc do_check_typedef_holder
{name {flags
""} {show_typedefs 1} {show_methods 1}
71 { field public
"double a;" }
72 { field public
"ns::scoped_double b;" }
73 { field public
"global_double c;" }
77 lappend contents
{ typedef private
"typedef double class_double;" }
81 lappend contents
{ method private
"double method1(ns::scoped_double);" }
82 lappend contents
{ method private
"double method2(global_double);" }
86 lappend contents
{ field private
"TypedefHolder::class_double d;" }
88 lappend contents
{ field private
"class_double d;" }
91 cp_test_ptype_class value2 $
name "class" "TypedefHolder" $contents \
95 do_check_holder
"basic test"
96 do_check_holder
"no methods" "/m" 1 0
97 do_check_holder
"no typedefs" "/t" 0 1
98 do_check_holder
"no methods or typedefs" "/mt" 0 0
99 do_check_typedef_holder
"typdefs class: basic test"
100 do_check_typedef_holder
"typdefs class: no methods" "/m" 1 0
101 do_check_typedef_holder
"typdefs class: no typedefs" "/t" 0 1 0
102 do_check_typedef_holder
"typdefs class:no methods or typedefs" "/mt" 0 0
104 do_check_holder
"raw" "/r" 1 1 1
105 do_check_holder
"raw no methods" "/rm" 1 0 1
106 do_check_holder
"raw no typedefs" "/rt" 0 1 1
107 do_check_holder
"raw no methods or typedefs" "/rmt" 0 0 1
108 do_check_typedef_holder
"typedef class: raw" "/r" 1 1 1
109 do_check_typedef_holder
"typedef class: raw no methods" "/rm" 1 0 1
110 do_check_typedef_holder
"typedef class: raw no typedefs" "/rt" 0 1 1
111 do_check_typedef_holder
"typedef class: raw no methods or typedefs" "/rmt" 0 0 1
113 gdb_test_no_output
"set print type methods off"
114 do_check_holder
"basic test, default methods off" "" 1 0
115 do_check_holder
"methods, default methods off" "/M" 1 1
116 do_check_holder
"no typedefs, default methods off" "/t" 0 0
117 do_check_holder
"methods, no typedefs, default methods off" "/Mt" 0 1
118 do_check_typedef_holder \
119 "typedef class: basic test, default methods off" "" 1 0
120 do_check_typedef_holder \
121 "typedef class: methods, default methods off" "/M" 1 1
122 do_check_typedef_holder \
123 "typedef class: no typedefs, default methods off" "/t" 0 0
124 do_check_typedef_holder \
125 "typedef class: methods, no typedefs, default methods off" "/Mt" 0 1
127 gdb_test_no_output
"set print type typedefs off"
128 do_check_holder
"basic test, default methods+typedefs off" "" 0 0
129 do_check_holder
"methods, default methods+typedefs off" "/M" 0 1
130 do_check_holder
"typedefs, default methods+typedefs off" "/T" 1 0
131 do_check_holder
"methods typedefs, default methods+typedefs off" "/MT" 1 1
132 do_check_typedef_holder \
133 "typedef class: basic test, default methods+typedefs off" "" 0 0
134 do_check_typedef_holder \
135 "typedef class: methods, default methods+typedefs off" "/M" 0 1
136 do_check_typedef_holder \
137 "typedef class: typedefs, default methods+typedefs off" "/T" 1 0
138 do_check_typedef_holder \
139 "typedef class: methods typedefs, default methods+typedefs off" "/MT" 1 1