Display pc to the user in 'monitor reset init'.

Change-Id: Ifb8df31954dfc5a3badef4f0a29eb510a97310a2
This commit is contained in:
Tim Newsome 2016-10-10 08:22:51 -07:00
parent a08cef7633
commit 4882de94cc
1 changed files with 13 additions and 2 deletions

View File

@ -1975,7 +1975,6 @@ static int handle_halt(struct target *target, bool announce)
} }
int cause = get_field(info->dcsr, DCSR_CAUSE); int cause = get_field(info->dcsr, DCSR_CAUSE);
LOG_DEBUG("halt cause is %d; dcsr=0x%" PRIx64, cause, info->dcsr);
switch (cause) { switch (cause) {
case DCSR_CAUSE_SWBP: case DCSR_CAUSE_SWBP:
target->debug_reason = DBG_REASON_BREAKPOINT; target->debug_reason = DBG_REASON_BREAKPOINT;
@ -2028,7 +2027,19 @@ static int handle_halt(struct target *target, bool announce)
target_call_event_callbacks(target, TARGET_EVENT_HALTED); target_call_event_callbacks(target, TARGET_EVENT_HALTED);
} }
LOG_DEBUG("halted at 0x%" PRIx64, info->dpc); const char *cause_string[] = {
"none",
"software breakpoint",
"hardware trigger",
"debug interrupt",
"step",
"halt"
};
// This is logged to the user so that gdb will show it when a user types
// 'monitor reset init'. At that time gdb appears to have the pc cached
// still so if a user manually inspects the pc it will still have the old
// value.
LOG_USER("halted at 0x%" PRIx64 " due to %s", info->dpc, cause_string[cause]);
return ERROR_OK; return ERROR_OK;
} }