From: dan@debian.org (Daniel Jacobowitz)
To: linux-arm-kernel@lists.infradead.org
Subject: 32-bit Thumb-2 breakpoints
Date: Mon, 11 Jan 2010 17:54:36 -0500 [thread overview]
Message-ID: <20100111225436.GA7408@caradoc.them.org> (raw)
In-Reply-To: <20100111223503.GD7925@n2100.arm.linux.org.uk>
On Mon, Jan 11, 2010 at 10:35:03PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 11, 2010 at 04:58:16PM -0500, Daniel Jacobowitz wrote:
> > The problem I'm solving is that of stepping through IT blocks. We
> > shouldn't use the BKPT instruction, which would interfere with an
> > attached hardware debugger. The undefined instruction pattern
> > currently used as a breakpoint will not trigger an exception if the IT
> > block flags prevent its execution. And without adding most of a
> > Thumb-2 simulator to GDB, we can't statically predict what the
> > next instruction will do to the CPSR flags, so we don't know which
> > of the following instructions in the IT block will be executed.
>
> Can't you read the CPSR in gdb, and look at the IT state bits? See
> A2.5.2 and CPSR register format in the ARM ARM.
I already have code to do that, but it's not enough on its own.
It's easy to tell whether the instruction at the current pc will be
executed, but hard to tell whether the following instruction will be
executed. Software single step works by computing the pc after
execution of the next instruction, and setting a breakpoint there; but
to get this right GDB would have to simulate the flag setting effects
of every possible 32-bit Thumb instruction (the 16-bit ones mostly
don't set flags inside the IT block).
In the example from my mail:
cmp r0, r0
itt eq
A: cmpeq r0, r1
B: moveq r0, r2
C: nop
The cmpeq can be an adcs.w, eors.w, et cetera. We're at A, trying to
figure out whether to put a breakpoint on B or C (both of which could
validly be branches).
It's possible I've missed something obvious, of course!
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2010-01-11 22:54 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 [this message]
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
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=20100111225436.GA7408@caradoc.them.org \
--to=dan@debian.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.