From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: 32-bit Thumb-2 breakpoints
Date: Wed, 3 Feb 2010 16:01:42 -0000 [thread overview]
Message-ID: <008a01caa4ea$2dd72f20$89858d60$@deacon@arm.com> (raw)
In-Reply-To: <20100203151449.GI4277@wear.picochip.com>
Hi Russell,
* Jamie Iles wrote:
> On Wed, Feb 03, 2010 at 02:40:22PM +0000, Russell King - ARM Linux wrote:
> > On Wed, Feb 03, 2010 at 01:59:14PM +0000, Jamie Iles wrote:
> > > Well it looks like the hardware breakpoint layer is on top of the perf_events
> > > subsystem and the breakpoint becomes a perf event. In this case the breakpoint
> > > should be scheduled in and out by perf on context switches if targetting a
> > > specific PID or could be left in the whole time if desired.
That's correct. The perf framework adds and removes the breakpoint when the
task to which it is pinned is scheduled in and out. Adding/removing a breakpoint
has the consequence of enabling/disabling it in hardware.
> > Unfortunately, we're drifting from the original topic...
> >
> > This starts worrying me more. Is execution stopped (as in actually
> > stopped, not just switched away from leaving the thread runnable) in
> > the target thread when one of these 'perf' breakpoints is hit? If
> > not, it's completely unsuitable for debuggers to use, and raises the
> > question of why it's being interfaced with the ptrace code.
> Will should be able to give a better anwer but my understanding is that at in
> the core hw_breakpoint and perf code, the event is simply logged and the pc
> recorded. The ptrace integration allows the processed to have SIGTRAP raised.
When a breakpoint is hit, a prefetch abort occurs. The hw-breakpoint code will
have installed a handler for the abort provided that the FSR shows that it is
a debug exception. The handler checks whether a breakpoint or a watchpoint occurred
and signals the event to perf using perf_bp_event. This then calls the callback
function that was registered when register_user_hw_breakpoint was called. In the case
of ptrace, the callback is ptrace_hwbreak_triggered, which sends a SIGTRAP to the current
task.
Why are you concerned about the state of execution? Even if the child is rescheduled
before the debugger takes the trap [is this possible?], it will immediately trap again
when it attempts to re-execute the faulting instruction.
As for x86, it looks like it does send the signal, but it's hidden in the do_debug
routine which is called when the hardware signals the breakpoint. This then uses
notifiers to call back into the hw-breakpoint code which will finally call back to ptrace.
Cheers,
Will
next prev parent reply other threads:[~2010-02-03 16:01 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 21:58 32-bit Thumb-2 breakpoints Daniel Jacobowitz
2010-01-11 22:35 ` Russell King - ARM Linux
2010-01-11 22:54 ` Daniel Jacobowitz
2010-01-11 23:10 ` Jamie Lokier
2010-01-11 23:15 ` Russell King - ARM Linux
2010-01-12 0:15 ` Jamie Lokier
2010-01-11 23:17 ` Daniel Jacobowitz
2010-01-12 0:17 ` Jamie Lokier
2010-01-12 0:22 ` Daniel Jacobowitz
2010-02-03 17:23 ` Jamie Lokier
2010-02-03 17:44 ` Daniel Jacobowitz
2010-02-04 22:46 ` Pavel Machek
2010-01-11 23:31 ` Russell King - ARM Linux
2010-01-11 23:51 ` Daniel Jacobowitz
2010-01-12 9:53 ` Catalin Marinas
2010-01-12 10:34 ` Catalin Marinas
2010-01-12 14:25 ` Daniel Jacobowitz
2010-01-28 20:21 ` Daniel Jacobowitz
2010-02-02 22:43 ` Russell King - ARM Linux
2010-02-03 0:50 ` Daniel Jacobowitz
2010-02-03 11:52 ` Catalin Marinas
2010-02-03 13:28 ` Russell King - ARM Linux
2010-02-03 13:48 ` Daniel Jacobowitz
2010-02-03 14:43 ` Russell King - ARM Linux
2010-02-03 14:56 ` Daniel Jacobowitz
2010-02-03 13:59 ` Jamie Iles
2010-02-03 14:40 ` Russell King - ARM Linux
2010-02-03 15:31 ` Jamie Iles
2010-02-03 16:01 ` Will Deacon [this message]
2010-02-03 15:02 ` Matthieu CASTET
2010-02-03 15:04 ` Catalin Marinas
2010-02-03 15:19 ` Nicolas Pitre
2010-02-03 15:19 ` Daniel Jacobowitz
2010-02-03 15:30 ` Russell King - ARM Linux
2010-02-03 15:35 ` Daniel Jacobowitz
2010-02-03 16:35 ` Russell King - ARM Linux
2010-02-03 17:45 ` Daniel Jacobowitz
2010-02-03 15:35 ` Nicolas Pitre
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='008a01caa4ea$2dd72f20$89858d60$@deacon@arm.com' \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).