From: Pedro Alves <pedro@codesourcery.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc][rft (procfs, nto-procfs)] Fix signal bypass heuristic with software single-step
Date: Tue, 22 Mar 2011 17:25:00 -0000 [thread overview]
Message-ID: <201103221618.21253.pedro@codesourcery.com> (raw)
In-Reply-To: <201103182020.p2IKKnoF003371@d06av02.portsmouth.uk.ibm.com>
On Friday 18 March 2011 20:20:49, Ulrich Weigand wrote:
> Hello,
>
> several targets today implement a performance optimization where some signals
> are not reported back to the GDB core, but instead are directly delivered to
> the target; this can be done either by not even trapping those signals (e.g.
> procfs targets), by restarting the inferior directly in target code (e.g.
> linux-nat), or by restarting the inferior in the remote stub.
>
> This works via a target callback to_notice_signal, which is called whenever
> the list of signals to be handled by GDB changes. Target code is then
> expected to itself detect which signals are safe to short-circuit (by calling
> signal_pass_state) etc. Target code must also handle (implicitly defined)
> special cases, e.g. that signals must always be reported during startup
> or when single-stepping.
>
> It is this last condition that causes problems on architectures that use
> software single-step, because target code isn't even aware of that
> condition in general. This causes failures on ARM, see the discussion here:
> http://sourceware.org/ml/gdb-patches/2011-01/msg00398.html
>
> The solution that was discussed there is basically to make the implicit
> rules of signal passing shortcuts explicit. The patch below is an
> attempt to implement this idea. The basic concept is to remove the
> to_notice_signals callback and replace it by a to_pass_signals callback,
> which explicitly gets a list of signals that can be safely bypassed
> at this point.
>
> Common code then calls this new target callback as appropriate, in
> particular to mark all signals non-bypassable when single-stepping.
>
> All platforms using to_notice_signals (procfs, nto-procfs, remote)
> or directly accessing signal_pass_state etc (linux-nat) are updated
> to instead use the to_pass_signals callback.
>
> Tested on i386-linux, both native and gdbserver, with no regressions.
> Fixes the same set of failures on ARM as the original patch.
>
> Any thoughts on this approach?
As discussed before, I like the approach, but I have a couple of remarks
to the implementation:
- There are more calls to target_resume in infrun.c. Don't we need
to consider signals around those?
- In non-stop, if you have this sequence:
- step thread 1
- continue thread 2 (imediately afterwards)
- thread 1 gets signal FOO (which is normally pass-able).
when handling the latter event, since the "signal_pass" set is
global, and has been filled by the previous continue, the target
will think it doesn't need to report the signal back to core gdb.
You've said before about this when I raised the issue before:
"If the implementation is conservative in the right direction,
the worst thing that could happen is that a signal is reported that
might have gotten short-circuited .."
Might be we just need to check if _any_ thread is stepping, when
deciding whether to tell the target to report back all signals?
--
Pedro Alves
next prev parent reply other threads:[~2011-03-22 16:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-19 1:54 Ulrich Weigand
2011-03-22 17:25 ` Pedro Alves [this message]
2011-03-24 16:39 ` Ulrich Weigand
2011-03-31 19:42 ` [rfc v2][rft " Ulrich Weigand
2011-04-04 9:47 ` Pedro Alves
2011-04-05 19:22 ` Ulrich Weigand
2011-04-05 19:33 ` Aleksandar Ristovski
2011-04-05 22:56 ` Ulrich Weigand
2011-04-06 1:37 ` Aleksandar Ristovski
2011-04-06 17:00 ` Ulrich Weigand
2011-04-26 17:34 ` Ulrich Weigand
2011-04-06 6:07 ` Joel Brobecker
2011-04-06 17:01 ` Ulrich Weigand
2011-04-27 1:12 ` Joel Brobecker
2011-04-27 13:31 ` Ulrich Weigand
2011-03-22 17:37 ` [rfc][rft " Tom Tromey
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=201103221618.21253.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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