This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Fixup mi-nonstop.exp
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 21 Aug 2008 19:12:44 +0400
- Subject: Fixup mi-nonstop.exp
Pedro has noticed that the version of mi-nonstop.exp I've checked
is actually no-op, since the logic to detect if non-stop is available
was faulty. Dan has noticed that the corresponding C file produces
warnings (on 64-bit box, I presume). This patch fixes those; checked
in.
The test is still somewhat flaky, in particular in some runs gdb reports
sigtrap on breakpoint hit; but that's for another day.
- Volodya
Index: gdb/testsuite/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1708
diff -u -p -r1.1708 ChangeLog
--- gdb/testsuite/ChangeLog 21 Aug 2008 11:36:38 -0000 1.1708
+++ gdb/testsuite/ChangeLog 21 Aug 2008 15:08:19 -0000
@@ -1,3 +1,10 @@
+2008-08-21 Vladimir Prus <vladimir@codesourcery.com>
+
+ * gdb.mi/mi-nonstop.exp: Fix the check for non-stop
+ support. Adjust the order of "*running" notifications.
+ * gdb.mi/non-stop.c: Don't cast from int to void* and
+ back.
+
2008-08-20 Mark Kettenis <kettenis@gnu.org>
* gdb.arch/powerpc-prologue.exp: Code doesn't save %r31 so don't
Index: gdb/testsuite/gdb.mi/mi-nonstop.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-nonstop.exp,v
retrieving revision 1.1
diff -u -p -r1.1 mi-nonstop.exp
--- gdb/testsuite/gdb.mi/mi-nonstop.exp 19 Aug 2008 14:13:29 -0000 1.1
+++ gdb/testsuite/gdb.mi/mi-nonstop.exp 21 Aug 2008 15:08:19 -0000
@@ -76,17 +76,32 @@ gdb_expect {
}
}
-if { $supported == 0 } {
- verbose -log "Non-stop mode not supported by the target, skipping tests"
- return
-
-}
-
mi_gdb_test "-gdb-set non-stop 1" ".*"
mi_gdb_test "-gdb-set target-async 1" ".*"
detect_async
-mi_runto main
+mi_gdb_test "200-break-insert -t main" ".*"
+# Note: presently, we skip this test on non-native targets,
+# so 'run' is OK. As soon as we start to run this on remote
+# target, the logic from mi_run_cmd will have to be refactored.
+send_gdb "-exec-run\n"
+gdb_expect {
+ -re ".*\\^running.*$mi_gdb_prompt$" {
+ }
+ -re "\\^error,msg=\"The target does not support running in non-stop mode.\"" {
+ verbose -log "Non-stop mode not supported, skipping all tests"
+ return
+ }
+ -re ".*\r\n$mi_gdb_prompt$" {
+ perror "Cannot start target (unknown output after running)"
+ return -1
+ }
+ timeout {
+ perror "Cannot start target (timeout)"
+ return -1
+ }
+}
+mi_expect_stop "breakpoint-hit" main ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "run to main"
mi_create_breakpoint break_at_me 2 keep break_at_me .* .* .* "breakpoint at marker"
@@ -130,12 +145,9 @@ gdb_expect {
sleep 1
check_thread_states {"stopped" "stopped" "stopped"} "thread state, stop 4"
-# Note that the order of *running notifications below is 'unnatural'. This is because
-# we do only one out-of-line step at the time, so one thread gets resumed immediately
-# and another has to wait.
send_gdb "-exec-continue --all\n"
gdb_expect {
- -re ".*\\*running,thread-id=\"3\".*\\*running,thread-id=\"1\".*\\*running,thread-id=\"2\"\r\n" {
+ -re ".*\\*running,thread-id=\"3\"\r\n\\*running,thread-id=\"2\"\r\n\\*running,thread-id=\"1\"\r\n$mi_gdb_prompt" {
pass "resume all"
}
timeout {
Index: gdb/testsuite/gdb.mi/non-stop.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/non-stop.c,v
retrieving revision 1.1
diff -u -p -r1.1 non-stop.c
--- gdb/testsuite/gdb.mi/non-stop.c 19 Aug 2008 14:13:29 -0000 1.1
+++ gdb/testsuite/gdb.mi/non-stop.c 21 Aug 2008 15:08:19 -0000
@@ -42,7 +42,7 @@ void break_at_me (int id, int i)
void *
worker (void *arg)
{
- int id = (int)arg;
+ int id = *(int *)arg;
int i = 0;
/* When gdb is running, it sets hidden breakpoints in the thread
@@ -66,8 +66,11 @@ pthread_t
create_thread (int id)
{
pthread_t tid;
+ /* This memory will be leaked, we don't care for a test. */
+ int *id2 = malloc (sizeof (int));
+ *id2 = id;
- if (pthread_create (&tid, PTHREAD_CREATE_NULL_ARG2, worker, (void *) id))
+ if (pthread_create (&tid, PTHREAD_CREATE_NULL_ARG2, worker, (void *) id2))
{
perror ("pthread_create 1");
exit (1);