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


> 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.

To be pedantic about it: a SIGSTOP is generated, but causes no wakeup or
delivery for ptrace to see (because it's already stopped).  You can see
the SIGSTOP pending in /proc/pid/status.  Generating a SIGCONT clears
any pending stop signals, so normally it's as if it never existed.  But,
I think if you were to do PTRACE_CONT,pid,0,0 you would make it wake up,
dequeue the new SIGSTOP and then report to you for wait/SIGCHLD.  And
since PTRACE_CONT would give ESRCH if it weren't stopped yet, you might
be able to do PTRACE_ATTACH;PTRACE_CONT;wait reliably.  But don't hold
me to it.


Thanks,
Roland


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