# Copyright 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. # This file was written by Jason Molenda (jmolenda@apple.com) # This test case verifies r. 3557671 hasn't regressed. The patch # was submitted to the FSF 2004-09-08: # http://sources.redhat.com/ml/gdb-patches/2004-09/msg00129.html # If it ever gets accepted, these two test cases will be in # gdb.base/define.exp. if $tracelevel then { strace $tracelevel } set prms_id 0 set bug_id 0 set testfile "r3376901" 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 fil e will automatically fail." } # Start with a fresh gdb gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} if ![runto foo] then { fail "ifnospace tests suppressed" return -1 } # Verify that the command parser doesn't require a space after an 'if' # command in a user defined function. # send_gdb "define ifspace\n" gdb_expect { -re "Type commands for definition of \"ifspace\".\r\nEnd with a line saying just \"end\".\r\n>$"\ {send_gdb "if(3<4)\nprint \"hi there\\n\"\nend\nend\n" gdb_expect { -re "$gdb_prompt $"\ {pass "define user command: ifspace"} timeout {fail "(timeout) define user command: ifspace"} } } -re "$gdb_prompt $"\ {fail "define user command: ifspace"} timeout {fail "(timeout) define user command: ifspace"} } gdb_test "ifspace" ".*hi there.*" "test ifspace is parsed correctly" # Verify that the command parser doesn't require a space after an 'while' # command in a user defined function. # send_gdb "define whilespace\n" gdb_expect { -re "Type commands for definition of \"whilespace\".\r\nEnd with a line saying just \"end\".\r\n>$"\ {send_gdb "set \$i=1\nwhile(\$i<2)\nset \$i=2\nprint \"hi there\\n\"\nend\nend\n" gdb_expect { -re "$gdb_prompt $"\ {pass "define user command: whilespace"} timeout {fail "(timeout) define user command: whilespace"} } } -re "$gdb_prompt $"\ {fail "define user command: whilespace"} timeout {fail "(timeout) define user command: whilespace"} } gdb_test "whilespace" ".*hi there.*" "test whilespace is parsed correctly" gdb_exit return 0