Don't invalidate register cache of halted target. (#657)

This causes trouble if you disconnect/reconnect gdb, because in that
case a halt is issued again. (It probably would be possible to run into
this problem in other ways as well.)

Change-Id: Id5815f9d1dc2c2dd627770e001c03874a307c279
Signed-off-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
Tim Newsome 2021-10-29 10:43:22 -07:00 committed by GitHub
parent 897cc3f224
commit 70196c140c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -1166,6 +1166,8 @@ int riscv_flush_registers(struct target *target)
if (!target->reg_cache)
return ERROR_OK;
LOG_DEBUG("[%s]", target_name(target));
for (uint32_t number = 0; number < target->reg_cache->num_regs; number++) {
struct reg *reg = &target->reg_cache->reg_list[number];
if (reg->valid && reg->dirty) {
@ -1213,9 +1215,9 @@ int riscv_halt_go_all_harts(struct target *target)
} else {
if (r->halt_go(target) != ERROR_OK)
return ERROR_FAIL;
}
riscv_invalidate_register_cache(target);
riscv_invalidate_register_cache(target);
}
return ERROR_OK;
}