[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110113155120.GA31691@redhat.com>
Date: Thu, 13 Jan 2011 16:51:20 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Jan Kratochvil <jan.kratochvil@...hat.com>
Cc: Tejun Heo <tj@...nel.org>, roland@...hat.com,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org
Subject: Re: [PATCHSET RFC] ptrace,signal: clean transition between STOPPED
and TRACED
On 01/12, Jan Kratochvil wrote:
>
> FSF GDB for `T (stopped)' processes currently does:
> PTRACE_ATTACH
> check /proc/%d/status for `T (stopped)' (by GDB's pid_is_stopped)
> if found then kill (PID, SIGSTOP) && ptrace (PTRACE_CONT, PID, 0, 0).
> waitpid (pid, &status, 0) - so that this one does not get stuck if the stop
> event was already eaten out before.
>
> If the `T (stopped)' will now always FAIL then at leat the waitpid then should
> never get stuck.
I think it won't stuck. With this change the tracee always goes from
TASK_STOPPED to TASK_TRACED with the correct (and nonzero) stop code.
Btw, this should fix the case when ->exit_code was already consumed
by the previous debugger.
> FSF gdbserver --multi does PTRACE_ATTACH followed by waitpid (WNOHANG) and it
> fails if it returns ECHILD on the first try.
Not sure I understand... With or without this change waitpid()
shouldn't return ECHILD. But (again, with or without this change)
it can return 0 due to WNOHANG.
> ptrace(PTRACE_ATTACH, 22049, 0, 0) = 0
> wait4(-1, [{WIFSTOPPED(s) && WSTOPSIG(s) == SIGSTOP}], WNOHANG, NULL) = 22049
>
> It may be also a gdbserver bug, though.
I do not know if this matters or not, but just in case...
gdb shouldn't assume the tracee will report SIGSTOP after attach.
Yes, PTRACE_ATTACH sends this signal implicitly, but the tracee can
dequeue and report another pending signal before SIGSTOP.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists