summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-07-20 10:05:09 +0800
committerTat-Chee Wan (USM)2011-07-20 10:05:09 +0800
commit720aa337c19691c3dc3edbf816ca8141516b8ac2 (patch)
tree24475d9e3c82065851aec5443c78e32554866bce
parentc3a288fc5a3db3383dbc9e85bee032e4cd1b7c8d (diff)
implement query current thread support
-rw-r--r--Debugger/debug_internals.h17
-rw-r--r--Debugger/debug_macros.h14
-rw-r--r--Debugger/debug_stub.S17
3 files changed, 43 insertions, 5 deletions
diff --git a/Debugger/debug_internals.h b/Debugger/debug_internals.h
index 13efba2..c0291f3 100644
--- a/Debugger/debug_internals.h
+++ b/Debugger/debug_internals.h
@@ -119,6 +119,15 @@
#define CMD_STEP_MINPARAMLEN 0
/*@}*/
+/** @name Debug Query Command Constants.
+ *
+ * Debug Query Command
+ */
+/*@{*/
+#define CMD_QUERY_MINPARAMLEN 0
+#define CMD_QUERY_CURRTID_PARAMLEN 1
+#define CMD_QUERY_CURRTID_CHAR 'C'
+/*@}*/
/** @name Debug Breakpoint Command Constants.
@@ -167,12 +176,12 @@
#define RESET_VECTOR 0x00000000
#define UNDEF_VECTOR 0x00000004
-#define SVC_VECTOR 0x00000008
+#define SVC_VECTOR 0x00000008
#define PABRT_VECTOR 0x0000000C
#define DABRT_VECTOR 0x00000010
#define RESERVED_VECTOR 0x00000014
-#define IRQ_VECTOR 0x00000018
-#define FIQ_VECTOR 0x0000001C
+#define IRQ_VECTOR 0x00000018
+#define FIQ_VECTOR 0x0000001C
/*@}*/
@@ -210,7 +219,7 @@
#define CPSR_FIQ 0x00000040
#define CPSR_IRQ 0x00000080
#define CPSR_MODE 0x0000001F
-#define CPSR_COND 0xF0000000
+#define CPSR_COND 0xF0000000
/* ARM Exception Modes */
#define MODE_USR 0x10 /* User mode */
diff --git a/Debugger/debug_macros.h b/Debugger/debug_macros.h
index fcf6ca6..b25c7b4 100644
--- a/Debugger/debug_macros.h
+++ b/Debugger/debug_macros.h
@@ -265,6 +265,20 @@
__dbg_outputSigMsg
.endm
+/* _dbg_outputMsgCurrTID
+ * Return Message with Default Thread ID ('+$QC0')
+ * On exit:
+ * R0: Pointer to Output Buffer ASCIIZ location
+ * R1: destroyed
+ * R2: destroyed
+ */
+ .macro _dbg_outputMsgCurrTID
+ ldr r0, =debug_OutMsgBuf
+ ldr r1, =debug_ThreadIDResponse /* ASCIIZ terminated */
+ _dbg_stpcpy r0, r1, r2
+ .endm
+
+
/* _regenum2index
* Convert register enum to debugger stack index
*
diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S
index 136a86c..eacdd5d 100644
--- a/Debugger/debug_stub.S
+++ b/Debugger/debug_stub.S
@@ -251,6 +251,9 @@ debug_SignalResponsePrefix:
debug_OkResponse:
.byte '+','$','O','K',0
+debug_ThreadIDResponse:
+ .byte '+','$','Q','C','0',0 /* 0: Any thread */
+
/* The CmdIndexTable and CmdJumpTable must be kept in sync */
debug_cmdIndexTable:
.byte 'g','G','p','P','m','M','D','c','s','k','z','Z','?','q','Q',0
@@ -738,7 +741,19 @@ _exit_dmg__cmd_Status:
_dbg__cmd_Query:
stmfd sp!, {lr}
_dbg_setstate DBG_CONFIGURED /* We have exchanged query messages with the GDB server */
- b __dbg__procUnimplementedError /* FIXME: return an empty message to GDB (no modifiable settings) */
+ bl __dbg__cmdParamLen
+ cmp r1, #CMD_QUERY_CURRTID_PARAMLEN
+ bne _dbg__cmd_Query_default
+
+_dbg__cmd_Query_check:
+ ldrb r2, [r0] /* Get First Query Param Char */
+ teq r2, #CMD_QUERY_CURRTID_CHAR /* Handle Current Thread ID Query */
+ bne _dbg__cmd_Query_default
+ _dbg_outputMsgCurrTID
+ b __dbg__sendDebugMsgExit
+
+_dbg__cmd_Query_default:
+ b __dbg__procUnimplementedError /* FIXME: return an empty message to GDB (no modifiable settings) */
/* _dbg__cmd_GetOneReg