summaryrefslogtreecommitdiff
path: root/gdb/lin-lwp.c
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2001-11-21 21:56:47 +0000
committerKevin Buettner <kevinb@redhat.com>2001-11-21 21:56:47 +0000
commit866457caae595113d88855fd4bd85220fb485a5b (patch)
treecbd35981b33847e09d9e2f3276790e4fcbd44ca3 /gdb/lin-lwp.c
parented2fcd3f8c028bcf90c2c591ca7c1852bbbe737e (diff)
downloadgdb-866457caae595113d88855fd4bd85220fb485a5b.tar.gz
Fix two ``attach'' related bugs involving threads.
Diffstat (limited to 'gdb/lin-lwp.c')
-rw-r--r--gdb/lin-lwp.c18
1 files changed, 18 insertions, 0 deletions
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