On Wed, Jun 19, 2013 at 12:36:20AM +0400, Dmitry V. Levin wrote:
> On Tue, Jun 18, 2013 at 06:18:14PM +0200, Denys Vlasenko wrote:
> > * strace.c (detach) [USE_SEIZE]: If PTRACE_SEIZE API is in use, stop
> > the tracee using PTRACE_INTERRUPT instead of sending it a SIGSTOP.
> > In a subsequent waitpid loop, wait for either SIGSTOP or SIGTRAP.
[...]
> > @@ -810,7 +819,9 @@ detach(struct tcb *tcp)
> >                             /* Au revoir, mon ami. */
> >                             break;
> >                     }
> > -                   if (WSTOPSIG(status) == SIGSTOP) {
> > +                   if (WSTOPSIG(status) == SIGSTOP
> > +                    || WSTOPSIG(status) == SIGTRAP /* may be generated by 
> > PTRACE_INTERRUPT stop */
> > +                   ) {
> 
> In case of PTRACE_INTERRUPT this WSTOPSIG(status) is not plain SIGTRAP
> but (SIGTRAP | 0x80), which also may happen in other !use_seize cases.
> That is, the right check seems to be
>       WSTOPSIG(status) == SIGSTOP ||
>       (use_seize && WSTOPSIG(status) == (SIGTRAP | 0x80))
> It also passes both tests/detach-sleeping and tests/detach-stopped.

It still hangs while detaching from a running process
(just added tests/detach-running fails).  What seems to work so far is
        WSTOPSIG(status) == SIGSTOP ||
        (use_seize && (WSTOPSIG(status) & 0x7f) == SIGTRAP)


-- 
ldv

Attachment: pgps04DQm8jDJ.pgp
Description: PGP signature

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to