mirror of
https://github.com/linux-msm/openocd.git
synced 2026-02-25 13:15:07 -08:00
cortex_m: don't try to halt not-examined targets
Prevent a segmentation fault by preventing to try to halt a target that has not been examined yet. Change-Id: I5d344e7fbdb5422f7c5e2c39bdd48cbc6c2a3e58 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8213 Tested-by: jenkins
This commit is contained in:
@@ -1109,6 +1109,11 @@ static int cortex_m_halt_one(struct target *target)
|
||||
int retval;
|
||||
LOG_TARGET_DEBUG(target, "target->state: %s", target_state_name(target));
|
||||
|
||||
if (!target_was_examined(target)) {
|
||||
LOG_TARGET_ERROR(target, "target non examined yet");
|
||||
return ERROR_TARGET_NOT_EXAMINED;
|
||||
}
|
||||
|
||||
if (target->state == TARGET_HALTED) {
|
||||
LOG_TARGET_DEBUG(target, "target was already halted");
|
||||
return ERROR_OK;
|
||||
|
||||
Reference in New Issue
Block a user