]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - sim/common/sim-watch.c
sim: watch: add basic default handler that traps
authorMike Frysinger <vapier@gentoo.org>
Wed, 13 Jan 2021 10:58:27 +0000 (05:58 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 14 Jan 2021 02:53:11 +0000 (21:53 -0500)
commitd9b1deff13c53333118cb48324a95bbf099b0f2b
treeb650df9a337606b5dc30d39338f0fb54775de71f
parent8f66807b98f7634c43149ea62e454ea8f877691d
sim: watch: add basic default handler that traps

The default watchpoint handler is NULL.  That means any port that
sets the STATE_WATCHPOINTS->pc field will crash if you try to use
the --watch options but don't configure the interrupt handler.  In
the past, you had to setup STATE_WATCHPOINTS->pc if you wanted to
support PC profiling, and while that was fixed a while ago, we have
a lot of ports who still configure it.

We already add a default set of interrupts (just "int") if the port
doesn't define any.  Let's also add a default handler that raises a
SIGTRAP.  When connected to gdb, this is a breakpoint which is what
people would expect.  When running standalone, it'll abort the sim,
but it's unclear whether there's anything better to do there.  This
really is just to make the watchpoint module more usable out of the
box for most ports with very little setup, at least inside of gdb.
sim/common/ChangeLog
sim/common/sim-watch.c