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 <evgeniy.naydanov@syntacore.com>
Change-Id: I14627366d574d806ea16262b7d305d8161f8bcc2
This commit is contained in:
Evgeniy Naydanov 2023-04-10 17:12:04 +03:00
parent 0c76e263e3
commit 08df077083
1 changed files with 2 additions and 2 deletions

View File

@ -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