Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 2012-2015 Free Software Foundation, Inc. |
bd69fc68 TT |
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 | set nl "\[\r\n\]+" | |
17 | ||
18 | if { [skip_cplus_tests] } { continue } | |
19 | ||
20 | load_lib "cp-support.exp" | |
21 | ||
22 | standard_testfile .cc | |
23 | ||
24 | if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { | |
25 | return -1 | |
26 | } | |
27 | ||
28 | if ![runto_main] then { | |
29 | perror "couldn't run to breakpoint" | |
30 | return | |
31 | } | |
32 | ||
33 | gdb_test_no_output "set language c++" "" | |
34 | gdb_test_no_output "set width 0" "" | |
35 | ||
36 | proc do_check {name {flags ""} {show_typedefs 1} {show_methods 1} {raw 0}} { | |
37 | set contents { | |
38 | { base "public Base<T>" } | |
39 | { field public "Simple<T> t;" } | |
40 | { field public "Simple<T*> tstar;" } | |
41 | } | |
42 | ||
43 | if {$raw} { | |
44 | lappend contents { field public "Holder<int>::Z z;" } | |
45 | } else { | |
46 | lappend contents { field public "Z z;" } | |
47 | } | |
48 | ||
49 | if {$show_typedefs} { | |
50 | lappend contents { typedef public "typedef Simple<Simple<T> > Z;" } | |
51 | } | |
52 | ||
53 | if {$show_methods} { | |
54 | lappend contents { method public "double method();" } | |
55 | } | |
56 | ||
57 | if {$raw} { | |
58 | regsub -all -- "T" $contents "int" contents | |
59 | } | |
60 | ||
61 | cp_test_ptype_class value $name "class" "Holder<int>" $contents \ | |
62 | "" {} $flags | |
63 | } | |
64 | ||
65 | do_check "basic test" | |
66 | do_check "no methods" "/m" 1 0 | |
67 | do_check "no typedefs" "/t" 0 1 | |
68 | do_check "no methods or typedefs" "/mt" 0 0 | |
69 | ||
70 | do_check "raw" "/r" 1 1 1 | |
71 | do_check "raw no methods" "/rm" 1 0 1 | |
72 | do_check "raw no typedefs" "/rt" 0 1 1 | |
73 | do_check "raw no methods or typedefs" "/rmt" 0 0 1 | |
74 | ||
75 | gdb_test_no_output "set print type methods off" | |
76 | do_check "basic test, default methods off" "" 1 0 | |
77 | do_check "methods, default methods off" "/M" 1 1 | |
78 | do_check "no typedefs, default methods off" "/t" 0 0 | |
79 | do_check "methods, no typedefs, default methods off" "/Mt" 0 1 | |
80 | ||
81 | gdb_test_no_output "set print type typedefs off" | |
82 | do_check "basic test, default methods+typedefs off" "" 0 0 | |
83 | do_check "methods, default methods+typedefs off" "/M" 0 1 | |
84 | do_check "typedefs, default methods+typedefs off" "/T" 1 0 | |
85 | do_check "methods typedefs, default methods+typedefs off" "/MT" 1 1 |