aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/sim-watch.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 76d86ea..3571c95 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
2021-01-13 Mike Frysinger <vapier@gentoo.org>
+ * sim-watch.c (default_interrupt_handler): Define.
+ (sim_watchpoint_install): Set default interrupt_handler to new
+ default_interrupt_handler.
+
+2021-01-13 Mike Frysinger <vapier@gentoo.org>
+
* sim-watch.c (do_watchpoint_create): Parse arg+1 and assign to arg1.
2021-01-13 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 29ac982..6d17729 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -376,7 +376,16 @@ static const OPTION watchpoint_options[] =
static const char *default_interrupt_names[] = { "int", 0, };
-
+/* This default handler is "good enough" for targets that just want to trap into
+ gdb when watchpoints are hit, and have only configured STATE_WATCHPOINTS pc &
+ sizeof_pc fields. */
+static void
+default_interrupt_handler (SIM_DESC sd, void *data)
+{
+ sim_cpu *cpu = STATE_CPU (sd, 0);
+ address_word cia = CPU_PC_GET (cpu);
+ sim_engine_halt (sd, cpu, NULL, cia, sim_stopped, SIM_SIGTRAP);
+}
SIM_RC
sim_watchpoint_install (SIM_DESC sd)
@@ -389,6 +398,8 @@ sim_watchpoint_install (SIM_DESC sd)
/* fill in some details */
if (watch->interrupt_names == NULL)
watch->interrupt_names = default_interrupt_names;
+ if (watch->interrupt_handler == NULL)
+ watch->interrupt_handler = default_interrupt_handler;
watch->nr_interrupts = 0;
while (watch->interrupt_names[watch->nr_interrupts] != NULL)
watch->nr_interrupts++;