cortex_a_poll: minor code factorization to enhance readability
cortex_a_debug_entry and update_halt_gdb are called in two consecutive conditions which are complementary, so externalizing the common code makes the conditions' body lighter With the removal of LOG_DEBUG(" ") since it does not look too informative Change-Id: I0c54e413619576bb3af164f2dcf256c5a862c5fd Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/4832 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
This commit is contained in:
parent
c915e70568
commit
63aa917015
|
@ -725,39 +725,26 @@ static int cortex_a_poll(struct target *target)
|
|||
/* We have a halting debug event */
|
||||
LOG_DEBUG("Target halted");
|
||||
target->state = TARGET_HALTED;
|
||||
if ((prev_target_state == TARGET_RUNNING)
|
||||
|| (prev_target_state == TARGET_UNKNOWN)
|
||||
|| (prev_target_state == TARGET_RESET)) {
|
||||
|
||||
retval = cortex_a_debug_entry(target);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
if (target->smp) {
|
||||
retval = update_halt_gdb(target);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (prev_target_state == TARGET_DEBUG_RUNNING) {
|
||||
target_call_event_callbacks(target, TARGET_EVENT_DEBUG_HALTED);
|
||||
} else { /* prev_target_state is RUNNING, UNKNOWN or RESET */
|
||||
if (arm_semihosting(target, &retval) != 0)
|
||||
return retval;
|
||||
|
||||
target_call_event_callbacks(target,
|
||||
TARGET_EVENT_HALTED);
|
||||
}
|
||||
if (prev_target_state == TARGET_DEBUG_RUNNING) {
|
||||
LOG_DEBUG(" ");
|
||||
|
||||
retval = cortex_a_debug_entry(target);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
if (target->smp) {
|
||||
retval = update_halt_gdb(target);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
}
|
||||
|
||||
target_call_event_callbacks(target,
|
||||
TARGET_EVENT_DEBUG_HALTED);
|
||||
}
|
||||
}
|
||||
} else
|
||||
target->state = TARGET_RUNNING;
|
||||
|
|
Loading…
Reference in New Issue