From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: gdb-patches@sources.redhat.com Cc: ken@believe.com Subject: [PATCH] Fix check for resumed threads Date: Fri, 13 Jul 2001 05:53:00 -0000 Message-id: <200107131252.f6DCqpN01870@delius.kettenis.local> X-SW-Source: 2001-07/msg00324.html lin_lwp_wait() may be called when the list of LWPs is still empty (this will add the LWP for which we receive an event to the list automatically. This happens when debugging a statically linked program. Thanks to Ken Whaley for reporting this. Mark Index: ChangeLog from Mark Kettenis * lin-lwp.c (lin_lwp_wait): Avoid check for resumed LWPs if there are no registered LWPs yet. Index: lin-lwp.c =================================================================== RCS file: /cvs/src/src/gdb/lin-lwp.c,v retrieving revision 1.28 diff -u -p -r1.28 lin-lwp.c --- lin-lwp.c 2001/07/12 19:37:36 1.28 +++ lin-lwp.c 2001/07/13 12:03:05 @@ -908,8 +908,9 @@ lin_lwp_wait (ptid_t ptid, struct target retry: - /* Make sure there is at least one thread that has been resumed. */ - gdb_assert (iterate_over_lwps (resumed_callback, NULL)); + /* Make sure there is at least one LWP that has been resumed, at + least if there are any LWPs at all. */ + gdb_assert (num_lwps == 0 || iterate_over_lwps (resumed_callback, NULL)); /* First check if there is a LWP with a wait status pending. */ if (pid == -1)