From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [RFC 0/3] Use reinsert breakpoint for vCont;s
Date: Mon, 09 May 2016 15:17:00 -0000 [thread overview]
Message-ID: <wwoktwi7l0q6.fsf@ericsson.com> (raw)
In-Reply-To: <1462530736-25117-1-git-send-email-yao.qi@linaro.org>
Yao Qi writes:
> Nowadays, reinsert breakpoint is used in GDBserver to step over a
> breakpoint. I want to use it to handle vCont;s. The motivation
> of this work is to exercise software single step in GDBserver side.
> In the past two weeks, I am fixing various test fails, but still
> can't fix all of them. I want to post something here, and hope
> people can help me on this area.
>
> Suppose GDB is able to send vCont;s to GDBserver using software
> single step (done by patch 3), what should GDBserver do? It call
> function single_step if lwp->resume->kind is resume_step. See
> patch 2.
>
> With this change, reinsert breakpoint is used for two purposes,
> 1) step over GDBserver breakpoint, 2) handle vCont;s. Here are some
> facts or assumptions in my mind,
>
> - reinsert breakpoints can be inserted for both step over and
> vCont;s together. GDBserver should finish all step-overs
> before resuming the threads, see scenario b) below,
> - GDB doesn't send more than one vCont s actions in one vCont
> packet, although RSP doc doesn't say this.
>
> It is straightforward to insert reinsert breakpoints for vCont;s,
> but I am not sure when to delete them. Here are some scenarios,
>
> a) vCont;s thread A, and vCont;c thread B. Thread A hits the reinsert
> breakpoints, and GDBserver can remove them. What is the proper
> place to remove them?
>
> b) vCont;s thread A, and vCont;c thread B. Thread B hits breakpoints
> (not reinsert), do we remove reinsert breakpoints? My answer is
> no. In the following step-over, reinsert breakpoints for step-over
> are deleted, but reinsert breakpoints for vCont;s (thread A) are still
> there.
>
> c) vCont;s thread A, and vCont;c thread B. Thread B hits the reinsert
> breakpoints (for thread A vCont;s), do we remove reinsert breakpoints?
> I think no, we can just step over it for thread B.
>
> d) vCont;s thread A, and vCont;c thread B. A signal arrives, do we remove
> reinsert breakpoints? Yes, I think so.
>
> IMO, b) requires reinsert breakpoint thread specific, so that we can delete
> reinsert breakpoints for step-over of thread B, but keep reinsert breakpoints
> for vCont;s of thread A. That is what patch 1 does.
>
> I tried different ways to remove reinsert breakpoints in GDBserver, but still
> can't fix fails in gdb.threads/schedlock.exp, that the program gets SIGILL or
> SIGSEGV. These fails can't happen in every run, and they are disappeared
> when I turn on debugging output in GDBserver. I suspect they are about the
> improper management to reinsert breakpoints.
>
I'm not sure at the moment but this makes me think of an issue I sent
here: https://www.sourceware.org/ml/gdb/2015-11/msg00030.html
Actually thanks to a good discussion with LTTng maintainer, (Mathieu
Desnoyer) last week I got the hint that this could be due to the
situation described here:
https://community.arm.com/groups/processors/blog/2010/02/17/caches-and-self-modifying-code
Short story, the instruction cache could be out of sync after we've
removed a software breakpoint and the processor would execute the
breakpoint instruction causing a SIGILL rather then the original memory.
The solution however, calling __clear_cache(...) requires that we're in
the same process for the memory addresses to be valid, I think, so I'm
not sure how to fix this yet...
I'm still early in my investigation but it may be something to consider.
> (gdb) PASS: gdb.threads/schedlock.exp: schedlock=off: cmd=next: call_function=1: next to increment (5)
> next^M
> 78 while (*myp > 0)^M
> (gdb) next^M
> ^M
> Thread 1 "schedlock" received signal SIGILL, Illegal instruction.^M
> [Switching to Thread 3797.3797]^M
> 0x000087f8 in thread_function (arg=0x0) at /home/yao/SourceCode/gnu/gdb/git/gdb/testsuite/gdb.threads/schedlock.c:78^M
> 78 while (*myp > 0)^M
> (gdb) FAIL: gdb.threads/schedlock.exp: schedlock=off: cmd=next: call_function=1: next to increment (6)
>
> Any ideas on the overall design, how to handle vCont;s in GDBserver using
> software single step? or is it a completely wrong thing to handle vCont;s
> using software single step?
>
> *** BLURB HERE ***
>
> Yao Qi (3):
> make reinsert breakpoint thread specific
> use reinsert breakpoint for vCont;s
> [GDBserver] Support vCont s and S actions with software single step
>
> gdb/gdbserver/linux-low.c | 37 ++++++++++++++++++++++++++++++++-----
> gdb/gdbserver/mem-break.c | 29 ++++++++++++++++++++++++++---
> gdb/gdbserver/mem-break.h | 13 +++++++++----
> gdb/gdbserver/server.c | 13 ++++++++-----
> 4 files changed, 75 insertions(+), 17 deletions(-)
next prev parent reply other threads:[~2016-05-09 15:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-06 10:32 Yao Qi
2016-05-06 10:32 ` [RFC 2/3] use " Yao Qi
2016-05-11 10:41 ` Yao Qi
2016-05-12 13:25 ` Antoine Tremblay
2016-05-13 12:12 ` Antoine Tremblay
[not found] ` <wwokeg97l6fe.fsf@ericsson.com>
2016-05-12 16:38 ` Yao Qi
2016-05-06 10:32 ` [PATCH 3/3] [GDBserver] Support vCont s and S actions with software single step Yao Qi
2016-05-06 10:32 ` [RFC 1/3] make reinsert breakpoint thread specific Yao Qi
2016-05-09 15:17 ` Antoine Tremblay [this message]
2016-05-10 13:29 ` [RFC 0/3] Use reinsert breakpoint for vCont;s Antoine Tremblay
2016-05-11 8:35 ` Yao Qi
2016-05-11 12:08 ` Antoine Tremblay
[not found] ` <wwokfutg3hge.fsf@ericsson.com>
2016-05-18 7:50 ` Yao Qi
2016-05-18 11:50 ` Antoine Tremblay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wwoktwi7l0q6.fsf@ericsson.com \
--to=antoine.tremblay@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox