From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51222 invoked by alias); 22 Apr 2017 17:21:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 51207 invoked by uid 89); 22 Apr 2017 17:21:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=venture, cygwin64, awaiting, wish X-HELO: sasl.smtp.pobox.com Received: from pb-smtp2.pobox.com (HELO sasl.smtp.pobox.com) (64.147.108.71) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 22 Apr 2017 17:21:14 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 04A356EFE7 for ; Sat, 22 Apr 2017 13:21:13 -0400 (EDT) Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id EFF8C6EFE6 for ; Sat, 22 Apr 2017 13:21:12 -0400 (EDT) Received: from [192.168.1.4] (unknown [76.215.41.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 5F1586EFE5 for ; Sat, 22 Apr 2017 13:21:12 -0400 (EDT) Subject: Re: long I/O delays when strace is running To: cygwin@cygwin.com References: <91DCAC3CB99C724EB365BB64677FBE7B16EBBD@MX204CL04.corp.emc.com> <46e39bce-9782-5c74-c196-35ee97ebbc64@pobox.com> <58F9D314.2000100@maxrnd.com> <7d56e728-32a3-9179-b002-e83880e297d0@pobox.com> <58FA83DB.3000209@maxrnd.com> From: Daniel Santos Message-ID: Date: Sun, 23 Apr 2017 12:58:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <58FA83DB.3000209@maxrnd.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pobox-Relay-ID: 154BD0E8-2780-11E7-A38E-C260AE2156B6-06139138!pb-smtp2.pobox.com X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00292.txt.bz2 On 04/21/2017 05:12 PM, Mark Geisert wrote: > > Re debugging strace itself, you may not realize that strace is not a > Cygwin-native program. It's a Windows-native program. So debugging > it with Cygwin gdb is problematic. > > I can tell you roughly how strace operates. It launches the target > program with CreateProcess(), not with exec(). It acts as the > debugger of the target in order to receive Windows DEBUG_EVENTs for > things like DLL loads, thread creation, etc. etc. The Cygwin DLL in > the target can tell when it's being run under strace and generates > trace lines with OutputDebugString() calls that strace receives as > DEBUG_EVENTs. strace then just outputs the trace line. > > strace does have to explicitly ContinueDebugEvent() on each > DEBUG_EVENT it receives, and if there's some issue with that then the > target program will remain suspended awaiting that continue. I've > never seen an issue with this but it's another possible place to look, > I suppose. > > Why strace appears to interact badly with /proc accesses, I have no idea. > > ..mark Well thank you, I wish I had read this earlier. I've been trying to debug (with gdb) strace (following children) and now I know why the debugger is blowing through breakpoints, because I may be debugging strace, but strace debugging it's own child. I added a _pinfo::dump () member function that I'm calling from pinfo::init () after the test "if (!created && !(flag & PID_NEW))" and it's crashing because for some processes, the entire _pinfo struct isn't mapped in, just the first page. Of course, I'm a newbie in this sphere, so maybe I've missed something and there's sometimes a reason for this? (The first part of the struct looks normal.) Otherwise, that would be another odd flaw. Anyway, I can see that the strace process's shared _pinfo object is never fully populated: _pinfo 0x30000 { pid 2800, process_state 0x00000001, ppid 0, exitcode 0 cygstarted 0, dwProcessId 0x00000AF0, progname "D:\cygwin64\bin\strace.exe", uid 0, gid 0, pgid 0, sid 0, ctty 0, has_pgid_children 0 start_time 1492881370, nice 0, stopsig 0, sendsig 0x0, exec_sendsig 0x0, exec_dwProcessId 0 } So I would venture to say that is a problem. Also, pinfo::init() should probably issure some error message if it waits 2-ish seconds and the struct still isn't correctly populated. Is there a way to debug the children of strace? It would make it a lot easier. That's part of why I wrote the _pinfo::debug(), but also when I debug strace with gdb, the _pinfo struct IS properly populated. The best problems are the ones that disappear when you try to debug them. Thanks, Daniel -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple