From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21174 invoked by alias); 25 Oct 2011 18:35:06 -0000 Received: (qmail 20947 invoked by uid 22791); 25 Oct 2011 18:35:05 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Oct 2011 18:34:38 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9PIYYkv010414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Oct 2011 14:34:35 -0400 Received: from tranklukator.englab.brq.redhat.com (dhcp-1-232.brq.redhat.com [10.34.1.232]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id p9PIYWL5018036; Tue, 25 Oct 2011 14:34:33 -0400 Received: by tranklukator.englab.brq.redhat.com (nbSMTP-1.00) for uid 500 oleg@redhat.com; Tue, 25 Oct 2011 20:30:28 +0200 (CEST) Date: Tue, 25 Oct 2011 18:38:00 -0000 From: Oleg Nesterov To: Pedro Alves Cc: Jan Kratochvil , gdb-patches@sourceware.org, Tom Tromey Subject: Re: FYI: fix 2 tests when glibc debuginfo is installed Message-ID: <20111025183022.GA25438@redhat.com> References: <201110251755.12986.pedro@codesourcery.com> <20111025173249.GA23231@redhat.com> <201110251912.26857.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201110251912.26857.pedro@codesourcery.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2011-10/txt/msg00673.txt.bz2 On 10/25, Pedro Alves wrote: > > On Tuesday 25 October 2011 18:32:49, Oleg Nesterov wrote: > > > > > and that gdb will have to > > > `kill -SIGCONT' the inferior itself if it wants e.g., inferior > > > function calls to work after attaching to a stopped process > > > > Why? PTRACE_CONT/etc should work. The tracee will be resumed, stopped > > or not. > > Eh, well, I read some discussions from earlier this year on > lkml proposing that, and I guess I got confused. Yes, we discussed this option too. And yes, the discussion was loooooooooooooooooong and confusing ;) > > But, compared to the old kernels, the tracee "remembers" the > > fact it was stopped, and it will stop again after DETACH. Unless SIGCONT > > in between. > > What about PTRACE_CONT in between (no SIGCONT)? Does it make the > kernel "forget" the fact that the child was stopped before? No, > If not, what happens if the ptracer dies while its child > is PTRACE_CONT'ed, and the child was stopped at PTRACE_ATTACH time? This doesn't differ from the explicit PTRACE_DETACH. Actually, this is very simple. We have the per-process (_not_ per thread/tracee) flag, SIGNAL_STOP_STOPPED. It means that this thread group is stopped (OK, it is not that simple, but we can ignore details). ptrace can never set/clear this flag. In particular it is still set after PTRACE_CONT or whatever resumes the tracee. Only SIGCONT clears SIGNAL_STOP_STOPPED. Now, __ptrace_unlink() (called by PTRACE_DETACH or by the dying tracee) checks SIGNAL_STOP_STOPPED, if it is set we ask the tracee to stop again. Oleg.