Merge pull request #1039 from en-sc/en-sc/running-cache

target/riscv: read registers are not valid on a running target
This commit is contained in:
Evgeniy Naydanov 2024-04-14 16:58:10 +03:00 committed by GitHub
commit 93f6260621
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -5260,7 +5260,8 @@ int riscv_get_register(struct target *target, riscv_reg_t *value,
return ERROR_FAIL;
buf_set_u64(reg->value, 0, reg->size, *value);
reg->valid = gdb_regno_cacheable(regid, /* is write? */ false);
reg->valid = gdb_regno_cacheable(regid, /* is write? */ false) &&
target->state == TARGET_HALTED;
reg->dirty = false;
LOG_TARGET_DEBUG(target, "Read %s: 0x%" PRIx64, reg->name, *value);