From 08df07708313a88c6443922664d03f8b26af1f9b Mon Sep 17 00:00:00 2001 From: Evgeniy Naydanov Date: Mon, 10 Apr 2023 17:12:04 +0300 Subject: [PATCH] target/riscv: Handle error code in resume_prep If hart can't change pc (e.g. it is running), resume command should fail. Signed-off-by: Evgeniy Naydanov Change-Id: I14627366d574d806ea16262b7d305d8161f8bcc2 --- src/target/riscv/riscv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index f9ac06950..e689a5ae9 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1735,8 +1735,8 @@ static int resume_prep(struct target *target, int current, RISCV_INFO(r); LOG_TARGET_DEBUG(target, "target->state=%d", target->state); - if (!current) - riscv_set_register(target, GDB_REGNO_PC, address); + if (!current && riscv_set_register(target, GDB_REGNO_PC, address) != ERROR_OK) + return ERROR_FAIL; if (target->debug_reason == DBG_REASON_WATCHPOINT) { /* To be able to run off a trigger, disable all the triggers, step, and