* linux-nat.c (exit_lwp): Fix NULL pointer access.

(linux_nat_handle_extended): New parameter STOPPING.
	(wait_lwp): Call it with STOPPING equals 1.
	(linux_nat_wait): Call it with STOPPING equals 0.
This commit is contained in:
Ulrich Weigand 2006-05-05 23:48:28 +00:00
parent d539ed7ecd
commit 6fc191037f
2 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2006-05-05 Ulrich Weigand <uweigand@de.ibm.com>
* linux-nat.c (exit_lwp): Fix NULL pointer access.
(linux_nat_handle_extended): New parameter STOPPING.
(wait_lwp): Call it with STOPPING equals 1.
(linux_nat_wait): Call it with STOPPING equals 0.
2006-05-05 Ulrich Weigand <uweigand@de.ibm.com> 2006-05-05 Ulrich Weigand <uweigand@de.ibm.com>
* linux-nat.c (linux_nat_wait): Do not short-cut reporting * linux-nat.c (linux_nat_wait): Do not short-cut reporting

View File

@ -900,10 +900,13 @@ exit_lwp (struct lwp_info *lp)
struct thread_info *thr; struct thread_info *thr;
thr = iterate_over_threads (find_thread_from_lwp, &lp->ptid); thr = iterate_over_threads (find_thread_from_lwp, &lp->ptid);
if (thr && !ptid_equal (thr->ptid, inferior_ptid)) if (thr)
delete_thread (thr->ptid); {
else if (!ptid_equal (thr->ptid, inferior_ptid))
record_dead_thread (thr->ptid); delete_thread (thr->ptid);
else
record_dead_thread (thr->ptid);
}
} }
delete_lwp (lp->ptid); delete_lwp (lp->ptid);
@ -1279,10 +1282,11 @@ kill_lwp (int lwpid, int signo)
just pass off to linux_handle_extended_wait, but if it reports a just pass off to linux_handle_extended_wait, but if it reports a
clone event we need to add the new LWP to our list (and not report clone event we need to add the new LWP to our list (and not report
the trap to higher layers). This function returns non-zero if the trap to higher layers). This function returns non-zero if
the event should be ignored and we should wait again. */ the event should be ignored and we should wait again. If STOPPING
is true, the new LWP remains stopped, otherwise it is continued. */
static int static int
linux_nat_handle_extended (struct lwp_info *lp, int status) linux_nat_handle_extended (struct lwp_info *lp, int status, int stopping)
{ {
linux_handle_extended_wait (GET_LWP (lp->ptid), status, linux_handle_extended_wait (GET_LWP (lp->ptid), status,
&lp->waitstatus); &lp->waitstatus);
@ -1294,7 +1298,11 @@ linux_nat_handle_extended (struct lwp_info *lp, int status)
new_lp = add_lwp (BUILD_LWP (lp->waitstatus.value.related_pid, new_lp = add_lwp (BUILD_LWP (lp->waitstatus.value.related_pid,
GET_PID (inferior_ptid))); GET_PID (inferior_ptid)));
new_lp->cloned = 1; new_lp->cloned = 1;
new_lp->stopped = 1;
if (stopping)
new_lp->stopped = 1;
else
ptrace (PTRACE_CONT, lp->waitstatus.value.related_pid, 0, 0);
lp->waitstatus.kind = TARGET_WAITKIND_IGNORE; lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
@ -1378,7 +1386,7 @@ wait_lwp (struct lwp_info *lp)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"WL: Handling extended status 0x%06x\n", "WL: Handling extended status 0x%06x\n",
status); status);
if (linux_nat_handle_extended (lp, status)) if (linux_nat_handle_extended (lp, status, 1))
return wait_lwp (lp); return wait_lwp (lp);
} }
@ -2023,7 +2031,7 @@ retry:
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
"LLW: Handling extended status 0x%06x\n", "LLW: Handling extended status 0x%06x\n",
status); status);
if (linux_nat_handle_extended (lp, status)) if (linux_nat_handle_extended (lp, status, 0))
{ {
status = 0; status = 0;
continue; continue;