xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.mi/gdb701.exp (revision 32d1c65c71fbdb65a012e8392a62a757dd6853e9)
1# Copyright 2002-2023 Free Software Foundation, Inc.
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#
17# test gdb/701
18#
19
20load_lib mi-support.exp
21set MIFLAGS "-i=mi"
22
23standard_testfile
24
25if {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} {
26  untested "failed to compile"
27  return -1
28}
29
30# When varobj reports the types of objects, it often isn't really reporting
31# the type as GDB knows it. For example, in this testcase, we have a
32# structure which has been typedefed. A varobj of this type would really have
33# a type of "TYPE_CODE_TYPEDEF". It's target type is "TYPE_CODE_STRUCT". Varobj
34# should skip over the TYPEDEF type when figuring out the varobj's children.
35# If it doesn't, Bad Things Happen(TM).
36
37# Run to main
38mi_clean_restart $binfile
39mi_runto_main
40
41# Step over "foo = 0"
42mi_next "step over \"foo = 0\""
43
44mi_create_varobj "fooPtr" "foo" "create fooPtr"
45
46mi_gdb_test "-var-list-children fooPtr" \
47  "(&\".*\"\r\n)*\\^done,numchild=\"3\",.*" \
48  "list children of fooPtr"
49
50foreach i [list x y z] {
51  mi_gdb_test "-var-list-children fooPtr.$i" \
52    "(&\".*\"\r\n)*\\^done,numchild=\"0\",has_more=\"0\"" \
53    "list children of fooPtr.$i"
54}
55
56mi_gdb_exit
57return 0
58