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