gdb/
[binutils-gdb.git] / gdb / testsuite / gdb.mi / gdb792.exp
1 # Copyright 2002, 2003, 2007, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 #
18 # test gdb/792
19 #
20
21 if { [skip_cplus_tests] } { continue }
22
23 load_lib mi-support.exp
24 set MIFLAGS "-i=mi"
25
26 gdb_exit
27 if [mi_gdb_start] {
28 continue
29 }
30
31 set testfile gdb792
32 set srcfile "$testfile.cc"
33 set binfile $objdir/$subdir/$testfile
34
35 if [get_compiler_info ${binfile} "c++"] {
36 return -1;
37 }
38
39 if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
40 untested gdb792.exp
41 return -1
42 }
43
44 # Test that children of classes are properly reported
45
46 # Run to main
47 mi_run_to_main
48
49 mi_create_varobj "var1" "a" "create var for class A"
50
51 mi_list_varobj_children "var1" {
52 {var1.public public 2}
53 {var1.private private 2}
54 {var1.protected protected 2}
55 } "list children of class A"
56
57 mi_list_varobj_children "var1.public" {
58 {var1.public.x x 0 int}
59 {var1.public.buffer buffer 10 {char \[10\]}}
60 } "list children of A.public"
61
62 mi_list_varobj_children "var1.private" {
63 {var1.private.u u 0 int}
64 {var1.private.z z 0 float}
65 } "list children of A.private"
66
67 mi_list_varobj_children "var1.protected" {
68 {var1.protected.y y 0 int}
69 {var1.protected.b b 2 B}
70 } "list children of A.protected"
71
72 mi_list_varobj_children "var1.protected.b" {
73 {var1.protected.b.public public 2}
74 {var1.protected.b.private private 1}
75 } "list children of A.protected.b"
76
77 mi_list_varobj_children "var1.protected.b.public" {
78 {var1.protected.b.public.bx bx 0 int}
79 {var1.protected.b.public.by by 0 int}
80 } "list children of A.protected.b.public"
81
82 mi_list_varobj_children "var1.protected.b.private" {
83 {var1.protected.b.private.k k 0 int}
84 } "list children of A.protected.b.private"
85
86 mi_create_varobj "var2" "c" "create var for class C which has baseclass A"
87
88 mi_list_varobj_children "var2" {
89 {var2.A A 3 A}
90 {var2.public public 1}
91 {var2.private private 1}
92 } "list children of class C"
93
94 mi_gdb_exit
95 return 0