From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v3 10/17] Implement all-stop on top of a target running non-stop mode
Date: Tue, 19 May 2015 18:08:00 -0000 [thread overview]
Message-ID: <555B7C14.1020504@redhat.com> (raw)
In-Reply-To: <86h9s6x9eo.fsf@gmail.com>
Hi Yao,
I had not realized I missed answering this.
On 04/24/2015 08:39 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>>> This path is about the case that a signal is got while in in-line
>>> stepping, isn't? If so, non_stop should be an invariant false. We
>>> don't need to check it.
>>
>> Hmm, not sure what you mean:
>>
>
> Let me ask it in another way, when we get here, it means a signal
> arrived, the code some lines above is:
>
> if (debug_infrun)
> fprintf_unfiltered (gdb_stdlog,
> "infrun: signal arrived while stepping over "
> "breakpoint\n");
>
> GDB just did the breakpoint step over, via in-line stepping or
> out-of-line stepping, right? as your patch below shows.
>
>> - We need to do this with displaced stepping too, because we can't
>> deliver signals while doing a displaced step. See comments at the
>> top of displaced_step_prepare and in do_target_resume.
>
> The first sentence is contradictory, or you mean we *can* do either
> out-of-line stepping or in-line stepping, but we can't deliver a signal
> while doing a displaced stepping...
By "need to do this" I meant that we need to cancel the step over in
progress, and insert the step-resume at the signal handlers return.
>
>>
>> - We can certainly get a signal while doing an in-line step-over.
>> The simplest would be, trying to step-over a breakpoint here:
>>
>> *(volatile int *)0 = 1;
>>
>> which usually results SIGSEGV.
>
> ... while we can deliver a signal in in-line stepping. Is it correct?
>
Not really.
We can't deliver a signal while a displaced step is in
progress, because we wouldn't be able to tell whether the thread stepped
to the handler or to main line code, so we wouldn't know whether to apply
the displaced step fixup. Also, if the thread stops for some reason while
in the handler, we'd end up with the scratch pad still in the frame chain,
so later when the thread is re-resumed, it'd return to the scratch pad, but
the scratch pad would have already have been overwritten.
And we can't deliver a signal while stepping over a breakpoint in-line
either, because that requires removing the breakpoint, and the signal handler
can recurse and call the same code that had the breakpoint we were
stepping over -- which would mean we'd miss trapping on that breakpoint.
(this is tested by signest.exp).
So the only difference between stepping over a breakpoint in-line or
out-of-line here, is that with the former, threads had been previously
paused, so we re-resume them while the signal handler runs (to avoid
debugger-induced inferior deadlock).
Let me know if that answered your question.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-05-19 18:08 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 10:47 [PATCH v3 00/23] All-stop on top of non-stop Pedro Alves
2015-04-17 10:45 ` [PATCH v3 03/17] remote.c/all-stop: Implement TARGET_WAITKIND_NO_RESUMED and TARGET_WNOHANG Pedro Alves
2015-04-17 10:45 ` [PATCH v3 15/17] PPC64: Fix gdb.arch/ppc64-atomic-inst.exp with displaced stepping Pedro Alves
2015-04-21 11:21 ` Yao Qi
2015-04-22 20:04 ` Pedro Alves
2015-04-17 10:45 ` [PATCH v3 08/17] Factor out code to re-resume stepped thread Pedro Alves
2015-04-17 10:45 ` [PATCH v3 06/17] Use keep_going in proceed and start_step_over too Pedro Alves
2015-04-22 5:09 ` Doug Evans
2015-04-22 22:22 ` Pedro Alves
2015-04-17 10:45 ` [PATCH v3 13/17] Fix step-over-{trips-on-watchpoint|lands-on-breakpoint}.exp race Pedro Alves
2015-04-17 10:45 ` [PATCH v3 05/17] Embed the pending step-over chain in thread_info objects Pedro Alves
2015-04-21 8:28 ` Yao Qi
2015-04-22 20:14 ` Pedro Alves
2015-04-21 9:53 ` Yao Qi
2015-04-22 19:07 ` Pedro Alves
2015-04-22 4:25 ` Doug Evans
2015-04-22 22:19 ` Pedro Alves
2015-04-17 10:45 ` [PATCH v3 04/17] Make thread_still_needs_step_over consider stepping_over_watchpoint too Pedro Alves
2015-04-17 10:45 ` [PATCH v3 11/17] Fix signal-while-stepping-over-bp-other-thread.exp on targets always in non-stop Pedro Alves
2015-04-17 10:45 ` [PATCH v3 02/17] Change adjust_pc_after_break's prototype Pedro Alves
2015-04-17 10:47 ` [PATCH v3 01/17] Fix and test "checkpoint" in non-stop mode Pedro Alves
2015-04-21 2:36 ` Doug Evans
2015-04-22 17:48 ` Pedro Alves
2015-04-28 18:18 ` Doug Evans
2015-04-29 4:56 ` Doug Evans
2015-05-19 18:08 ` Pedro Alves
2015-04-17 10:47 ` [PATCH v3 07/17] Misc switch_back_to_stepped_thread cleanups Pedro Alves
2015-04-21 9:50 ` Yao Qi
2015-04-22 20:04 ` Pedro Alves
2015-04-22 5:23 ` Doug Evans
2015-04-22 20:05 ` Pedro Alves
2015-04-28 20:28 ` Doug Evans
2015-04-17 10:47 ` [PATCH v3 17/17] native Linux: enable always non-stop by default Pedro Alves
2015-04-17 10:52 ` [PATCH v3 09/17] Teach non-stop to do in-line step-overs (stop all, step, restart) Pedro Alves
2015-04-17 11:01 ` Pedro Alves
2015-04-21 15:01 ` Yao Qi
2015-04-22 20:03 ` Pedro Alves
2015-04-24 9:06 ` Yao Qi
2015-04-27 20:17 ` Doug Evans
2015-05-19 18:09 ` Pedro Alves
2015-05-19 18:49 ` Pedro Alves
2015-04-17 10:52 ` [PATCH v3 12/17] Fix interrupt-noterm.exp on targets always in non-stop Pedro Alves
2015-04-21 11:40 ` Yao Qi
2015-04-22 20:03 ` Pedro Alves
2015-04-17 10:56 ` [PATCH v3 14/17] Disable displaced stepping if trying it fails Pedro Alves
2015-04-17 11:06 ` [PATCH v3 16/17] S/390: displaced stepping and PC-relative RIL-b/RIL-c instructions Pedro Alves
2015-04-17 11:38 ` [PATCH v3 10/17] Implement all-stop on top of a target running non-stop mode Pedro Alves
2015-04-21 11:09 ` Yao Qi
2015-04-22 20:16 ` Pedro Alves
2015-04-24 7:39 ` Yao Qi
2015-05-19 18:08 ` Pedro Alves [this message]
2015-05-21 9:17 ` Yao Qi
2015-04-20 12:02 ` [PATCH v3 00/23] All-stop on top of non-stop Yao Qi
2015-04-20 16:54 ` Sergio Durigan Junior
[not found] ` <553526D0.9030802@redhat.com>
2015-04-21 7:48 ` Yao Qi
2015-04-21 15:05 ` Yao Qi
2015-04-22 22:27 ` Pedro Alves
2015-04-20 17:35 ` Simon Marchi
2015-05-19 18:14 ` Pedro Alves
2015-05-18 21:27 [PATCH v3 10/17] Implement all-stop on top of a target running non-stop mode Doug Evans
2015-05-19 19:19 ` Pedro Alves
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=555B7C14.1020504@redhat.com \
--to=palves@redhat.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