Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 2011-2018 Free Software Foundation, Inc. |
0d932b2f MK |
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 | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | if { [skip_cplus_tests] } { continue } | |
17 | ||
18 | load_lib mi-support.exp | |
19 | set MIFLAGS "-i=mi" | |
20 | ||
21 | gdb_exit | |
22 | if [mi_gdb_start] { | |
23 | continue | |
24 | } | |
25 | ||
298a9cf0 | 26 | standard_testfile .cc |
0d932b2f | 27 | |
4c93b1db | 28 | if [get_compiler_info "c++"] { |
ae59b1da | 29 | return -1 |
0d932b2f MK |
30 | } |
31 | ||
32 | if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} { | |
5b362f04 | 33 | untested "failed to compile" |
0d932b2f MK |
34 | return -1 |
35 | } | |
36 | ||
37 | # Test that children of derived classes are given the proper | |
38 | # path by -var-info-path-expression | |
39 | ||
40 | mi_gdb_load ${binfile} | |
41 | mi_runto C::testLocation | |
42 | ||
43 | mi_create_varobj "var1" "this" "create var for THIS" | |
44 | ||
45 | mi_list_varobj_children "var1" { | |
46 | {var1.A A 1 A} | |
47 | {var1.public public 1} | |
48 | } "list children of THIS" | |
49 | ||
50 | # We don't care what the result of -var-info-path-expression | |
51 | # as long as it can be used in the -data-evaluate-expression | |
52 | # that follows | |
53 | mi_gdb_test "-var-info-path-expression var1.A" \ | |
54 | "\\^done,path_expr=\".*\"" \ | |
55 | "-var-info-path-expression var1.A" | |
56 | ||
57 | # Extract the result of the -var-info-path-expression command | |
58 | # to use it in -data-evaluate-expression | |
59 | set cmd_output $expect_out(2,string) | |
60 | set path [lindex [split $cmd_output "\""] 1] | |
61 | verbose "var-info-path-expression returned $cmd_output" 2 | |
62 | verbose "Using $path for data-evaluate-expression" 2 | |
63 | ||
64 | ||
65 | mi_gdb_test "-data-evaluate-expression \"$path\"" \ | |
5c07461a | 66 | "\\^done,value=\"\{a = 5\}\"" \ |
0d932b2f MK |
67 | "-data-evaluate-expression $path" |
68 | ||
69 | mi_gdb_exit | |
70 | return 0 |