aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
commitda9c7185dfe8cc291176fa0895a346309d6cdd43 (patch)
tree5048cc33889a0a98f67b14cac7389cfb628cde39 /gdb
parentd7458677f4d277378d65c4ebdaf880f43e7fc15b (diff)
downloadgdb-da9c7185dfe8cc291176fa0895a346309d6cdd43.zip
gdb-da9c7185dfe8cc291176fa0895a346309d6cdd43.tar.gz
gdb-da9c7185dfe8cc291176fa0895a346309d6cdd43.tar.bz2
Fix two ``attach'' related bugs involving threads.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/lin-lwp.c18
2 files changed, 25 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 75b1d80..bc8d70e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2001-11-21 Kevin Buettner <kevinb@redhat.com>
+
+ * 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 <jimb@redhat.com>
* target.h (TARGET_RANGE_PROFITABLE_FOR_HW_WATCHPOINT): Delete
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
index 22d9d74..9931df5 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