+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.
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)
/* 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++;