From 2f5e289c62dc60a5d4e778ebc18f0c933ffe8f2b Mon Sep 17 00:00:00 2001 From: Parshintsev Anatoly Date: Fri, 28 Jul 2023 22:38:23 +0300 Subject: [PATCH] add diagnostics for non-implemented data watchpoints Change-Id: If5031c6d8cea1bfcc34bb65fd766f232498ed7ea Signed-off-by: Parshintsev Anatoly --- src/target/riscv/riscv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 7962a47dca..8097a68277 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1293,6 +1293,14 @@ static void trigger_from_watchpoint(struct trigger *trigger, int riscv_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { + // NOTE: typeof is needed because of upstream OpenOCD bug. This should be + // replaced by WATCHPOINT_IGNORE_DATA_VALUE_MASK once it is available + // See: https://review.openocd.org/c/openocd/+/7840 + if (watchpoint->mask != ~(typeof(watchpoint->mask))0) { + LOG_ERROR("watchpoints on data values are not implemented"); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + } + struct trigger trigger; trigger_from_watchpoint(&trigger, watchpoint);