--- /dev/null +++ b/gdb/testsuite/gdb.mi/mi-infcall.c @@ -0,0 +1,33 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright (C) 2013 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 3 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, see . */ + +int +return_false (void) +{ + return 0; +} + +int +main () +{ + int a = 0; + + while (a < 3) + a++; /* set breakpoint here */ + + return 0; +} --- /dev/null +++ b/gdb/testsuite/gdb.mi/mi-infcall.exp @@ -0,0 +1,51 @@ +# Copyright (C) 2013 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 3 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, see . + +load_lib mi-support.exp +set MIFLAGS "-i=mi" + +gdb_exit +if [mi_gdb_start] { + continue +} + +standard_testfile + +if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} { + untested "failed to compile $testfile" + return -1 +} + +mi_run_to_main + +mi_delete_breakpoints + +set bp_location [gdb_get_line_number "set breakpoint here"] + +mi_gdb_test "-break-insert -c return_false() $bp_location" ".*" "mi insert breakpoint" + +set msg "check infcall" +mi_send_resuming_command "exec-continue" "$msg continue" +gdb_expect { + -re "running,thread-id=\"1\".*running,thread-id=\"1\".*running,thread-id=\"1\"" { + fail $msg + } + -re ".*" { + pass $msg + } + timeout { + fail $msg + } +}