Message ID | 1428421925-18025-2-git-send-email-qiyaoltc@gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 92762 invoked by alias); 7 Apr 2015 15:52:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 92703 invoked by uid 89); 7 Apr 2015 15:52:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f172.google.com Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 07 Apr 2015 15:52:12 +0000 Received: by pdbnk13 with SMTP id nk13so83116137pdb.0 for <gdb-patches@sourceware.org>; Tue, 07 Apr 2015 08:52:10 -0700 (PDT) X-Received: by 10.66.235.36 with SMTP id uj4mr37601902pac.123.1428421930623; Tue, 07 Apr 2015 08:52:10 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id u8sm6893859pdj.46.2015.04.07.08.52.09 for <gdb-patches@sourceware.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Apr 2015 08:52:10 -0700 (PDT) From: Yao Qi <qiyaoltc@gmail.com> To: gdb-patches@sourceware.org Subject: [PATCH 1/2] [gdbserver] assert on step if !can_hardware_single_step Date: Tue, 7 Apr 2015 16:52:04 +0100 Message-Id: <1428421925-18025-2-git-send-email-qiyaoltc@gmail.com> In-Reply-To: <1428421925-18025-1-git-send-email-qiyaoltc@gmail.com> References: <1428421925-18025-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes |
Commit Message
Yao Qi
April 7, 2015, 3:52 p.m. UTC
From: Yao Qi <yao.qi@linaro.org>
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 <yao.qi@linaro.org>
* linux-low.c (linux_resume_one_lwp_throw): Assert on step.
---
gdb/gdbserver/linux-low.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 04/07/2015 04:52 PM, Yao Qi wrote: > From: Yao Qi <yao.qi@linaro.org> > > 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 <yao.qi@linaro.org> > > * 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
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); + regcache_invalidate_thread (thread); errno = 0; lwp->stepping = step;