This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfa/linux] Don't select an event LWP that wasn't resumed
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sources dot redhat dot com
- Cc: Michael Snyder <msnyder at redhat dot com>
- Date: Mon, 4 Apr 2005 00:06:44 -0400
- Subject: [rfa/linux] Don't select an event LWP that wasn't resumed
This patch improves testsuite results for schedlock.exp on platforms
which use software single step. If we're trying to find which event
to report, we should only look at LWPs with lp->resumed set. They may not
have actually resumed, but they will correspond to the LWPs which infrun
requested be resumed (even if they had pending status).
Without this patch, we end up with five threads with pending SIGTRAPs in the
portion of schedlock.exp which uses set scheduler-locking on. Then we
resume a different thread, and eventually send it a Control-C. But in
our next call to select_event_lwp, we select one of those threads with a
pending SIGTRAP instead of th thread which was actually running.
OK?
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-04-04 Daniel Jacobowitz <dan@codesourcery.com>
* linux-nat.c (count_events_callback): Check lp->resumed also.
(select_event_lwp_callback): Likewise.
Index: linux-nat.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/linux-nat.c,v
retrieving revision 1.27
diff -u -p -r1.27 linux-nat.c
--- linux-nat.c 6 Mar 2005 16:42:20 -0000 1.27
+++ linux-nat.c 4 Apr 2005 04:01:54 -0000
@@ -1543,8 +1543,8 @@ count_events_callback (struct lwp_info *
gdb_assert (count != NULL);
- /* Count only LWPs that have a SIGTRAP event pending. */
- if (lp->status != 0
+ /* Count only resumed LWPs that have a SIGTRAP event pending. */
+ if (lp->status != 0 && lp->resumed
&& WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
(*count)++;
@@ -1571,8 +1571,8 @@ select_event_lwp_callback (struct lwp_in
gdb_assert (selector != NULL);
- /* Select only LWPs that have a SIGTRAP event pending. */
- if (lp->status != 0
+ /* Select only resumed LWPs that have a SIGTRAP event pending. */
+ if (lp->status != 0 && lp->resumed
&& WIFSTOPPED (lp->status) && WSTOPSIG (lp->status) == SIGTRAP)
if ((*selector)-- == 0)
return 1;