From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28540 invoked by alias); 19 Sep 2014 16:16:10 -0000 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 Received: (qmail 28434 invoked by uid 89); 19 Sep 2014 16:16:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 19 Sep 2014 16:16:08 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8JGG4Zo022906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 19 Sep 2014 12:16:05 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8JGG2DZ008871; Fri, 19 Sep 2014 12:16:03 -0400 Message-ID: <541C56C2.7050604@redhat.com> Date: Fri, 19 Sep 2014 16:16:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Gary Benson , gdb-patches@sourceware.org CC: Doug Evans Subject: Re: [PATCH 3/3] Wait for target to stop before running agent commands References: <1411034346-868-1-git-send-email-gbenson@redhat.com> <1411034346-868-4-git-send-email-gbenson@redhat.com> In-Reply-To: <1411034346-868-4-git-send-email-gbenson@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-09/txt/msg00631.txt.bz2 On 09/18/2014 10:59 AM, Gary Benson wrote: > This commit fixes a bug on where agent_run_command is called on > GNU/Linux targets that may not have stopped yet. > > gdb/ChangeLog: > > * linux-nat.c (linux_child_static_tracepoint_markers_by_strid): > Use target_stop_and_wait in place of target_stop. > --- > gdb/ChangeLog | 5 +++++ > gdb/linux-nat.c | 2 +- > 2 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c > index 5a82d23..f2895ff 100644 > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -4458,7 +4458,7 @@ linux_child_static_tracepoint_markers_by_strid (struct target_ops *self, > ptid_t ptid = ptid_build (pid, 0, 0); > > /* Pause all */ > - target_stop (ptid); > + target_stop_and_wait (ptid); More would be needed for fix this fully. Unlike the comment above suggests, target_stop_and_wait only waits for one thread to stop, not all. See the gdbserver version (run_inferior_command) -- this is also missing uninserting breakpoints after fully pausing the target. If we handle this internally to linux-nat.c, then similarly to gdbserver's version, this could use stop_callback/stop_wait_callback to leave pending any events that pausing might trip on. Then we'd need to be careful to only re-resume threads that were already resumed before, and leave those with pending events stopped. If we want to use existing target methods, then we need to teach gdb's struct thread_info layer about leaving events pending, like in: https://sourceware.org/ml/gdb-patches/2011-12/msg00564.html Alternative, we can would promote target_stop_and_wait to a real target method that handles the leaving of events pending, like gdbserver's pause_all/unpause_all methods. Thanks, Pedro Alves