aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorParshintsev Anatoly <anatoly.parshintsev@syntacore.com>2024-04-20 16:40:45 +0300
committerParshintsev Anatoly <anatoly.parshintsev@syntacore.com>2024-04-24 02:07:16 +0300
commit88f7650a6d463065daf758bd23cd0f798ab85604 (patch)
treeeb3173e5396cbbe297f7d92ca1ec5a3cf9e16776 /src
parent3991492cc101f4289be06ec7dc23c6ad7748a74a (diff)
downloadriscv-openocd-88f7650a6d463065daf758bd23cd0f798ab85604.zip
riscv-openocd-88f7650a6d463065daf758bd23cd0f798ab85604.tar.gz
riscv-openocd-88f7650a6d463065daf758bd23cd0f798ab85604.tar.bz2
target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/riscv/riscv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 5b994ee..56f1009 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -1415,6 +1415,7 @@ static int riscv_add_breakpoint(struct target *target, struct breakpoint *breakp
TARGET_PRIxADDR, breakpoint->length, breakpoint->address);
return ERROR_FAIL;
}
+ breakpoint->is_set = true;
} else if (breakpoint->type == BKPT_HARD) {
struct trigger trigger;
@@ -1422,12 +1423,13 @@ static int riscv_add_breakpoint(struct target *target, struct breakpoint *breakp
int const result = add_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
+
+ int trigger_idx = find_first_trigger_by_id(target, breakpoint->unique_id);
+ breakpoint_hw_set(breakpoint, trigger_idx);
} else {
LOG_TARGET_INFO(target, "OpenOCD only supports hardware and software breakpoints.");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
-
- breakpoint->is_set = true;
return ERROR_OK;
}
@@ -1521,7 +1523,9 @@ int riscv_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
int result = add_trigger(target, &trigger);
if (result != ERROR_OK)
return result;
- watchpoint->is_set = true;
+
+ int trigger_idx = find_first_trigger_by_id(target, watchpoint->unique_id);
+ watchpoint_set(watchpoint, trigger_idx);
return ERROR_OK;
}