From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3761 invoked by alias); 11 Apr 2008 22:20:32 -0000 Received: (qmail 3752 invoked by uid 22791); 11 Apr 2008 22:20:31 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 11 Apr 2008 22:20:01 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 99DE2980FC; Fri, 11 Apr 2008 22:19:59 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 778E9980FB; Fri, 11 Apr 2008 22:19:59 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JkRbC-0005rG-Q2; Fri, 11 Apr 2008 18:19:58 -0400 Date: Fri, 11 Apr 2008 22:25:00 -0000 From: Daniel Jacobowitz To: Pedro Alves Cc: gdb-patches@sourceware.org, Roland McGrath , Jan Kratochvil , Doug Evans , mark.kettenis@xs4all.nl Subject: Re: [patch] Fix Linux attach to signalled/stopped processes Message-ID: <20080411221958.GA21910@caradoc.them.org> Mail-Followup-To: Pedro Alves , gdb-patches@sourceware.org, Roland McGrath , Jan Kratochvil , Doug Evans , mark.kettenis@xs4all.nl References: <20080410231205.2DBFD26F992@magilla.localdomain> <20080411210221.GA13599@caradoc.them.org> <200804112300.38076.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200804112300.38076.pedro@codesourcery.com> User-Agent: Mutt/1.5.17 (2007-12-11) 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/msg00228.txt.bz2 On Fri, Apr 11, 2008 at 11:00:37PM +0100, Pedro Alves wrote: >  > +  /* Pass on the last signal, if appropriate.  */ > > +  if (lp->status == 0 && GET_LWP (lp->ptid) == GET_LWP (inferior_ptid) > > +      && stop_signal != TARGET_SIGNAL_0 && signal_pass_state (stop_signal)) > > +    lp->status = W_STOPCODE (target_signal_to_host (stop_signal)); > > You're writing to lp->status of inferior_ptid, which isn't garantied > to be the main thread or the thread that got the last signal (user > may have used the "thread" command to switch threads, or we're stopped > at a breakpoint in some other thread not the main one, for example, or > the kernel decided to send the signal to some other thread because the > main one was already stopped?). I want the ptid associated with the global variable stop_signal. It's deliberately not the ptid of the main thread but I hadn't thought about the thread command. Any idea how to do this? Is that variable context-switched (or should it be)? > >-  iterate_over_lwps (detach_callback, NULL); > >+  iterate_over_lwps (detach_callback, &status); > > > > Passing &status seems bogus, since you're passing the status > in lp->status ? Stray from the previous version. Removed, thanks. > I don't see where you're actually sending the signal. Even if you > did, it isn't guarantied you are passing this signal. It will miss it > if inferior_ptid isn't the main thread. See comments above. > > Also, why the alloca dance instead of using > "Sending signal %d to %s\n" directly, if you're not doing anything > else with args? AKA, what's the plan for args? These two are related - it goes to inf_ptrace_detach just outside the range of the context diff. > What's supposed to happen if stop_signal was a SIGTRAP ? Then it shouldn't have signal_pass_state set. -- Daniel Jacobowitz CodeSourcery