From c7d1f0ddabb301e00738686671b939bb92a06ed9 Mon Sep 17 00:00:00 2001 From: Parshintsev Anatoly Date: Sun, 30 Jul 2023 15:35:45 +0300 Subject: [PATCH] target: check if target is not examined on reg command Change-Id: I46093c85374986a36d10eaac38b98bd5e05835ca Signed-off-by: Parshintsev Anatoly Reviewed-on: https://review.openocd.org/c/openocd/+/7841 Reviewed-by: Jan Matyas Reviewed-by: Antonio Borneo Tested-by: jenkins Reviewed-by: Marek Vrbka --- src/target/target.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/target/target.c b/src/target/target.c index dfa86fdb35..10d0088d53 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3052,6 +3052,10 @@ COMMAND_HANDLER(handle_reg_command) LOG_DEBUG("-"); struct target *target = get_current_target(CMD_CTX); + if (!target_was_examined(target)) { + LOG_ERROR("Target not examined yet"); + return ERROR_TARGET_NOT_EXAMINED; + } struct reg *reg = NULL; /* list all available registers for the current target */