From e1309e3eb381cc375f661c21ec9d668f4b746d59 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Mon, 11 Jul 2011 09:38:34 +0800 Subject: update signal output to handle prefetch and data aborts Implement Prefetch and Data Abort Signal enum output --- Debugger/debug_internals.h | 12 ++++++++++++ Debugger/debug_macros.h | 41 ++++++++++++++++++++++++++++++++++------- Debugger/debug_stub.S | 20 +++++++++++++++++--- 3 files changed, 63 insertions(+), 10 deletions(-) (limited to 'Debugger') diff --git a/Debugger/debug_internals.h b/Debugger/debug_internals.h index 56cf26a..8292854 100644 --- a/Debugger/debug_internals.h +++ b/Debugger/debug_internals.h @@ -296,6 +296,18 @@ ENUM_VAL(DBG_ABORT_PREFETCH) /**< Prefetch Abort. */ ENUM_VAL(DBG_ABORT_DATA) /**< Data Abort. */ ENUM_END(bkpt_type_t) +/** Debugger Message Signal Enums + * + * Debugger Signal Message Enums. + * The enums must be consecutive, starting from 0 + */ +/* FIXME: Need to validate against the ecos-generic-stub.c Error enums */ +ENUM_BEGIN +ENUM_VALASSIGN(MSG_SIG_DEFAULT, 0) /**< Normal Signal Response. */ +ENUM_VALASSIGN(MSG_SIG_PREFETCH, 0) /**< Prefetch Abort Signal Response. */ +ENUM_VALASSIGN(MSG_SIG_DATA, 0) /**< Data Abort Signal Response. */ +ENUM_END(dbg_msg_signo) + /** Debugger Message Error Enums * * Debugger Error Message Enums. diff --git a/Debugger/debug_macros.h b/Debugger/debug_macros.h index 3a60677..fcf6ca6 100644 --- a/Debugger/debug_macros.h +++ b/Debugger/debug_macros.h @@ -198,7 +198,7 @@ /* _dbg_outputMsgStatusErr * Return Message with Error ('+$ENN') status * On entry: - * R0: error code + * R1: error code * On exit: * R0: Pointer to Output Buffer ASCIIZ location * R1: destroyed @@ -206,7 +206,6 @@ * R3: destroyed */ .macro _dbg_outputMsgStatusErr - mov r1, r0 __dbg_outputErrMsg .endm @@ -222,22 +221,50 @@ __dbg_outputErrMsg .endm -/* _dbg_outputMsgStatusSig +/* __dbg_outputSigMsg + * Internal Routine called to generate Signal messages * Return Message with Signal ('+$SNN') status + * On entry: + * R1: signal code * On exit: * R0: Pointer to Output Buffer ASCIIZ location * R1: destroyed * R2: destroyed + * R3: destroyed */ - .macro _dbg_outputMsgStatusSig statuscode + .macro __dbg_outputSigMsg ldr r0, =debug_OutMsgBuf - ldr r1, =debug_SignalResponsePrefix - _dbg_stpcpy r0, r1, r2 - mov r1, #\statuscode + ldr r2, =debug_SignalResponsePrefix + _dbg_stpcpy r0, r2, r3 bl byte2ascii /* R0 points to buffer position after byte value */ _asciiz r0, r1 .endm +/* _dbg_outputMsgStatusSig + * Return Message with Signal ('+$SNN') status + * On entry: + * R1: signal code + * On exit: + * R0: Pointer to Output Buffer ASCIIZ location + * R1: destroyed + * R2: destroyed + */ + .macro _dbg_outputMsgStatusSig + __dbg_outputSigMsg + .endm + +/* _dbg_outputMsgStatusSigCode + * Return Message with Signal ('+$SNN') status + * On exit: + * R0: Pointer to Output Buffer ASCIIZ location + * R1: destroyed + * R2: destroyed + */ + .macro _dbg_outputMsgStatusSigCode statuscode + mov r1, #\statuscode + __dbg_outputSigMsg + .endm + /* _regenum2index * Convert register enum to debugger stack index * diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 193705e..e462c6b 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -546,7 +546,7 @@ _proc_command: _dbg_check_gdb_command: teq r0, #MSGBUF_STARTCHAR - movne r0, #MSG_ERRFORMAT /* Message Format invalid (not '$') */ + movne r1, #MSG_ERRFORMAT /* Message Format invalid (not '$') */ bne _dbg__cmdError /* Shouldn't happen */ ldrb r0, [r4], #1 /* Look for command char */ bl _dbg__cmdChar2Index /* Index in R0 */ @@ -558,7 +558,7 @@ _dbg_unknown_command: b dbg__bkpt_waitCMD_cont #if 0 - moveq r0, #MSG_UNKNOWNCMD /* Out of range, Command character not recognized */ + moveq r1, #MSG_UNKNOWNCMD /* Out of range, Command character not recognized */ beq _dbg__cmdError /* Send response to GDB server */ #endif @@ -740,8 +740,22 @@ __dbg__sendDebugMsgExit: * r0, r1, r2, r3: destroyed */ _dbg__cmd_Status: + /* FIXME: The Signal numbers do not correspond to any GDB defined signals */ stmfd sp!, {lr} - _dbg_outputMsgStatusSig 0x0 /* FIXME: Dummy Signal number */ + _dbg_get_bkpt_type r0 +_check_data_abort_exception: + teq r0, #DBG_ABORT_DATA + moveq r1, #MSG_SIG_DATA + beq _exit_dmg__cmd_Status +_check_prefetch_abort_exception: + teq r0, #DBG_ABORT_PREFETCH + moveq r1, #MSG_SIG_PREFETCH + beq _exit_dmg__cmd_Status +_default_breakpoint_exception: + mov r1, #MSG_SIG_DEFAULT /* FIXME: Dummy Signal number */ + +_exit_dmg__cmd_Status: + _dbg_outputMsgStatusSig b __dbg__sendDebugMsgExit /* _dbg__cmd_Query -- cgit v1.2.3