Error instead of asserting on reg access failure

Instead of asserting, return error when an abstract register access
fails on running target.

Fixes #201

Change-Id: I1ab3b31b0a4babf83c44f95ee2eeca92ef906d2f
This commit is contained in:
Tim Newsome 2018-03-02 20:24:58 -08:00
parent 5767fa8e04
commit 509e0e4715
1 changed files with 4 additions and 4 deletions

View File

@ -1045,8 +1045,8 @@ static int register_write_direct(struct target *target, unsigned number,
int result = register_write_abstract(target, number, value, int result = register_write_abstract(target, number, value,
register_size(target, number)); register_size(target, number));
if (result == ERROR_OK || if (result == ERROR_OK || info->progbufsize + r->impebreak < 2 ||
info->progbufsize + r->impebreak < 2) !riscv_is_halted(target))
return result; return result;
struct riscv_program program; struct riscv_program program;
@ -1109,8 +1109,8 @@ static int register_read_direct(struct target *target, uint64_t *value, uint32_t
int result = register_read_abstract(target, value, number, int result = register_read_abstract(target, value, number,
register_size(target, number)); register_size(target, number));
if (result != ERROR_OK && if (result != ERROR_OK && info->progbufsize + r->impebreak >= 2 &&
info->progbufsize + r->impebreak >= 2) { riscv_is_halted(target)) {
assert(number != GDB_REGNO_S0); assert(number != GDB_REGNO_S0);
struct riscv_program program; struct riscv_program program;