From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9471 invoked by alias); 7 Apr 2015 17:09:49 -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 9460 invoked by uid 89); 7 Apr 2015 17:09:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD 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; Tue, 07 Apr 2015 17:09:48 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t37H9j9b016099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Apr 2015 13:09:45 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t37H9hA6021350; Tue, 7 Apr 2015 13:09:43 -0400 Message-ID: <55240F56.6050107@redhat.com> Date: Tue, 07 Apr 2015 17:09:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] [gdbserver] assert on step if !can_hardware_single_step References: <1428421925-18025-1-git-send-email-qiyaoltc@gmail.com> <1428421925-18025-2-git-send-email-qiyaoltc@gmail.com> In-Reply-To: <1428421925-18025-2-git-send-email-qiyaoltc@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-04/txt/msg00236.txt.bz2 On 04/07/2015 04:52 PM, Yao Qi wrote: > From: Yao Qi > > GDB sends vCont;s by mistake to GDBserver on arm target which doesn't > have single step at all. However, it is hard to find the problem from > the debugging log. With this patch applied, the problem is easy to > identify, like: > > (gdb) PASS: gdb.threads/non-stop-fair-events.exp: signal_thread=2: switch to thread 6 to step it > step&^M > (gdb) PASS: gdb.threads/non-stop-fair-events.exp: signal_thread=2: set 6 thread stepping > thread /home/yao/SourceCode/gnu/gdb/git/gdb/gdbserver/linux-low.c:3686: A problem internal to GDBserver has been detected.^M > linux_resume_one_lwp_throw: Assertion `step == 0' failed. > > gdb/gdbserver: > > 2015-04-02 Yao Qi > > * linux-low.c (linux_resume_one_lwp_throw): Assert on step. > --- > gdb/gdbserver/linux-low.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c > index e4c5420..bc6ab1ae 100644 > --- a/gdb/gdbserver/linux-low.c > +++ b/gdb/gdbserver/linux-low.c > @@ -3682,6 +3682,9 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, > if (the_low_target.prepare_to_resume != NULL) > the_low_target.prepare_to_resume (lwp); > > + if (!can_hardware_single_step ()) > + gdb_assert (step == 0); Yeah, I have something like that on my x86 software single-step branch, on the native side, and also in infrun.c. See: https://github.com/palves/gdb/commits/palves/x86_software_single_step https://github.com/palves/gdb/commit/52940835548c124a80bd6f381f1a463eda9bab4c ( I just realized/recalled the top commit fixes the exact same as your patch #2 :-) ) So I think your patch is a good idea. :-) But as you're suggesting it for inclusion, I have to raise the bar a little. I think gdbserver crashing/exiting due to bad input from gdb isn't ideal. This isn't gdbserver's fault after all. I think this should be an error instead. Or perhaps even better, this could stay as an assert in the backend, if server.c errors out earlier, even, while parsing the vCont;s / s packets. ( One nit, as step is a boolean, I think: gdb_assert (!step); would read more naturally. ) Thanks, Pedro Alves