On 27 Feb 2015 05:30, Dmitry V. Levin wrote:
> On Thu, Feb 26, 2015 at 05:56:43PM -0500, Mike Frysinger wrote:
> > detach-stopped.test.tmp contains just this:
> > Process 1267 attached
> > restart_syscall(<... resuming interrupted call ...>
> 
> That is, either "kill -STOP" failed to stop "sleep" or PTRACE_EVENT_STOP
> hasn't been delivered to strace.  How could it be?

tl;dr: sent you a patch

doing it by hand shows the same behavior:
$ ./set_ptracer_any sleep 100000 &
$ kill -STOP $!
$ ../strace -p $!
Process 21534 attached
restart_syscall(<... resuming interrupted call ...>^CProcess 21534 detached
 <detached ...>

if i use previous versions, it works:
$ strace -V
strace -- version 4.6
$ strace -p $!
Process 21534 attached - interrupt to quit
--- {si_signo=SIGSTOP, si_code=SI_USER, si_value={int=4294303860, 
ptr=0xfff5e074}} (Stopped (signal)) ---
--- Stopped (signal) by SIGSTOP ---
restart_syscall(<... resuming interrupted call ...>^C <unfinished ...>
Process 21534 detached

$ strace -V
strace -- version 4.9
$ strace -p $!
Process 21534 attached
--- stopped by SIGSTOP ---
^CProcess 21534 detached

bisecting shows fadf379b8e3618585cecad447867af27930ac5e3.  which looks a little 
odd, but seems pretty reliable on my end.  reverting defs.h & strace.c in that 
patch gets me a working version.  diving further, this gets me a working 
version with ToT:
--- a/strace.c
+++ b/strace.c
@@ -45,6 +45,9 @@
 
 #include "ptrace.h"
 
+#undef PTRACE_EVENT_STOP
+#define PTRACE_EVENT_STOP      128
+
 /* In some libc, these aren't declared. Do it ourself: */
 extern char **environ;
 extern int optind;

this is because the linux-headers i have come from linux-3.3 and do:
/usr/include/linux/ptrace.h:#define PTRACE_EVENT_STOP   7

looking at the kernel history, this value was broken in linux 3.1, 3.2, and 
3.3.  
it was fixed here for 3.4:
commit 5cdf389aee90109e2e3d88085dea4dd5508a3be7
Author: Denys Vlasenko <vda.li...@googlemail.com>
Date:   Fri Mar 23 15:02:42 2012 -0700

    ptrace: renumber PTRACE_EVENT_STOP so that future new options and events 
can match

i guess my decision to try and keep a variety of toolchain/kernel versions has 
paid off :).
-mike

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to