Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright 2002-2003, 2007-2012 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 | 15 | |
f80a3b5f JJ |
16 | # |
17 | # test gdb/792 | |
18 | # | |
19 | ||
a66624bc AC |
20 | if { [skip_cplus_tests] } { continue } |
21 | ||
f80a3b5f JJ |
22 | load_lib mi-support.exp |
23 | set MIFLAGS "-i=mi" | |
24 | ||
25 | gdb_exit | |
26 | if [mi_gdb_start] { | |
27 | continue | |
28 | } | |
29 | ||
30 | set testfile gdb792 | |
31 | set srcfile "$testfile.cc" | |
32 | set binfile $objdir/$subdir/$testfile | |
33 | ||
4c93b1db | 34 | if [get_compiler_info "c++"] { |
f80a3b5f JJ |
35 | return -1; |
36 | } | |
37 | ||
38 | if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} { | |
b60f0898 JB |
39 | untested gdb792.exp |
40 | return -1 | |
f80a3b5f JJ |
41 | } |
42 | ||
43 | # Test that children of classes are properly reported | |
44 | ||
45 | # Run to main | |
46 | mi_run_to_main | |
47 | ||
9e8e3afe VP |
48 | mi_create_varobj "var1" "a" "create var for class A" |
49 | ||
50 | mi_list_varobj_children "var1" { | |
51 | {var1.public public 2} | |
52 | {var1.private private 2} | |
53 | {var1.protected protected 2} | |
54 | } "list children of class A" | |
55 | ||
56 | mi_list_varobj_children "var1.public" { | |
57 | {var1.public.x x 0 int} | |
58 | {var1.public.buffer buffer 10 {char \[10\]}} | |
59 | } "list children of A.public" | |
60 | ||
61 | mi_list_varobj_children "var1.private" { | |
62 | {var1.private.u u 0 int} | |
63 | {var1.private.z z 0 float} | |
64 | } "list children of A.private" | |
65 | ||
66 | mi_list_varobj_children "var1.protected" { | |
67 | {var1.protected.y y 0 int} | |
68 | {var1.protected.b b 2 B} | |
69 | } "list children of A.protected" | |
70 | ||
71 | mi_list_varobj_children "var1.protected.b" { | |
72 | {var1.protected.b.public public 2} | |
73 | {var1.protected.b.private private 1} | |
74 | } "list children of A.protected.b" | |
75 | ||
76 | mi_list_varobj_children "var1.protected.b.public" { | |
77 | {var1.protected.b.public.bx bx 0 int} | |
78 | {var1.protected.b.public.by by 0 int} | |
79 | } "list children of A.protected.b.public" | |
80 | ||
81 | mi_list_varobj_children "var1.protected.b.private" { | |
82 | {var1.protected.b.private.k k 0 int} | |
83 | } "list children of A.protected.b.private" | |
84 | ||
85 | mi_create_varobj "var2" "c" "create var for class C which has baseclass A" | |
86 | ||
87 | mi_list_varobj_children "var2" { | |
88 | {var2.A A 3 A} | |
89 | {var2.public public 1} | |
90 | {var2.private private 1} | |
91 | } "list children of class C" | |
f80a3b5f JJ |
92 | |
93 | mi_gdb_exit | |
94 | return 0 |