--- /dev/null +++ b/gdb/testsuite/gdb.base/dprintf-next.c @@ -0,0 +1,26 @@ +/* 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 +main (void) +{ + int x = 5; + + ++x; /* Next without dprintf. */ + ++x; /* Set dprintf here. */ + return x - 7; +} --- /dev/null +++ b/gdb/testsuite/gdb.base/dprintf-next.exp @@ -0,0 +1,36 @@ +# Copyright 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 . + +standard_testfile + +set executable $testfile +set expfile $testfile.exp + +set dp_location [gdb_get_line_number "Set dprintf here"] + +if [prepare_for_testing "failed to prepare for dprintf with next" \ + ${testfile} ${srcfile} {debug}] { + return -1 +} + +if ![runto_main] { + fail "Can't run to main" + return -1 +} + +gdb_test "dprintf $dp_location, \"%d\\n\", x" \ + "Dprintf .*" + +gdb_test "next" "\\+\\+x\;.*\/\* Next without dprintf.*" "next 1" +gdb_test "next" "\\+\\+x\;.*\/\* Set dprintf here.*" "next 2" --- /dev/null +++ b/gdb/testsuite/gdb.base/dprintf-non-stop.c @@ -0,0 +1,30 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Hui Zhu + + 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 . */ + +void +foo () +{ +} + +int +main () +{ + foo (); + sleep (3); + return 0; +} --- /dev/null +++ b/gdb/testsuite/gdb.base/dprintf-non-stop.exp @@ -0,0 +1,54 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. +# Contributed by Hui Zhu + +# 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 . + +if [is_remote target] then { + unsupported "Dprintf with non-stop is not supported." + return 0 +} + +standard_testfile + +if [prepare_for_testing "failed to prepare for dprintf with non-stop" \ + ${testfile} ${srcfile} {debug}] { + return -1 +} + +gdb_test_no_output "set target-async on" +gdb_test_no_output "set non-stop on" + +if ![runto main] { + fail "Can't run to main" + return -1 +} + +gdb_test "dprintf foo,\"At foo entry\\n\"" "Dprintf .*" + +send_gdb "continue &\n" +exec sleep 1 + +set test "interrupt" +gdb_test_multiple $test $test { + -re "interrupt\r\n$gdb_prompt " { + pass $test + } +} + +set test "inferior stopped" +gdb_test_multiple "" $test { + -re "\r\n\\\[.* \[0-9\]+\\\] #1 stopped\\\.\r\n" { + pass $test + } +} --- a/gdb/testsuite/gdb.base/dprintf.exp +++ b/gdb/testsuite/gdb.base/dprintf.exp @@ -50,10 +50,8 @@ gdb_test_sequence "info breakpoints" "dp "\[\r\n\]2 breakpoint" "\[\r\n\]3 dprintf" "\[\r\n\] printf \"At foo entry\\\\n\"" - "\[\r\n\] continue" "\[\r\n\]4 dprintf" "\[\r\n\] printf \"arg=%d, g=%d\\\\n\", arg, g" - "\[\r\n\] continue" } gdb_test "break $bp_location1" \ @@ -135,4 +133,3 @@ if $target_can_dprintf { gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \ "Set dprintf style to an unrecognized type" - --- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp @@ -96,7 +96,7 @@ proc test_insert_delete_modify { } { $test set test "dprintf marker, \"arg\" \"" mi_gdb_test $test \ - {.*=breakpoint-created,bkpt=\{number="6",type="dprintf".*,script=\{\"printf \\\\\"arg\\\\\" \\\\\"\",\"continue\"\}.*\}\r\n\^done} \ + {.*=breakpoint-created,bkpt=\{number="6",type="dprintf".*,script=\{\"printf \\\\\"arg\\\\\" \\\\\"\"\}.*\}\r\n\^done} \ $test # 2. when modifying condition