]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.mi/mi-inheritance-syntax-error.exp
2011-08-26 Marc Khouzam <marc.khouzam@ericsson.com>
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-inheritance-syntax-error.exp
CommitLineData
0d932b2f
MK
1# Copyright 2011
2# Free Software Foundation, Inc.
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17if { [skip_cplus_tests] } { continue }
18
19load_lib mi-support.exp
20set MIFLAGS "-i=mi"
21
22gdb_exit
23if [mi_gdb_start] {
24 continue
25}
26
27set testfile mi-inheritance-syntax-error
28set srcfile "$testfile.cc"
29set binfile $objdir/$subdir/$testfile
30
31if [get_compiler_info ${binfile} "c++"] {
32 return -1;
33}
34
35if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable {debug c++}] != ""} {
36 untested mi-inheritance-syntax-error.exp
37 return -1
38}
39
40# Test that children of derived classes are given the proper
41# path by -var-info-path-expression
42
43mi_gdb_load ${binfile}
44mi_runto C::testLocation
45
46mi_create_varobj "var1" "this" "create var for THIS"
47
48mi_list_varobj_children "var1" {
49 {var1.A A 1 A}
50 {var1.public public 1}
51} "list children of THIS"
52
53# We don't care what the result of -var-info-path-expression
54# as long as it can be used in the -data-evaluate-expression
55# that follows
56mi_gdb_test "-var-info-path-expression var1.A" \
57 "\\^done,path_expr=\".*\"" \
58 "-var-info-path-expression var1.A"
59
60# Extract the result of the -var-info-path-expression command
61# to use it in -data-evaluate-expression
62set cmd_output $expect_out(2,string)
63set path [lindex [split $cmd_output "\""] 1]
64verbose "var-info-path-expression returned $cmd_output" 2
65verbose "Using $path for data-evaluate-expression" 2
66
67
68mi_gdb_test "-data-evaluate-expression \"$path\"" \
69 "\\^done,value=\"\{a = \[0-9\]*\}\"" \
70 "-data-evaluate-expression $path"
71
72mi_gdb_exit
73return 0