Added even more handling of unexamined harts
This commit is contained in:
parent
ae53788985
commit
c1c46fbcad
|
@ -2056,6 +2056,14 @@ static int examine(struct target *target)
|
||||||
enum riscv_hart_state state_at_examine_start;
|
enum riscv_hart_state state_at_examine_start;
|
||||||
if (riscv_get_hart_state(target, &state_at_examine_start) != ERROR_OK)
|
if (riscv_get_hart_state(target, &state_at_examine_start) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
|
/* Skip full examination of hart if it is unavailable */
|
||||||
|
const bool hart_unavailable_at_examine_start = state_at_examine_start == RISCV_STATE_UNAVAILABLE;
|
||||||
|
if (hart_unavailable_at_examine_start) {
|
||||||
|
LOG_TARGET_INFO(target, "Did not fully examine hart %d as it was unavailable, deferring examine.", info->index);
|
||||||
|
target->defer_examine = true;
|
||||||
|
return ERROR_OK;
|
||||||
|
}
|
||||||
const bool hart_halted_at_examine_start = state_at_examine_start == RISCV_STATE_HALTED;
|
const bool hart_halted_at_examine_start = state_at_examine_start == RISCV_STATE_HALTED;
|
||||||
if (!hart_halted_at_examine_start) {
|
if (!hart_halted_at_examine_start) {
|
||||||
r->prepped = true;
|
r->prepped = true;
|
||||||
|
|
|
@ -3214,6 +3214,11 @@ int riscv_openocd_poll(struct target *target)
|
||||||
if (!target_was_examined(t))
|
if (!target_was_examined(t))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (target->defer_examine) {
|
||||||
|
target->examined = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
enum riscv_next_action next_action;
|
enum riscv_next_action next_action;
|
||||||
if (riscv_poll_hart(t, &next_action) != ERROR_OK)
|
if (riscv_poll_hart(t, &next_action) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
|
@ -686,7 +686,8 @@ int target_examine_one(struct target *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_USER("[%s] Target successfully examined.", target_name(target));
|
LOG_USER("[%s] Target successfully examined.", target_name(target));
|
||||||
target_set_examined(target);
|
if (!target->defer_examine)
|
||||||
|
target_set_examined(target);
|
||||||
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
|
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);
|
||||||
|
|
||||||
LOG_TARGET_INFO(target, "Examination succeed");
|
LOG_TARGET_INFO(target, "Examination succeed");
|
||||||
|
@ -5267,7 +5268,8 @@ COMMAND_HANDLER(handle_target_examine)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
target_set_examined(target);
|
if (!target->defer_examine)
|
||||||
|
target_set_examined(target);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue