From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7695 invoked by alias); 25 Nov 2015 15:06:46 -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 7682 invoked by uid 89); 25 Nov 2015 15:06:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_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; Wed, 25 Nov 2015 15:06:44 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 6043BC0D2256; Wed, 25 Nov 2015 15:06:43 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAPF6f6D011213; Wed, 25 Nov 2015 10:06:42 -0500 Message-ID: <5655CE81.3090603@redhat.com> Date: Wed, 25 Nov 2015 15:06:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH 11/18] gdbserver: fix killed-outside.exp References: <1444836486-25679-1-git-send-email-palves@redhat.com> <1444836486-25679-12-git-send-email-palves@redhat.com> <86ziz4zlof.fsf@gmail.com> In-Reply-To: <86ziz4zlof.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-11/txt/msg00518.txt.bz2 Hi Yao, It's taking me a bit to go through your comments. Thanks for the review, and sorry about that. On 10/27/2015 09:48 AM, Yao Qi wrote: > Pedro Alves writes: > >> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c >> index 1c447c2..af9ca22 100644 >> --- a/gdb/gdbserver/linux-low.c >> +++ b/gdb/gdbserver/linux-low.c >> @@ -1535,12 +1535,6 @@ thread_still_has_status_pending_p (struct thread_info *thread) >> if (!lp->status_pending_p) >> return 0; >> >> - /* If we got a `vCont;t', but we haven't reported a stop yet, do >> - report any status pending the LWP may have. */ >> - if (thread->last_resume_kind == resume_stop >> - && thread->last_status.kind != TARGET_WAITKIND_IGNORE) >> - return 0; >> - > > Shouldn't we return 1 instead of 0 here? This is consistent with the > comments above. I may have misunderstood what you mean, but if we remove this code, that's what we get -- the "return 1;" at the end is reached. > >> if (thread->last_resume_kind != resume_stop >> && (lp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT >> || lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT)) >> @@ -1597,6 +1591,24 @@ thread_still_has_status_pending_p (struct thread_info *thread) >> return 1; >> } >> >> +/* Returns true if LWP is resumed from the client's perspective. */ >> + >> +static int >> +lwp_resumed (struct lwp_info *lwp) >> +{ >> + struct thread_info *thread = get_lwp_thread (lwp); >> + >> + if (thread->last_resume_kind != resume_stop) >> + return 1; >> + >> + /* Did we get a `vCont;t', but we haven't reported a stop yet? */ >> + if (thread->last_resume_kind == resume_stop >> + && thread->last_status.kind == TARGET_WAITKIND_IGNORE) >> + return 1; >> + > > I feel "reported" isn't precise. Is "got" better? The code means > GDBserver has already got vCont;t and sent SIGSTOP, but hasn't *got* > stop event out of event loop. After GDBserver got this event, it then > reports the event back to GDB if needed. Hmm, reported to gdb is really what I mean. How about this: /* Did gdb send us a `vCont;t', but we haven't reported the corresponding stop to gdb yet? If so, the thread is still resumed/running from gdb's perspective. */ if (thread->last_resume_kind == resume_stop && thread->last_status.kind == TARGET_WAITKIND_IGNORE) return 1; Thanks, Pedro Alves