]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/ptype-flags.exp
update copyright year range in GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / ptype-flags.exp
CommitLineData
61baf725 1# Copyright 2012-2017 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
16set nl "\[\r\n\]+"
17
18if { [skip_cplus_tests] } { continue }
19
20load_lib "cp-support.exp"
21
22standard_testfile .cc
23
5b362f04 24if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
bd69fc68
TT
25 return -1
26}
27
28if ![runto_main] then {
29 perror "couldn't run to breakpoint"
30 return
31}
32
33gdb_test_no_output "set language c++" ""
34gdb_test_no_output "set width 0" ""
35
36proc 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
65do_check "basic test"
66do_check "no methods" "/m" 1 0
67do_check "no typedefs" "/t" 0 1
68do_check "no methods or typedefs" "/mt" 0 0
69
70do_check "raw" "/r" 1 1 1
71do_check "raw no methods" "/rm" 1 0 1
72do_check "raw no typedefs" "/rt" 0 1 1
73do_check "raw no methods or typedefs" "/rmt" 0 0 1
74
75gdb_test_no_output "set print type methods off"
76do_check "basic test, default methods off" "" 1 0
77do_check "methods, default methods off" "/M" 1 1
78do_check "no typedefs, default methods off" "/t" 0 0
79do_check "methods, no typedefs, default methods off" "/Mt" 0 1
80
81gdb_test_no_output "set print type typedefs off"
82do_check "basic test, default methods+typedefs off" "" 0 0
83do_check "methods, default methods+typedefs off" "/M" 0 1
84do_check "typedefs, default methods+typedefs off" "/T" 1 0
85do_check "methods typedefs, default methods+typedefs off" "/MT" 1 1