From 73199226dfaf2df1c009509358c3a48fc3b0970d Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Wed, 27 Apr 2022 13:01:14 -0700 Subject: [PATCH] Report some triggers as hardware breakpoints. Instead of reporting them all as watchpoints. Change-Id: If43d282a168f64f8fed6f659bcebbe2ef72f23e9 --- src/target/riscv/riscv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index ee5838191..26824a999 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1262,6 +1262,11 @@ int set_debug_reason(struct target *target, enum riscv_halt_reason halt_reason) if (riscv_hit_trigger_hit_bit(target, &r->trigger_hit) != ERROR_OK) return ERROR_FAIL; target->debug_reason = DBG_REASON_WATCHPOINT; + /* Check if we hit a hardware breakpoint. */ + for (struct breakpoint *bp = target->breakpoints; bp; bp = bp->next) { + if (bp->unique_id == r->trigger_hit) + target->debug_reason = DBG_REASON_BREAKPOINT; + } break; case RISCV_HALT_INTERRUPT: case RISCV_HALT_GROUP: