* gdb.mi/mi-var-cp.cc (reference_update_tests):
[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
5# the Free Software Foundation; either version 2 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, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20#
21# test gdb/792
22#
23
a66624bc
AC
24if { [skip_cplus_tests] } { continue }
25
f80a3b5f
JJ
26load_lib mi-support.exp
27set MIFLAGS "-i=mi"
28
29gdb_exit
30if [mi_gdb_start] {
31 continue
32}
33
34set testfile gdb792
35set srcfile "$testfile.cc"
36set binfile $objdir/$subdir/$testfile
37
38if [get_compiler_info ${binfile} "c++"] {
39 return -1;
40}
41
42if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
b60f0898
JB
43 untested gdb792.exp
44 return -1
f80a3b5f
JJ
45}
46
47# Test that children of classes are properly reported
48
49# Run to main
50mi_run_to_main
51
52mi_gdb_test "-var-create - * a" \
53 "(&\".*\"\r\n)*\\^done,name=\"var1\",numchild=\"3\",type=\"A\"" \
54 "create var for class A"
55
56mi_gdb_test "-var-list-children var1" \
e7494ffb 57 "(&\".*\"\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
58 "list children of class A"
59
60mi_gdb_test "-var-list-children var1.public" \
e7494ffb 61 "(&\".*\"\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
62 "list children of A.public"
63
64mi_gdb_test "-var-list-children var1.private" \
e7494ffb 65 "(&\".*\"\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
66 "list children of A.private"
67
68mi_gdb_test "-var-list-children var1.protected" \
e7494ffb 69 "(&\".*\"\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
70 "list children of A.protected"
71
72mi_gdb_test "-var-list-children var1.protected.b" \
e7494ffb 73 "(&\".*\"\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
74 "list children of A.protected.b"
75
76mi_gdb_test "-var-list-children var1.protected.b.public" \
e7494ffb 77 "(&\".*\"\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
78 "list children of A.protected.b.public"
79
80mi_gdb_test "-var-list-children var1.protected.b.private" \
e7494ffb 81 "(&\".*\"\r\n)*\\^done,numchild=\"1\",children=\\\[child=\{name=\"var1\.protected\.b\.private\.k\",exp=\"k\",numchild=\"0\",type=\"int\"\}\\\]" \
f80a3b5f
JJ
82 "list children of A.protected.b.private"
83
84mi_gdb_test "-var-create - * c" \
85 "(&\".*\"\r\n)*\\^done,name=\"var2\",numchild=\"3\",type=\"C\"" \
86 "create var for class C which has baseclass A"
87
88mi_gdb_test "-var-list-children var2" \
e7494ffb 89 "(&\".*\"\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
90 "list children of class C"
91
92mi_gdb_exit
93return 0
This page took 0.474234 seconds and 4 git commands to generate.