# Copyright (C) 2004 Free Software Foundation, Inc. # # This Program Is Free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # bug-gdb@prep.ai.mit.edu # Test xcode's var-list-children command. # # Written by Jason Molenda (jmolenda@apple.com) load_lib mi-support.exp set MIFLAGS "-i=mi1" gdb_exit if [mi_gdb_start] { continue } set testfile "structs" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} send_gdb "100-break-insert 14\n" gdb_expect { -re "100\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\".*main.*\",file=\".*structs.c\",line=\"($decimal)\",shlib=\"$binfile\",times=\"0\"\}\[\r\n\]+$mi_gdb_prompt$" { pass "break-insert main" } -re ".*$mi_gdb_prompt$" { fail "break-insert main" } timeout { fail "(timeout) break-insert main" } } mi_run_cmd # The running part has been checked already by mi_run_cmd mi_get_bp_stopped "1" "\[01\]" "" "main" "structs.c" ".*" "run to main" mi_gdb_test "103-stack-list-locals 2 1" \ "103\\^done,locals=\\\[varobj=\{exp=\"a\",value=\"$decimal\",name=\"var1\",numchild=\"0\",type=\"int\",typecode=\"INT\",dynamic_type=\"\",in_scope=\"true\",block_start_addr=\"$hex\",block_end_addr=\"$hex\"\},varobj=\{exp=\"b\",value=\"\{...\}\",name=\"var2\",numchild=\"2\",type=\"NSRect\",typecode=\"STRUCT\",dynamic_type=\"\",in_scope=\"true\",block_start_addr=\"$hex\",block_end_addr=\"$hex\"\}\\\]" "create locals varobjs" mi_gdb_test "110-var-list-children var2 2" \ "110\\^done,numchild=\"2\",children=\\\[child=\{name=\"var2.origin\",exp=\"origin\",numchild=\"2\",type=\"NSPoint\",typecode=\"STRUCT\",dynamic_type=\"\",value=\"\{...\}\"\},child=\{name=\"var2.size\",exp=\"size\",numchild=\"2\",type=\"NSSize\",typecode=\"STRUCT\",dynamic_type=\"\",value=\"\{...\}\"\}\\\]" "create children via var-list-children" mi_gdb_test "110-var-list-children 1 var2" \ "110\\^done,numchild=\"2\",children=\\\[child=\{name=\"var2.origin\",exp=\"origin\",numchild=\"2\",type=\"NSPoint\",typecode=\"STRUCT\",dynamic_type=\"\",value=\"\{...\}\"\},child=\{name=\"var2.size\",exp=\"size\",numchild=\"2\",type=\"NSSize\",typecode=\"STRUCT\",dynamic_type=\"\",value=\"\{...\}\"\}\\\]" "create children via var-list-children FSF style numerial" mi_gdb_test "110-var-list-children --all-values var2" \ "110\\^done,numchild=\"2\",children=\\\[child=\{name=\"var2.origin\",exp=\"origin\",numchild=\"2\",type=\"NSPoint\",typecode=\"STRUCT\",dynamic_type=\"\",value=\"\{...\}\"\},child=\{name=\"var2.size\",exp=\"size\",numchild=\"2\",type=\"NSSize\",typecode=\"STRUCT\",dynamic_type=\"\",value=\"\{...\}\"\}\\\]" "create children via var-list-children command line style flag" mi_gdb_test "120-var-list-children var2.origin 2" \ "120\\^done,numchild=\"2\",children=\\\[child=\{name=\"var2.origin.x\",exp=\"x\",numchild=\"0\",type=\"float\",typecode=\"FLT\",dynamic_type=\"\",value=\"$decimal\"\},child=\{name=\"var2.origin.y\",exp=\"y\",numchild=\"0\",type=\"float\",typecode=\"FLT\",dynamic_type=\"\",value=\"$decimal\"\}\\\]" "get children of origin, Xcode-style" mi_gdb_exit return 0