Switch the license of all .exp files to GPLv3.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / gdb792.exp
CommitLineData
6aba47ca 1# Copyright 2002, 2003, 2007 Free Software Foundation, Inc.
f80a3b5f
JJ
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
f80a3b5f 6# (at your option) any later version.
e22f8b7c 7#
f80a3b5f
JJ
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.
e22f8b7c 12#
f80a3b5f 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
f80a3b5f
JJ
15
16# Please email any bugs, comments, and/or additions to this file to:
17# bug-gdb@prep.ai.mit.edu
18
19#
20# test gdb/792
21#
22
a66624bc
AC
23if { [skip_cplus_tests] } { continue }
24
f80a3b5f
JJ
25load_lib mi-support.exp
26set MIFLAGS "-i=mi"
27
28gdb_exit
29if [mi_gdb_start] {
30 continue
31}
32
33set testfile gdb792
34set srcfile "$testfile.cc"
35set binfile $objdir/$subdir/$testfile
36
37if [get_compiler_info ${binfile} "c++"] {
38 return -1;
39}
40
41if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
b60f0898
JB
42 untested gdb792.exp
43 return -1
f80a3b5f
JJ
44}
45
46# Test that children of classes are properly reported
47
48# Run to main
49mi_run_to_main
50
51mi_gdb_test "-var-create - * a" \
43343e8b 52 "(&\".*\"\r\n)*\\^done,name=\"var1\",numchild=\"3\",value=\".*\",type=\"A\"" \
f80a3b5f
JJ
53 "create var for class A"
54
55mi_gdb_test "-var-list-children var1" \
e7494ffb 56 "(&\".*\"\r\n)*\\^done,numchild=\"3\",children=\\\[child=\{name=\"var1\.public\",exp=\"public\",numchild=\"2\"\},child=\{name=\"var1\.private\",exp=\"private\",numchild=\"2\"\},child=\{name=\"var1\.protected\",exp=\"protected\",numchild=\"2\"\}\\\]" \
f80a3b5f
JJ
57 "list children of class A"
58
59mi_gdb_test "-var-list-children var1.public" \
e7494ffb 60 "(&\".*\"\r\n)*\\^done,numchild=\"2\",children=\\\[child=\{name=\"var1\.public\.x\",exp=\"x\",numchild=\"0\",type=\"int\"\},child=\{name=\"var1\.public\.buffer\",exp=\"buffer\",numchild=\"10\",type=\"char \\\[10\\\]\"\}\\\]" \
f80a3b5f
JJ
61 "list children of A.public"
62
63mi_gdb_test "-var-list-children var1.private" \
e7494ffb 64 "(&\".*\"\r\n)*\\^done,numchild=\"2\",children=\\\[child=\{name=\"var1\.private\.u\",exp=\"u\",numchild=\"0\",type=\"int\"\},child=\{name=\"var1\.private\.z\",exp=\"z\",numchild=\"0\",type=\"float\"\}\\\]" \
f80a3b5f
JJ
65 "list children of A.private"
66
67mi_gdb_test "-var-list-children var1.protected" \
e7494ffb 68 "(&\".*\"\r\n)*\\^done,numchild=\"2\",children=\\\[child=\{name=\"var1\.protected\.y\",exp=\"y\",numchild=\"0\",type=\"int\"\},child=\{name=\"var1\.protected\.b\",exp=\"b\",numchild=\"2\",type=\"B\"\}\\\]" \
f80a3b5f
JJ
69 "list children of A.protected"
70
71mi_gdb_test "-var-list-children var1.protected.b" \
e7494ffb 72 "(&\".*\"\r\n)*\\^done,numchild=\"2\",children=\\\[child=\{name=\"var1\.protected\.b\.public\",exp=\"public\",numchild=\"2\"\},child=\{name=\"var1\.protected\.b\.private\",exp=\"private\",numchild=\"1\"\}\\\]" \
f80a3b5f
JJ
73 "list children of A.protected.b"
74
75mi_gdb_test "-var-list-children var1.protected.b.public" \
e7494ffb 76 "(&\".*\"\r\n)*\\^done,numchild=\"2\",children=\\\[child=\{name=\"var1\.protected\.b\.public\.bx\",exp=\"bx\",numchild=\"0\",type=\"int\"\},child=\{name=\"var1\.protected\.b\.public\.by\",exp=\"by\",numchild=\"0\",type=\"int\"\}\\\]" \
f80a3b5f
JJ
77 "list children of A.protected.b.public"
78
79mi_gdb_test "-var-list-children var1.protected.b.private" \
e7494ffb 80 "(&\".*\"\r\n)*\\^done,numchild=\"1\",children=\\\[child=\{name=\"var1\.protected\.b\.private\.k\",exp=\"k\",numchild=\"0\",type=\"int\"\}\\\]" \
f80a3b5f
JJ
81 "list children of A.protected.b.private"
82
83mi_gdb_test "-var-create - * c" \
43343e8b 84 "(&\".*\"\r\n)*\\^done,name=\"var2\",numchild=\"3\",value=\".*\",type=\"C\"" \
f80a3b5f
JJ
85 "create var for class C which has baseclass A"
86
87mi_gdb_test "-var-list-children var2" \
e7494ffb 88 "(&\".*\"\r\n)*\\^done,numchild=\"3\",children=\\\[child=\{name=\"var2\.A\",exp=\"A\",numchild=\"3\",type=\"A\"\},child=\{name=\"var2\.public\",exp=\"public\",numchild=\"1\"\},child=\{name=\"var2\.private\",exp=\"private\",numchild=\"1\"\}\\\]" \
f80a3b5f
JJ
89 "list children of class C"
90
91mi_gdb_exit
92return 0
This page took 0.524566 seconds and 4 git commands to generate.