This is the mail archive of the
cygwin-developers@sourceware.cygnus.com
mailing list for the Cygwin project.
strace attaching to already running process
- To: cygwin-developers <cygwin-developers@sourceware.cygnus.com>
- Subject: strace attaching to already running process
- From: Egor Duda <deo@logos-m.ru>
- Date: Wed, 25 Aug 1999 13:19:59 +0400
- Organization: DEO
- Reply-To: Egor Duda <deo@logos-m.ru>
Hi!
I needed some debugging info from ever-running cygwin daemon, so i've
patched strace a bit to allow it to attach to already running process.
Suppling windows pid of process in a form
strace -o <file> -p <winpid>
will do the job. There's two drawbacks, however, both due to features
of DebugActiveProcess API. First -- when strace exits, debugee exits
too. And second -- '-f' option don't work. Working around second
limitation seems possible, but solution i see is quite ugly -- it
suppose that when debugee starts child processes through fork or
spawn, it'll pass DEBUG_PROCESS flag to CreateProcess, and redirect
all children's debug output to actual strace. But it will require that
debugee must stay alive as long as children are running, so, a bunch of
additional syncronization is needed. Anyway, stracing single running
process seems to work ok.
Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
strace_by_pid.diff.gz