1*b725ae77Skettenis# Copyright 2002 Free Software Foundation, Inc. 2*b725ae77Skettenis 3*b725ae77Skettenis# This program is free software; you can redistribute it and/or modify 4*b725ae77Skettenis# it under the terms of the GNU General Public License as published by 5*b725ae77Skettenis# the Free Software Foundation; either version 2 of the License, or 6*b725ae77Skettenis# (at your option) any later version. 7*b725ae77Skettenis# 8*b725ae77Skettenis# This program is distributed in the hope that it will be useful, 9*b725ae77Skettenis# but WITHOUT ANY WARRANTY; without even the implied warranty of 10*b725ae77Skettenis# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11*b725ae77Skettenis# GNU General Public License for more details. 12*b725ae77Skettenis# 13*b725ae77Skettenis# You should have received a copy of the GNU General Public License 14*b725ae77Skettenis# along with this program; if not, write to the Free Software 15*b725ae77Skettenis# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16*b725ae77Skettenis 17*b725ae77Skettenis# Please email any bugs, comments, and/or additions to this file to: 18*b725ae77Skettenis# bug-gdb@prep.ai.mit.edu 19*b725ae77Skettenis 20*b725ae77Skettenis# 21*b725ae77Skettenis# test gdb/701 22*b725ae77Skettenis# 23*b725ae77Skettenis 24*b725ae77Skettenisload_lib mi-support.exp 25*b725ae77Skettenisset MIFLAGS "-i=mi" 26*b725ae77Skettenis 27*b725ae77Skettenisgdb_exit 28*b725ae77Skettenisif [mi_gdb_start] { 29*b725ae77Skettenis continue 30*b725ae77Skettenis} 31*b725ae77Skettenis 32*b725ae77Skettenisset testfile gdb701 33*b725ae77Skettenisset srcfile "$testfile.c" 34*b725ae77Skettenisset binfile $objdir/$subdir/$testfile 35*b725ae77Skettenisif {[gdb_compile $srcdir/$subdir/$srcfile $binfile executable debug] != ""} { 36*b725ae77Skettenis gdb_suppress_entire_file "Testcase compile failed, so all test in this file will automatically fail." 37*b725ae77Skettenis} 38*b725ae77Skettenis 39*b725ae77Skettenis# When varobj reports the types of objects, it often isn't really reporting 40*b725ae77Skettenis# the type as GDB knows it. For example, in this testcase, we have a 41*b725ae77Skettenis# structure which has been typedefed. A varobj of this type would really have 42*b725ae77Skettenis# a type of "TYPE_CODE_TYPEDEF". It's target type is "TYPE_CODE_STRUCT". Varobj 43*b725ae77Skettenis# should skip over the TYPEDEF type when figuring out the varobj's children. 44*b725ae77Skettenis# If it doesn't, Bad Things Happen(TM). 45*b725ae77Skettenis 46*b725ae77Skettenis# Run to main 47*b725ae77Skettenismi_run_to_main 48*b725ae77Skettenis 49*b725ae77Skettenis# Step over "foo = 0" 50*b725ae77Skettenismi_next "step over \"foo = 0\"" 51*b725ae77Skettenis 52*b725ae77Skettenismi_gdb_test "-var-create fooPtr * foo" \ 53*b725ae77Skettenis "(&\".*\"\r\n)*\\^done,name=\"fooPtr\",numchild=\"3\",type=\"Foo \\*\"" \ 54*b725ae77Skettenis "create fooPtr" 55*b725ae77Skettenis 56*b725ae77Skettenismi_gdb_test "-var-list-children fooPtr" \ 57*b725ae77Skettenis "(&\".*\"\r\n)*\\^done,numchild=\"3\",.*" \ 58*b725ae77Skettenis "list children of fooPtr" 59*b725ae77Skettenis 60*b725ae77Skettenisforeach i [list x y z] { 61*b725ae77Skettenis mi_gdb_test "-var-list-children fooPtr.$i" \ 62*b725ae77Skettenis "(&\".*\"\r\n)*\\^done,numchild=\"0\"" \ 63*b725ae77Skettenis "list children of fooPtr.$i" 64*b725ae77Skettenis} 65*b725ae77Skettenis 66*b725ae77Skettenismi_gdb_exit 67*b725ae77Skettenisreturn 0 68