riscv: call debug_execution related events (#679)
Change-Id: Ice7cdc816f3e568a6ba2db8f9101903b8f7a08ce Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
This commit is contained in:
parent
435a652236
commit
64f3f8877e
|
@ -1490,13 +1490,14 @@ static int resume_go(struct target *target, int current,
|
|||
return result;
|
||||
}
|
||||
|
||||
static int resume_finish(struct target *target)
|
||||
static int resume_finish(struct target *target, int debug_execution)
|
||||
{
|
||||
register_cache_invalidate(target->reg_cache);
|
||||
|
||||
target->state = TARGET_RUNNING;
|
||||
target->state = debug_execution ? TARGET_DEBUG_RUNNING : TARGET_RUNNING;
|
||||
target->debug_reason = DBG_REASON_NOTHALTED;
|
||||
return target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
|
||||
return target_call_event_callbacks(target,
|
||||
debug_execution ? TARGET_EVENT_DEBUG_RESUMED : TARGET_EVENT_RESUMED);
|
||||
}
|
||||
|
||||
/* Return a newly allocated target list, that contains the same targets as in
|
||||
|
@ -1566,7 +1567,7 @@ int riscv_resume(
|
|||
|
||||
for (struct target_list *tlist = ordered_tlist; tlist; tlist = tlist->next) {
|
||||
struct target *t = tlist->target;
|
||||
if (resume_finish(t) != ERROR_OK)
|
||||
if (resume_finish(t, debug_execution) != ERROR_OK)
|
||||
result = ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
@ -1580,7 +1581,7 @@ int riscv_resume(
|
|||
if (resume_go(target, current, address, handle_breakpoints,
|
||||
debug_execution) != ERROR_OK)
|
||||
result = ERROR_FAIL;
|
||||
if (resume_finish(target) != ERROR_OK)
|
||||
if (resume_finish(target, debug_execution) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
@ -1975,7 +1976,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params,
|
|||
|
||||
/* Run algorithm */
|
||||
LOG_DEBUG("resume at 0x%" TARGET_PRIxADDR, entry_point);
|
||||
if (riscv_resume(target, 0, entry_point, 0, 0, true) != ERROR_OK)
|
||||
if (riscv_resume(target, 0, entry_point, 0, 1, true) != ERROR_OK)
|
||||
return ERROR_FAIL;
|
||||
|
||||
int64_t start = timeval_ms();
|
||||
|
@ -2177,7 +2178,7 @@ static enum riscv_poll_hart riscv_poll_hart(struct target *target, int hartid)
|
|||
LOG_DEBUG(" triggered a halt");
|
||||
r->on_halt(target);
|
||||
return RPH_DISCOVERED_HALTED;
|
||||
} else if (target->state != TARGET_RUNNING && !halted) {
|
||||
} else if (target->state != TARGET_RUNNING && target->state != TARGET_DEBUG_RUNNING && !halted) {
|
||||
LOG_DEBUG(" triggered running");
|
||||
target->state = TARGET_RUNNING;
|
||||
target->debug_reason = DBG_REASON_NOTHALTED;
|
||||
|
@ -2239,6 +2240,7 @@ int riscv_openocd_poll(struct target *target)
|
|||
{
|
||||
LOG_DEBUG("polling all harts");
|
||||
int halted_hart = -1;
|
||||
enum target_state old_state = target->state;
|
||||
|
||||
if (target->smp) {
|
||||
unsigned halts_discovered = 0;
|
||||
|
@ -2354,6 +2356,9 @@ int riscv_openocd_poll(struct target *target)
|
|||
return retval;
|
||||
}
|
||||
} else {
|
||||
if (old_state == TARGET_DEBUG_RUNNING)
|
||||
target_call_event_callbacks(target, TARGET_EVENT_DEBUG_HALTED);
|
||||
else
|
||||
target_call_event_callbacks(target, TARGET_EVENT_HALTED);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue