aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.base/bg-execution-repeat.c18
-rw-r--r--gdb/testsuite/gdb.base/bg-execution-repeat.exp9
2 files changed, 26 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.c b/gdb/testsuite/gdb.base/bg-execution-repeat.c
index 2caa7d4..d5b48ee 100644
--- a/gdb/testsuite/gdb.base/bg-execution-repeat.c
+++ b/gdb/testsuite/gdb.base/bg-execution-repeat.c
@@ -23,11 +23,27 @@ foo (void)
return 0; /* set break here */
}
+static volatile int do_wait;
+
+static void
+wait (void)
+{
+ while (do_wait)
+ usleep (10 * 1000);
+}
+
int
main (void)
{
+ alarm (60);
+
foo ();
- sleep (5);
+
+ do_wait = 1;
+ wait ();
+ /* do_wait set to 0 externally. */
+
foo ();
+
return 0;
}
diff --git a/gdb/testsuite/gdb.base/bg-execution-repeat.exp b/gdb/testsuite/gdb.base/bg-execution-repeat.exp
index a4cc7da..35ddb34 100644
--- a/gdb/testsuite/gdb.base/bg-execution-repeat.exp
+++ b/gdb/testsuite/gdb.base/bg-execution-repeat.exp
@@ -68,6 +68,15 @@ proc test {continue_cmd} {
# stopped.
gdb_test "print 1" " = 1" "input still accepted"
+ # With gdbserver, we cannot set memory while the inferior is running, so
+ # enable the "set var" command with an interrupt / continue& pair.
+ gdb_test -no-prompt-anchor "interrupt"
+
+ # Allow the breakpoint to trigger.
+ gdb_test -no-prompt-anchor "set var do_wait=0"
+
+ gdb_test -no-prompt-anchor "continue&"
+
# Make sure we see a stop after the print, and not before. Don't
# expect a prompt, as we had resumed the inferior in the background.
set test "breakpoint hit 2"