From: Daniel Jacobowitz <dan@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch/ARM] Add support for single-stepping through IF-THEN blocks
Date: Fri, 29 Jan 2010 15:34:00 -0000 [thread overview]
Message-ID: <20100129153442.GB30542@caradoc.them.org> (raw)
In-Reply-To: <20100129042431.GD26827@adacore.com>
On Fri, Jan 29, 2010 at 08:24:31AM +0400, Joel Brobecker wrote:
> > 1) We use an undefined instruction, rather than the architectural BKPT
> > instruction, as the GNU/Linux software breakpoint. If a hardware
> > debugger is connected to the system, BKPT will trigger it.
>
> I don't understand why we cannot use the BKPT insn... Suppose we put
> a BKPT at the beginning of each block, what would happen? Would we
> get a SIGTRAP even if the insn wasn't supposed to be called?
Suppose you've got a system with a JTAG port and an Ethernet port.
In fact, you don't actually need the Ethernet port - you can use a
virtual Ethernet port over JTAG, with some of the fancier probes.
You've got a debugger connected to the JTAG port because you are
stress testing the system and want to stop on some unexpected fault
condition. Or maybe it's in your data center and you just leave the
JTAG connected all the time.
Now someone goes and uses gdb or gdbserver on the target. If GDB
inserts a BKPT instruction, that will trigger the hardware debugger.
The kernel will never get control and it will never manage to generate
the expected SIGTRAP.
Obviously, you don't do this with production systems - the BKPT
becomes a trivial way to halt the device. But I've been careful of
this issue ever since I first got burned by it on PowerPC hardware,
which IIRC has a similar setup.
So we have to avoid BKPT for user-mode debug.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2010-01-29 15:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-28 22:41 Daniel Jacobowitz
2010-01-29 4:25 ` Joel Brobecker
2010-01-29 15:34 ` Daniel Jacobowitz [this message]
2010-02-01 16:13 ` Daniel Jacobowitz
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=20100129153442.GB30542@caradoc.them.org \
--to=dan@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.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