This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] gdbserver sigthread.exp fix
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org
- Date: Wed, 24 Oct 2007 09:28:16 -0400
- Subject: [commit] gdbserver sigthread.exp fix
This patch, based on equivalent code in gdb/linux-nat.c, fixes
intermittent failures of sigthread.exp after yesterday's changes.
Tested on x86_64-linux and mips-linux, then committed.
--
Daniel Jacobowitz
CodeSourcery
2007-10-24 Daniel Jacobowitz <dan@codesourcery.com>
* linux-low.c (handle_extended_wait): Handle unexpected signals.
--- /scratch/gcc/src/gdb-mainline/gdb/gdbserver/linux-low.c 2007-10-24 00:15:05.000000000 -0700
+++ ./linux-low.c 2007-10-24 05:44:50.000000000 -0700
@@ -160,7 +162,7 @@
perror_with_name ("waiting for new child");
else if (ret != new_pid)
warning ("wait returned unexpected PID %d", ret);
- else if (!WIFSTOPPED (status) || WSTOPSIG (status) != SIGSTOP)
+ else if (!WIFSTOPPED (status))
warning ("wait returned unexpected status 0x%x", status);
}
@@ -170,10 +172,30 @@
add_thread (new_pid, new_process, new_pid);
new_thread_notify (thread_id_to_gdb_id (new_process->lwpid));
- if (stopping_threads)
- new_process->stopped = 1;
+ /* Normally we will get the pending SIGSTOP. But in some cases
+ we might get another signal delivered to the group first.
+ If we do, be sure not to lose it. */
+ if (WSTOPSIG (status) == SIGSTOP)
+ {
+ if (stopping_threads)
+ new_process->stopped = 1;
+ else
+ ptrace (PTRACE_CONT, new_pid, 0, 0);
+ }
else
- ptrace (PTRACE_CONT, new_pid, 0, 0);
+ {
+ new_process->stop_expected = 1;
+ if (stopping_threads)
+ {
+ new_process->stopped = 1;
+ new_process->status_pending_p = 1;
+ new_process->status_pending = status;
+ }
+ else
+ /* Pass the signal on. This is what GDB does - except
+ shouldn't we really report it instead? */
+ ptrace (PTRACE_CONT, new_pid, 0, WSTOPSIG (status));
+ }
/* Always resume the current thread. If we are stopping
threads, it will have a pending SIGSTOP; we may as well