summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-22 16:50:25 +0800
committerTat-Chee Wan (USM)2011-03-22 16:50:25 +0800
commitb66fd09e34c9a720acd5367eb7658456417a8c3b (patch)
tree87452748c1cda577746586560e34eb9d3b31f6ed
parent727dba872b5a17c070ebc5c44d927ad6743acc19 (diff)
continue command wip
Work in Progress, for implementing continue command
-rw-r--r--Debugger/debug_macros.h14
-rw-r--r--Debugger/debug_stub.S30
-rw-r--r--Debugger/debug_stub.h21
3 files changed, 63 insertions, 2 deletions
diff --git a/Debugger/debug_macros.h b/Debugger/debug_macros.h
index 3fcc78c..d6786d5 100644
--- a/Debugger/debug_macros.h
+++ b/Debugger/debug_macros.h
@@ -223,6 +223,20 @@
_asciiz r0, r1
.endm
+/* _regenum2index
+ * Convert register enum to debugger stack index
+ *
+ * On entry:
+ * indexenum: enum representing Register to access
+ * indexreg: register to be used to store the debugger stack index value (0-max index)
+ * On exit:
+ * indexreg contains debugger stack index value (0-max index)
+ */
+ .macro _regenum2index indexenum, indexreg
+ mov \indexreg, #indexenum
+ add \indexreg, \indexreg, #DBGSTACK_USERREG_INDEX /* Convert register index to Debug Stack index, keep in R1 */
+ .endm
+
/* _getdbgregisterfromindex
* Retrieve register contents from debugger stack given index
*
diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S
index 796de04..b0d7fed 100644
--- a/Debugger/debug_stub.S
+++ b/Debugger/debug_stub.S
@@ -224,7 +224,7 @@ debug_cmdJumpTable:
.word _dbg__cmd_SetOneReg /* 'P' */
.word _dbg__cmd_ReadMem /* 'm' */
.word _dbg__cmd_WriteMem /* 'M' */
- .word _dbg__nop /* 'c' */
+ .word _dbg__cmd_Continue /* 'c' */
.word _dbg__nop /* 's' */
.word _dbg__nop /* 'k' */
.word _dbg__cmd_remove_breakpoint /* 'z' */
@@ -947,6 +947,34 @@ _dbg__cmd_WriteMem:
bne 1b
b __dbg__procCmdOk
+/* _dbg__cmd_Continue
+ * Continue User Program Execution Command Handler
+ * On entry:
+ * r0: parameter buffer pointer (contents after '$' and '<cmdchar>')
+ * Optional: AA..AA
+ * On exit:
+ * r0, r1, r2, r3, r4: destroyed
+ */
+_dbg__cmd_Continue:
+ stmfd sp!, {lr}
+ bl __dbg__cmdParamLen
+ cmp r1, #CMD_REG_CONTINUE_PARAMLEN /* Check for correct parameter length */
+ beq _dbg__cmd_processContinue /* Continue from current PC */
+ cmp r1, #CMD_REG_CONTINUEFROM_PARAMLEN /* Check for correct parameter length */
+ bne __dbg__procCmdParamError /* Unexpected input, report error */
+ /* Continue from Specified Address */
+ bl ascii2word /* convert ASCII address location to Hex (in R0), R1 has address of next buffer char */
+ mov r1, #DBGSTACK_NEXTINSTR_INDEX /* The Next Instruction Pointer for Resume is in index 0 of the Debug Stack */
+ _setdbgregisterfromindex r1, r0, r2 /* Set Register contents in R0, using index in R2, and scratch register R3 */
+
+_dbg__cmd_processContinue:
+@@@@@
+ /* Switch mode to Previous Mode, reload all the registers (except for PC) */
+ /* Switch back to ABORT, resume with PC and SPSR */
+ b __dbg__procCmdOk
+
+
+
/* _dbg__proc_brkpt_params
* Process Breakpoint Parameters
* On entry:
diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h
index e39fc8e..85ff22a 100644
--- a/Debugger/debug_stub.h
+++ b/Debugger/debug_stub.h
@@ -87,6 +87,13 @@
#define CMD_REG_REGPARAMLEN 8 /* 32-bit ASCII Hex Value */
#define CMD_REG_SETONE_PARAMLEN (2 + CMD_REG_REGPARAMLEN)
#define CMD_REG_SETALL_PARAMLEN (CMD_REG_NUMREGS*CMD_REG_REGPARAMLEN)
+/*@}*/
+
+/** @name Debug Memory Command Constants.
+ *
+ * Debug Memory Command
+ */
+/*@{*/
#define CMD_NUMITEMS_PARAMLEN 4 /* 16-bit ASCII Hex Value */
#define CMD_MEM_READ_PARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 1) /* Address length is equivalent to reg param len */
#define CMD_MEM_WRITE_MINPARAMLEN (CMD_REG_REGPARAMLEN + CMD_NUMITEMS_PARAMLEN + 2) /* Address length is equivalent to reg param len */
@@ -97,6 +104,17 @@
#define CMD_MEM_MAXWRITEBYTES ((CMD_MEM_MAXINBUFLEN - CMD_MEM_WRITE_MINPARAMLEN)/2)
/*@}*/
+/** @name Debug Continue Command Constants.
+ *
+ * Debug Continue Command
+ */
+/*@{*/
+#define CMD_REG_CONTINUE_PARAMLEN 0
+#define CMD_REG_CONTINUEFROM_PARAMLEN CMD_REG_REGPARAMLEN /* Address length is equivalent to reg param len */
+/*@}*/
+
+
+
/** @name Debug Breakpoint Command Constants.
*
* Debug Breakpoint Command
@@ -126,9 +144,10 @@
* Debug Stack Manipulation Values
*/
/*@{*/
-#define DBGSTACK_USERCPSR_OFFSET (DBGSTACK_USERCPSR_INDEX-DBGSTACK_USERREG_INDEX) /* = -1, offset for calculating Debug Stack index */
+#define DBGSTACK_NEXTINSTR_INDEX 0 /* Next Instruction Address is at index 0 from bottom of Debug Stack */
#define DBGSTACK_USERCPSR_INDEX 1 /* User CPSR (SPSR_UNDEF) is at index 1 from bottom of Debug Stack */
#define DBGSTACK_USERREG_INDEX 2 /* R0 starts at index 2 from bottom of Debug Stack */
+#define DBGSTACK_USERCPSR_OFFSET (DBGSTACK_USERCPSR_INDEX-DBGSTACK_USERREG_INDEX) /* = -1, offset for calculating Debug Stack index */
/*@}*/
/** @name Bitmask Definitions.