44f87efc67
tcp->parent is used for only two things: (1) to send signal on detach via tgkill (need to know tgid). Solution: use tkill, it needs only tid. (2) to optimize out ptrace options setting for new tracees. Not a big deal if we drop this optimization: "set options" op is fast, doing it just one extra time once per each tracee is hardly measurable. TCB_CLONE_THREAD is a misnomer. It used only to flag sibling we attached to in startup_attach. This is used to prevent infinite recursive rescanning of /proc/PID/task. Despite the name, there is no guarantee it is set only on non-leader: if one would run "strace -f -p THREAD_ID" and THREAD_ID is *not* a thread leader, strace will happily attach to it and all siblings and will think that THREAD_ID is the leader! Which is a bug, but since we no longer detach when we think tracee is going to die, this bug no longer matters, because we do not use the knowledge about thread group leaders for anything. (We used it to delay leader's exit). IOW: after this patch strace has no need to know about threads, parents and children, and so on. Therefore it does not track that information. It treats all tracees as independent entities. Overall, this simplifies code a lot. * defs.h: Add TCB_ATTACH_DONE flag, remove TCB_CLONE_THREAD flag and struct tcb::parent field. * process.c (internal_fork): Don't set tcpchild->parent. * strace.c (startup_attach): Use TCB_ATTACH_DONE flag instead of TCB_CLONE_THREAD to avoid attach attempts on already-attached threads. Unlike TCB_CLONE_THREAD, TCB_ATTACH_DONE bit is used only temporarily, and only in this function. We clear it on every tcb before we return. (detach): Use tkill instead of tgkill. (trace): Set ptrace options on new tracees unconditionally, not only when tcp->parent == NULL. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> |
||
---|---|---|
debian | ||
freebsd | ||
linux | ||
m4 | ||
sunos4 | ||
svr4 | ||
test | ||
tests | ||
.gitignore | ||
.mailmap | ||
AUTHORS | ||
bjm.c | ||
block.c | ||
ChangeLog-CVS | ||
configure.ac | ||
COPYRIGHT | ||
count.c | ||
CREDITS.in | ||
defs.h | ||
desc.c | ||
errnoent.sh | ||
file.c | ||
git-set-file-times | ||
gitlog-to-changelog | ||
HACKING-scripts | ||
INSTALL | ||
io.c | ||
ioctl.c | ||
ioctlsort.c | ||
ipc.c | ||
make-dist | ||
Makefile.am | ||
mem.c | ||
net.c | ||
NEWS | ||
pathtrace.c | ||
PORTING | ||
proc.c | ||
process.c | ||
quota.c | ||
README | ||
README-freebsd | ||
README-hacking | ||
README-linux | ||
README-sunos4 | ||
README-svr4 | ||
resource.c | ||
scsi.c | ||
signal.c | ||
signalent.sh | ||
sock.c | ||
strace-graph | ||
strace.1 | ||
strace.c | ||
strace.spec | ||
stream.c | ||
syscall.c | ||
syscallent.sh | ||
system.c | ||
term.c | ||
time.c | ||
TODO | ||
util.c | ||
xlate.el |
This is strace 4.0, a system call tracer for SunOS 4.x, Linux, System V release 4, Solaris 2.x and Irix 5.x. strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file COPYRIGHT for details. Read the INSTALL file for generic instructions on how to install strace. If configure cannot guess your system configuration, you can specify it on the command line after the other options like this: ./configure --prefix=/usr i486-linux A single sunos4.1 binary should work on all the sun4, sun4c and sun4m kernel architectures. Let me know if sun4d doesn't work. Other i486-*-sysv4 systems may work with little or no tweaking. See the file NEWS for information on what has changed in recent versions. See the file PORTING if you like strace but it doesn't work on an operating system you use frequently. See the file CREDITS to see who has contributed to strace. See the file TODO if you feel like helping out. You can get the latest version of strace from its homepage at http://sourceforge.net/projects/strace/ . Please send bug reports and enhancements to the strace mailinglist at strace-devel@lists.sourceforge.net, or directly to Wichert Akkerman <wakkerma@debian.org>