This is an automated email from Gerrit.

"Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>" just uploaded a new patch 
set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7750

-- gerrit

commit 8309192287c23de0ab3b99fd1b23963cc599a246
Author: Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>
Date:   Mon May 29 19:34:04 2023 +0300

    target: target_resume returns error if target is not halted
    
    target_resume should fail early if target is not halted.
    
    Change-Id: Ie6842edd63c755961bcf1785dbae940bfa65de0b
    Signed-off-by: Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>

diff --git a/src/target/target.c b/src/target/target.c
index 5858aa573b..010e1a12a9 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -600,12 +600,16 @@ int target_resume(struct target *target, int current, 
target_addr_t address,
 
        /* We can't poll until after examine */
        if (!target_was_examined(target)) {
-               LOG_ERROR("Target not examined yet");
+               LOG_TARGET_ERROR(target, "not examined yet");
                return ERROR_FAIL;
        }
 
        target_call_event_callbacks(target, TARGET_EVENT_RESUME_START);
 
+       if (target->state != TARGET_HALTED) {
+               LOG_TARGET_ERROR(target, "not halted");
+               return ERROR_TARGET_NOT_HALTED;
+       }
        /* note that resume *must* be asynchronous. The CPU can halt before
         * we poll. The CPU can even halt at the current PC as a result of
         * a software breakpoint being inserted by (a bug?) the application.

-- 

Reply via email to