Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com Date: Wed, 25 Aug 1999 13:19:59 +0400 From: Egor Duda X-Mailer: The Bat! (v1.029) S/N A0F2A05A Reply-To: Egor Duda Organization: DEO Message-ID: <9555.990825@logos-m.ru> To: cygwin-developers Subject: strace attaching to already running process Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------33104228565668" ------------33104228565668 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 -p 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 AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19 ------------33104228565668 Content-Type: application/x-gzip; name="strace_by_pid.diff.gz" Content-Transfer-Encoding: X-UUE Content-Disposition: attachment; filename="strace_by_pid.diff.gz" filetime 655977088 begin 644 strace_by_pid.diff.gz M'XL("`+5]P:60N9&EF9@#-6&U3VT AT 2_@R_HN,KP"^R MD2P9C+U)%0D.RQ:!JX14[BJ[ZY*EL:5%EE2:,5XVQ7^_[IG1BVV1NZNDMN(/ M(&MZ>OKEZ:=[[(?S.70]&[H9K,.8K])C'B[2+/%ZGJ??]*S*N_UVN[TKN7<7 MK.!\M0"K#Y8S,H>C_ AT E89V=G^]UNMT[-WB?FJPU#L,R1/1S13MK0WOS(\ZR! MT3=!?B5]]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