1 # Copyright 2011-2023 Free Software Foundation, Inc.
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 3 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 if { [skip_cplus_tests] } { return }
18 load_lib mi-support.exp
28 if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
29 untested "failed to compile"
33 # Test that children of derived classes are given the proper
34 # path by -var-info-path-expression
36 mi_gdb_load ${binfile}
37 mi_runto C::testLocation
39 mi_create_varobj "var1" "this" "create var for THIS"
41 mi_list_varobj_children "var1" {
43 {var1.public public 1}
44 } "list children of THIS"
46 # We don't care what the result of -var-info-path-expression
47 # as long as it can be used in the -data-evaluate-expression
49 mi_gdb_test "-var-info-path-expression var1.A" \
50 "\\^done,path_expr=\".*\"" \
51 "-var-info-path-expression var1.A"
53 # Extract the result of the -var-info-path-expression command
54 # to use it in -data-evaluate-expression
55 set cmd_output $expect_out(2,string)
56 set path [lindex [split $cmd_output "\""] 1]
57 verbose "var-info-path-expression returned $cmd_output" 2
58 verbose "Using $path for data-evaluate-expression" 2
61 mi_gdb_test "-data-evaluate-expression \"$path\"" \
62 "\\^done,value=\"\{a = 5\}\"" \
63 "-data-evaluate-expression $path"