target: Fix get_reg, prevent returning invalid data

This patch forces a read of register from the target
in the get_reg command in case the register cache
does not hold a valid value at that moment.

Note that the command "reg" already handles it
correctly, no fix is needed there.

Change-Id: I75fad25188e94ee4e06162ab6d600ea24dbf590a
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7958
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marek Vrbka 2023-11-03 10:48:02 +01:00 committed by Antonio Borneo
parent cca530c09d
commit 7d1f132cea
1 changed files with 1 additions and 1 deletions

View File

@ -5149,7 +5149,7 @@ static int target_jim_get_reg(Jim_Interp *interp, int argc,
return JIM_ERR;
}
if (force) {
if (force || !reg->valid) {
int retval = reg->type->get(reg);
if (retval != ERROR_OK) {