]> git.sur5r.net Git - openocd/commitdiff
hla_target: Update target state when polling
authorSergey A. Borshch <sb-sf@users.sourceforge.net>
Mon, 7 Oct 2013 08:45:40 +0000 (11:45 +0300)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 15 Oct 2013 20:41:18 +0000 (20:41 +0000)
    Polling target does not change stste information
    except if new state is TARGET_HALTED.
    Connecting to the runing target result in target->state
    not updated with retrieved value and remains "UNKNOWN"
    until 'halt' command issued.

Change-Id: I803d6c0207f7f8699e648779d1df342c9ee7315a
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/1680
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/target/hla_target.c

index 568cc88d0402f8320d546e60536c544c905a7095..abbc1b194f0eb57ee3a8ebad0413dfafc39469d4 100644 (file)
@@ -463,11 +463,12 @@ static int adapter_poll(struct target *target)
                return ERROR_TARGET_FAILURE;
        }
 
-       if (target->state == state)
+       if (prev_target_state == state)
                return ERROR_OK;
 
+       target->state = state;
+
        if (state == TARGET_HALTED) {
-               target->state = state;
 
                int retval = adapter_debug_entry(target);
                if (retval != ERROR_OK)