From: Kevin Buettner Date: Wed, 21 Nov 2001 21:56:47 +0000 (+0000) Subject: Fix two ``attach'' related bugs involving threads. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=da9c7185dfe8cc291176fa0895a346309d6cdd43;p=binutils-gdb.git Fix two ``attach'' related bugs involving threads. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 75b1d80d62b..bc8d70e29a7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2001-11-21 Kevin Buettner + + * lin-lwp.c (lin_lwp_attach_lwp): Make sure SIGCHLD is in set of + blocked signals. + + * lin-lwp.c (lin_lwp_attach_lwp): Mark main thread as stopped. + 2001-11-20 Jim Blandy * target.h (TARGET_RANGE_PROFITABLE_FOR_HW_WATCHPOINT): Delete diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index 22d9d74796c..9931df56f7c 100644 --- a/gdb/lin-lwp.c +++ b/gdb/lin-lwp.c @@ -352,6 +352,14 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose) gdb_assert (is_lwp (ptid)); + /* Make sure SIGCHLD is blocked. We don't want SIGCHLD events + to interrupt either the ptrace() or waitpid() calls below. */ + if (! sigismember (&blocked_mask, SIGCHLD)) + { + sigaddset (&blocked_mask, SIGCHLD); + sigprocmask (SIG_BLOCK, &blocked_mask, NULL); + } + if (verbose) printf_filtered ("[New %s]\n", target_pid_to_str (ptid)); @@ -383,6 +391,16 @@ lin_lwp_attach_lwp (ptid_t ptid, int verbose) lp->stopped = 1; } + else + { + /* We assume that the LWP representing the original process + is already stopped. Mark it as stopped in the data structure + that the lin-lwp layer uses to keep track of threads. Note + that this won't have already been done since the main thread + will have, we assume, been stopped by an attach from a + different layer. */ + lp->stopped = 1; + } } static void