target/riscv: detailed error messages for cases when resume operation fails
This change aims to provide more context in case if resume operation fails. Before the change messages were quite confusing.
This commit is contained in:
parent
f9a1292716
commit
faffae0493
|
@ -5385,7 +5385,9 @@ static int riscv013_step_or_resume_current_hart(struct target *target,
|
||||||
LOG_TARGET_ERROR(target, "Hart is not halted!");
|
LOG_TARGET_ERROR(target, "Hart is not halted!");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
LOG_TARGET_DEBUG(target, "resuming (for step?=%d)", step);
|
|
||||||
|
LOG_TARGET_DEBUG(target, "resuming (operation=%s)",
|
||||||
|
step ? "single-step" : "resume");
|
||||||
|
|
||||||
if (riscv_reg_flush_all(target) != ERROR_OK)
|
if (riscv_reg_flush_all(target) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -5418,16 +5420,26 @@ static int riscv013_step_or_resume_current_hart(struct target *target,
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
dm_write(target, DM_DMCONTROL, dmcontrol);
|
LOG_TARGET_ERROR(target, "Failed to %s. dmstatus=0x%08x",
|
||||||
|
step ? "single-step" : "resume", dmstatus);
|
||||||
|
|
||||||
|
dm_write(target, DM_DMCONTROL, dmcontrol);
|
||||||
|
LOG_TARGET_ERROR(target,
|
||||||
|
" cancelling the resume request (dmcontrol.resumereq <- 0)");
|
||||||
|
|
||||||
LOG_TARGET_ERROR(target, "unable to resume");
|
|
||||||
if (dmstatus_read(target, &dmstatus, true) != ERROR_OK)
|
if (dmstatus_read(target, &dmstatus, true) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
LOG_TARGET_ERROR(target, " dmstatus=0x%08x", dmstatus);
|
|
||||||
|
LOG_TARGET_ERROR(target, " dmstatus after cancellation=0x%08x", dmstatus);
|
||||||
|
|
||||||
if (step) {
|
if (step) {
|
||||||
LOG_TARGET_ERROR(target, " was stepping, halting");
|
LOG_TARGET_ERROR(target,
|
||||||
riscv_halt(target);
|
" trying to recover from a failed single-step, by requesting halt");
|
||||||
|
if (riscv_halt(target) == ERROR_OK)
|
||||||
|
LOG_TARGET_ERROR(target, " halt completed after failed single-step");
|
||||||
|
else
|
||||||
|
LOG_TARGET_ERROR(target, " could not halt, something is wrong with the taget");
|
||||||
|
// TODO: returning ERROR_OK is questionable, this code needs to be revised
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue