--- a/gdb/testsuite/gdb.base/dprintf.c
+++ b/gdb/testsuite/gdb.base/dprintf.c
@@ -39,6 +39,9 @@ main (int argc, char *argv[])
foo (loc++);
foo (loc++);
foo (loc++);
+
+ sleep (3);
+
return g;
}
--- 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" \
@@ -136,3 +134,41 @@ if $target_can_dprintf {
gdb_test "set dprintf-style foobar" "Undefined item: \"foobar\"." \
"Set dprintf style to an unrecognized type"
+
+# Test dprintf with non-stop mode.
+# The testfile uses "run". The real bug happened only for ![is_remote target].
+if [target_info exists use_gdb_stub] {
+ unsupported "dprintf with non-stop mode"
+ return 0
+}
+gdb_test_no_output "delete 2 5"
+send_gdb "kill\n"
+gdb_expect 120 {
+ -re "Kill the program being debugged. .y or n. $" {
+ send_gdb "y\n"
+ verbose "\t\tKilling previous program being debugged"
+ exp_continue
+ }
+ -re "$gdb_prompt $" {
+ # OK.
+ }
+}
+gdb_test_no_output "set dprintf-style gdb" "Set dprintf style to gdb"
+gdb_test_no_output "set target-async on"
+gdb_test_no_output "set non-stop on"
+set gdbindex_warning_re "warning: Skipping \[^\r\n\]+ \\.gdb_index section \[^\r\n\]*\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\."
+
+gdb_test "run &" "Starting program: \[^\r\n\]*(\r\n$gdbindex_warning_re)?"
+gdb_test "shell echo foo" "foo"
+set test "interrupt"
+gdb_test_multiple $test $test {
+ -re "interrupt\r\n$gdb_prompt " {
+ pass $test
+ }
+}
+set test "process stopped"
+gdb_test_multiple "" $test {
+ -re "\r\n\\\[process \[0-9\]+\\\] #1 stopped\\\.\r\n" {
+ pass $test
+ }
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/pr15075.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;
+ ++x; /* set dprintf here */
+ return x - 7;
+ }
--- /dev/null
+++ b/gdb/testsuite/gdb.base/pr15075.exp
@@ -0,0 +1,38 @@
+# 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 $expfile $executable $srcfile {debug}] {
+ untested "failed to prepare for trace tests"
+ 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" ".*" "next 1"
+gdb_test "next" ".*" "next 2"
+# Test inferior doesn't exit.
+gdb_test "p x" ".* = 6"
--- 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