This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project.


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

strace attaching to already running process


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


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