LOG_USER("target halted in %s state due to %s, current mode: %s\n"
"cpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "%s",
arm_state_strings[armv4_5->core_state],
- Jim_Nvp_value2name_simple(nvp_target_debug_reason,
- target->debug_reason)->name,
+ debug_reason_name(target),
arm_mode_name(armv4_5->core_mode),
buf_get_u32(armv4_5->cpsr->value, 0, 32),
buf_get_u32(armv4_5->core_cache->reg_list[15].value,
LOG_USER("target halted due to %s, current mode: %s %s\n"
"xPSR: %#8.8" PRIx32 " pc: %#8.8" PRIx32 " %csp: %#8.8" PRIx32,
- Jim_Nvp_value2name_simple(nvp_target_debug_reason,
- target->debug_reason)->name,
+ debug_reason_name(target),
armv7m_mode_strings[armv7m->core_mode],
armv7m_exception_string(armv7m->exception_number),
buf_get_u32(armv7m->core_cache->reg_list[ARMV7M_xPSR].value, 0, 32),
}
LOG_USER("target halted due to %s, pc: 0x%8.8" PRIx32 "",
- Jim_Nvp_value2name_simple(nvp_target_debug_reason, target->debug_reason)->name ,
+ debug_reason_name(target),
buf_get_u32(mips32->core_cache->reg_list[MIPS32_PC].value, 0, 32));
return ERROR_OK;
{ .name = NULL, .value = -1 },
};
-const Jim_Nvp nvp_target_debug_reason [] = {
+static const Jim_Nvp nvp_target_debug_reason [] = {
{ .name = "debug-request" , .value = DBG_REASON_DBGRQ },
{ .name = "breakpoint" , .value = DBG_REASON_BREAKPOINT },
{ .name = "watchpoint" , .value = DBG_REASON_WATCHPOINT },
{ .name = NULL , .value = -1 },
};
+const char *debug_reason_name(struct target *t)
+{
+ const char *cp;
+
+ cp = Jim_Nvp_value2name_simple(nvp_target_debug_reason,
+ t->debug_reason)->name;
+ if (!cp) {
+ LOG_ERROR("Invalid debug reason: %d", (int)(t->debug_reason));
+ cp = "(*BUG*unknown*BUG*)";
+ }
+ return cp;
+}
+
const char *
target_state_name( struct target *t )
{
DBG_REASON_UNDEFINED = 6
};
-extern const Jim_Nvp nvp_target_debug_reason[];
-
enum target_endianess
{
TARGET_ENDIAN_UNKNOWN = 0,
return target->cmd_name;
}
+const char *debug_reason_name(struct target *t);
+
enum target_event
{
/* LD historical names