From: Yao Qi <qiyaoltc@gmail.com>
To: Antoine Tremblay <antoine.tremblay@ericsson.com>
Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 0/9 V3] Use reinsert breakpoint for vCont;s
Date: Mon, 21 Nov 2016 12:08:00 -0000 [thread overview]
Message-ID: <20161121120822.GA28605@E107787-LIN> (raw)
In-Reply-To: <wwok4m39swrb.fsf@ericsson.com>
On Mon, Nov 14, 2016 at 02:10:32PM -0500, Antoine Tremblay wrote:
>
> > I do something slightly differently in V3. In my
> > "V2 Use reinsert breakpoint for vCont;s", I install reinsert breakpoints
> > for needed lwps in two places, linux_resume and proceed_all_lwps, which
> > isn't ideal.
> >
> > After the chat with Pedro, we don't need to stop all threads when inserting
> > reinsert breakpoint, so we can move the breakpoint installation further
> > down to linux_resume_one_thread and proceed_one_lwp.
>
> I'm following up on random SIGILL/SIGSEGV when using software single stepping/
> range stepping with GDBServer on ARM.
>
> And I can't see why we don't need to stop all threads when inserting
> reinsert breakpoint.
>
> Since linux_resume will call:
>
> find_inferior (&all_threads, linux_resume_one_thread,
> &leave_all_stopped);
>
> This will start one thread after the other. So for example if thread 3
> has a single step breakpoint to install this will start thread 1, then
> thread 2 and just modify the program's memory to install reinsert
> breakpoints on thread 3 with thread 1 and 2 running.
>
> Thus leading to thread 1 or 2 executing invalid memory, thus the SIGILL
> random problems...
Single-step breakpoint is thread specific, so we don't need to stop
other threads when inserting one for a specific thread. Given the
example above, we insert single-step breakpoint for thread 3 on address
A, if thread 1 goes through address A, but doesn't hit the breakpoint,
IOW, thread 1 still sees the original instruction, that is nothing wrong,
right? We don't expect thread 1 hits that breakpoint for thread 3 anyway.
If thread 1 hits the breakpoint (IOW, thread 1 sees the breakpoint
instruction), GDBserver just handles that SIGTRAP, and it
has already know that there is a breakpoint on address A.
Thread 1 either sees the original instruction on address A or the
breakpoint instruction. Unless ptrace read/write 32-bit is not
atomic, IOW, partial ptrace write result is visible to other
threads, I don't see why we get SIGILL here.
Note that we stop all threads when we remove single-step breakpoints
because we want no thread sees single-step breakpoint in memory from
their point of view afterwards.
--
Yao (é½å°§)
next prev parent reply other threads:[~2016-11-21 12:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-30 14:09 Yao Qi
2016-06-30 14:09 ` [PATCH 6/9] Use enqueue_pending_signal in linux_resume_one_thread Yao Qi
2016-06-30 14:09 ` [PATCH 8/9] Use reinsert_breakpoint for vCont;s Yao Qi
2016-07-01 15:07 ` Pedro Alves
2016-07-05 8:15 ` Yao Qi
2016-07-21 8:38 ` Yao Qi
2016-07-21 10:02 ` Pedro Alves
2016-06-30 14:09 ` [PATCH 4/9] Make reinsert_breakpoint thread specific Yao Qi
2016-06-30 14:09 ` [PATCH 2/9] Create sub classes of 'struct breakpoint' Yao Qi
2016-06-30 14:09 ` [PATCH 1/9] Pass breakpoint type in set_breakpoint_at Yao Qi
2016-06-30 14:09 ` [PATCH 3/9] Refactor clone_all_breakpoints Yao Qi
2016-06-30 14:09 ` [PATCH 9/9] Support vCont s and S actions with software single step Yao Qi
2016-06-30 14:09 ` [PATCH 7/9] Enqueue signal even when resuming threads Yao Qi
2016-07-01 15:06 ` Pedro Alves
2016-07-01 16:45 ` Yao Qi
2016-07-01 16:55 ` Pedro Alves
2016-07-01 17:01 ` Pedro Alves
2016-06-30 14:09 ` [PATCH 5/9] Switch current_thread to lwp's thread in install_software_single_step_breakpoints Yao Qi
2016-07-21 11:18 ` [PATCH 0/9 V3] Use reinsert breakpoint for vCont;s Yao Qi
2016-11-14 19:14 ` Antoine Tremblay
2016-11-21 12:08 ` Yao Qi [this message]
[not found] ` <wwok37ikrgmq.fsf@ericsson.com>
2016-11-23 19:03 ` Antoine Tremblay
2016-11-24 21:55 ` Yao Qi
2016-11-25 12:22 ` Antoine Tremblay
2016-11-25 13:13 ` Antoine Tremblay
2016-11-25 13:35 ` Antoine Tremblay
2016-11-25 13:44 ` Pedro Alves
2016-11-25 13:57 ` Antoine Tremblay
2016-11-25 14:28 ` 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=20161121120822.GA28605@E107787-LIN \
--to=qiyaoltc@gmail.com \
--cc=antoine.tremblay@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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