This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] gdbserver: Fix harmless crash for current-lwp-dead.exp
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Tue, 6 Dec 2011 18:36:43 +0000
- Subject: Re: [patch] gdbserver: Fix harmless crash for current-lwp-dead.exp
- References: <20111202221043.GA28436@host2.jankratochvil.net>
On Friday 02 December 2011 22:10:43, Jan Kratochvil wrote:
> @@ -862,17 +862,26 @@ linux_kill (int pid)
> thread in the list, so do so now. */
> lwp = find_lwp_pid (pid_to_ptid (pid));
>
> - if (debug_threads)
> - fprintf (stderr, "lk_1: killing lwp %ld, for pid: %d\n",
> - lwpid_of (lwp), pid);
> -
> - do
> + if (lwp == NULL)
> {
> - ptrace (PTRACE_KILL, lwpid_of (lwp), 0, 0);
> + if (debug_threads)
> + fprintf (stderr, "lk_1: cannot find lwp %ld, for pid: %d\n",
> + lwpid_of (lwp), pid);
> + }
> + else
> + {
> + if (debug_threads)
> + fprintf (stderr, "lk_1: killing lwp %ld, for pid: %d\n",
> + lwpid_of (lwp), pid);
>
> - /* Make sure it died. The loop is most likely unnecessary. */
> - lwpid = linux_wait_for_event (lwp->head.id, &wstat, __WALL);
> - } while (lwpid > 0 && WIFSTOPPED (wstat));
> + do
> + {
> + ptrace (PTRACE_KILL, lwpid_of (lwp), 0, 0);
> +
> + /* Make sure it died. The loop is most likely unnecessary. */
> + lwpid = linux_wait_for_event (lwp->head.id, &wstat, __WALL);
> + } while (lwpid > 0 && WIFSTOPPED (wstat));
> + }
>
> the_target->mourn (process);
Hmm, do we leave the process zombie then? Should we always
waitpid it to reap it?
--
Pedro Alves