Merge pull request #772 from riscv/resume_state

target/riscv: Set target->state in riscv013_halt_go()
This commit is contained in:
Tim Newsome 2022-11-30 10:21:24 -08:00 committed by GitHub
commit f7a5f4719d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -1765,8 +1765,11 @@ static int examine(struct target *target)
return ERROR_FAIL;
}
if (!halted)
if (!halted) {
riscv013_step_or_resume_current_hart(target, false);
target->state = TARGET_RUNNING;
target->debug_reason = DBG_REASON_NOTHALTED;
}
if (target->smp) {
bool haltgroup_supported;
@ -4331,8 +4334,17 @@ static int riscv013_halt_go(struct target *target)
t->state = TARGET_UNAVAILABLE;
}
}
} else {
/* Set state for the current target based on its dmstatus. */
if (get_field(dmstatus, DM_DMSTATUS_ALLHALTED)) {
target->state = TARGET_HALTED;
if (target->debug_reason == DBG_REASON_NOTHALTED)
target->debug_reason = DBG_REASON_DBGRQ;
} else if (get_field(dmstatus, DM_DMSTATUS_ALLUNAVAIL)) {
target->state = TARGET_UNAVAILABLE;
}
}
/* The "else" case is handled in halt_go(). */
return ERROR_OK;
}