int retval = ERROR_OK;
struct aarch64_common *aarch64 = target_to_aarch64(target);
struct armv8_common *armv8 = target_to_armv8(target);
+ uint32_t tmp;
LOG_DEBUG("dscr = 0x%08" PRIx32, aarch64->cpudbg_dscr);
/* Examine debug reason */
arm_dpm_report_dscr(&armv8->dpm, aarch64->cpudbg_dscr);
+ mem_ap_read_atomic_u32(armv8->debug_ap,
+ armv8->debug_base + CPUDBG_DESR, &tmp);
+ if ((tmp & 0x7) == 0x4)
+ target->debug_reason = DBG_REASON_SINGLESTEP;
/* save address of instruction that triggered the watchpoint? */
if (target->debug_reason == DBG_REASON_WATCHPOINT) {
if (retval != ERROR_OK)
return retval;
+ target->debug_reason = DBG_REASON_SINGLESTEP;
retval = aarch64_resume(target, 1, address, 0, 0);
if (retval != ERROR_OK)
return retval;
long long then = timeval_ms();
while (target->state != TARGET_HALTED) {
+ mem_ap_read_atomic_u32(armv8->debug_ap,
+ armv8->debug_base + CPUDBG_DESR, &tmp);
+ LOG_DEBUG("DESR = %#x", tmp);
retval = aarch64_poll(target);
if (retval != ERROR_OK)
return retval;
}
}
- target->debug_reason = DBG_REASON_BREAKPOINT;
retval = mem_ap_write_atomic_u32(armv8->debug_ap,
armv8->debug_base + CPUDBG_DECR, (tmp&(~0x4)));
if (retval != ERROR_OK)
return retval;
- if (target->state != TARGET_HALTED)
+ target_call_event_callbacks(target, TARGET_EVENT_HALTED);
+ if (target->state == TARGET_HALTED)
LOG_DEBUG("target stepped");
return ERROR_OK;
/* register offsets from armv8.debug_base */
#define CPUDBG_WFAR 0x018
+#define CPUDBG_DESR 0x020
#define CPUDBG_DECR 0x024
/* PCSR at 0x084 -or- 0x0a0 -or- both ... based on flags in DIDR */
#define CPUDBG_DSCR 0x088