Don't read registers that we know don't exist.

Change-Id: Ie5c6226b3d4ecb6cf8f0d8954a52fda88e6e5bdd
This commit is contained in:
Tim Newsome 2020-04-21 10:48:03 -07:00
parent bd7d75d4b9
commit 397d5be64b
1 changed files with 5 additions and 0 deletions

View File

@ -3096,6 +3096,11 @@ int riscv_get_register_on_hart(struct target *target, riscv_reg_t *value,
RISCV_INFO(r);
struct reg *reg = &target->reg_cache->reg_list[regid];
if (!reg->exist) {
LOG_DEBUG("[%s]{%d} %s does not exist.",
target_name(target), hartid, gdb_regno_name(regid));
return ERROR_FAIL;
}
if (reg && reg->valid && hartid == riscv_current_hartid(target)) {
*value = buf_get_u64(reg->value, 0, reg->size);