]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/py-mi-var-info-path-expression.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-mi-var-info-path-expression.exp
1 # Copyright (C) 2018-2020 Free Software Foundation, Inc.
2 # This program is free software; you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation; either version 3 of the License, or
5 # (at your option) any later version.
6 #
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14
15 # Tests whether -var-info-path-expression fails as documented when
16 # invoked on a dynamic varobj.
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
26 #
27 # Start here
28 #
29 standard_testfile
30
31 if {[gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } {
32 return -1
33 }
34
35 # Skip all tests if Python scripting is not enabled.
36 if { [mi_skip_python_tests] } { continue }
37
38 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
39 mi_gdb_test "source ${pyfile}" \
40 ".*\\^done" \
41 "load python file"
42
43 mi_gdb_test "-enable-pretty-printing" \
44 "\\^done" \
45 "-enable-pretty-printing"
46
47 mi_gdb_test "set python print-stack full" \
48 ".*\\^done" \
49 "set python print-stack full"
50
51
52 mi_run_to_main
53
54
55 mi_continue_to_line [gdb_get_line_number "next line" ${srcfile}] \
56 "step to breakpoint"
57
58 mi_gdb_test "-var-create c1 * &c1" \
59 "\\^done.*" \
60 "-var-create c1 * &c1"
61
62 mi_gdb_test "-var-info-path-expression c1" \
63 "\\^done,path_expr=\"&c1\"" \
64 "-var-info-path-expression c1"
65
66 mi_gdb_test "-var-list-children c1" \
67 "\\^done,numchild=\"2\",children=.child=\{name=\"c1.car\".*child=\{name=\"c1.cdr\".*" \
68 "-var-list-children c1"
69
70 mi_gdb_test "-var-info-path-expression c1.cdr" \
71 "\\^error,msg=\".*\"" \
72 "-var-info-path-expression c1.cdr"
73
74 mi_gdb_test "-var-list-children c1.cdr" \
75 "\\^done,numchild=\"2\",children=.child=\{name=\"c1.cdr.car\".*child=\{name=\"c1.cdr.cdr\".*" \
76 "-var-list-children c1.cdr"
77
78 mi_gdb_test "-var-info-path-expression c1.cdr.cdr" \
79 "\\^error,msg=\".*\"" \
80 "-var-info-path-expression c1.cdr.cdr"
81
82 mi_gdb_test "-var-list-children c1.car" \
83 "\\^done,numchild=\"1\",children=.child=\{name=\"c1.car.atom\".*" \
84 "-var-list-children c1.car"
85
86 mi_gdb_test "-var-list-children c1.car.atom" \
87 "\\^done,numchild=\"1\",children=.child=\{name=\"c1.car.atom.ival\".*" \
88 "-var-list-children c1.car.atom"
89
90 mi_gdb_test "-var-info-path-expression c1.car.atom.ival" \
91 "\\^error,msg=\".*\"" \
92 "-var-info-path-expression c1.car.atom.ival"