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