This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix Linux attach to signalled/stopped processes


On Thu, 10 Apr 2008 17:37:35 +0200, Daniel Jacobowitz wrote:
> I have another idea to solve the attach problem that does not involve
> redelivering signals - use WNOHANG in the initial wait if /proc
> already shows the process as stopped.  There shouldn't be a race if
> this is done after we PTRACE_ATTACH.

You can try it yourself but all the signals take some time to get delivered and
WNOHANG usually misses some signals which should get caught.


> If I run attach-stopped from your testcase in a shell, then send it a
> stop signal using kill from another window, stock GDB fails to attach
> to it - just as I'd expect, that's the bug we're discussing.  But if I
> run the attach-stopped.exp test script this part works fine.  It turns
> out that if we spawn the program in expect (even at the expect1.1>
> prompt, by hand) instead of using a shell with job control, GDB can
> attach to it just fine.

As the shell already did WAITPID on the process and ate the SIGSTOP
notification so there is no other notification left there for GDB.
A process already stopped does not generate another SIGSTOP during
PTRACE_ATTACH as signals never count.

[ Sure from info from Roland before. ]


Regards,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]