From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15407 invoked by alias); 10 Apr 2008 15:49:17 -0000 Received: (qmail 15394 invoked by uid 22791); 10 Apr 2008 15:49:17 -0000 X-Spam-Check-By: sourceware.org Received: from host0.dyn.jankratochvil.net (HELO host0.dyn.jankratochvil.net) (89.250.240.59) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Apr 2008 15:48:56 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.2/8.14.1) with ESMTP id m3AFme9x005718; Thu, 10 Apr 2008 17:48:40 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.2/8.14.2/Submit) id m3AFmdfS005716; Thu, 10 Apr 2008 17:48:39 +0200 Date: Thu, 10 Apr 2008 16:00:00 -0000 From: Jan Kratochvil To: Daniel Jacobowitz Cc: Doug Evans , GDB Patches , mark.kettenis@xs4all.nl, Roland McGrath Subject: Re: [patch] Fix Linux attach to signalled/stopped processes Message-ID: <20080410154839.GA5375@host0.dyn.jankratochvil.net> References: <20080401223012.GA14076@host0.dyn.jankratochvil.net> <20080410153735.GD21662@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080410153735.GD21662@caradoc.them.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00198.txt.bz2 On Thu, 10 Apr 2008 17:37:35 +0200, Daniel Jacobowitz wrote: > I have another idea to solve the attach problem that does not involve > redelivering signals - use WNOHANG in the initial wait if /proc > already shows the process as stopped. There shouldn't be a race if > this is done after we PTRACE_ATTACH. You can try it yourself but all the signals take some time to get delivered and WNOHANG usually misses some signals which should get caught. > If I run attach-stopped from your testcase in a shell, then send it a > stop signal using kill from another window, stock GDB fails to attach > to it - just as I'd expect, that's the bug we're discussing. But if I > run the attach-stopped.exp test script this part works fine. It turns > out that if we spawn the program in expect (even at the expect1.1> > prompt, by hand) instead of using a shell with job control, GDB can > attach to it just fine. As the shell already did WAITPID on the process and ate the SIGSTOP notification so there is no other notification left there for GDB. A process already stopped does not generate another SIGSTOP during PTRACE_ATTACH as signals never count. [ Sure from info from Roland before. ] Regards, Jan