aboutsummaryrefslogtreecommitdiff
path: root/gdb/lin-lwp.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-01-09 19:14:46 +0000
committerDaniel Jacobowitz <drow@false.org>2003-01-09 19:14:46 +0000
commitb3ba1b4442c71e25f857581f47db64cea2687f2e (patch)
treeed61001c4429c8f103450e80c482b5fb47dcd528 /gdb/lin-lwp.c
parent479ab5a00d3aa5dba754b8231a4c9e0b03d33ded (diff)
downloadgdb-b3ba1b4442c71e25f857581f47db64cea2687f2e.zip
gdb-b3ba1b4442c71e25f857581f47db64cea2687f2e.tar.gz
gdb-b3ba1b4442c71e25f857581f47db64cea2687f2e.tar.bz2
* lin-lwp.c (child_wait): Ignore exit statuses for processes other
than inferior_ptid. (lin_lwp_wait): Ignore exit statuses for unknown LWPs.
Diffstat (limited to 'gdb/lin-lwp.c')
-rw-r--r--gdb/lin-lwp.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c
index 6118927..aad8c19 100644
--- a/gdb/lin-lwp.c
+++ b/gdb/lin-lwp.c
@@ -1,5 +1,5 @@
/* Multi-threaded debugging support for GNU/Linux (LWP layer).
- Copyright 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -1062,6 +1062,14 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
save_errno = errno;
+ /* Make sure we don't report an event for the exit of the
+ original program, if we've detached from it. */
+ if (pid != -1 && ! WIFSTOPPED (status) && pid != GET_PID (inferior_ptid))
+ {
+ pid = -1;
+ save_errno = EINTR;
+ }
+
clear_sigio_trap ();
clear_sigint_trap ();
}
@@ -1206,6 +1214,17 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
}
lp = find_lwp_pid (pid_to_ptid (lwpid));
+
+ /* Make sure we don't report an event for the exit of an LWP not in
+ our list, i.e. not part of the current process. This can happen
+ if we detach from a program we original forked and then it
+ exits. */
+ if (! WIFSTOPPED (status) && ! lp)
+ {
+ status = 0;
+ continue;
+ }
+
if (! lp)
{
lp = add_lwp (BUILD_LWP (lwpid, GET_PID (inferior_ptid)));