summaryrefslogtreecommitdiff
path: root/Debugger/debug_stub.h
diff options
context:
space:
mode:
authorTC Wan2010-12-17 09:53:25 +0800
committerTC Wan2010-12-17 09:53:25 +0800
commitc75b604e97fc736221cfffe63033cb2ac8239ac0 (patch)
tree8483f65571906eeecca780756a000a2fce51aacc /Debugger/debug_stub.h
parent35c9bf7fc8e5f5a8176c9365566df6a9c9555494 (diff)
use defines instead of hardcoding constants for breakpoint instruction
Inline assembly syntax depends on an archaiac gcc feature. Thanks to Stefan B. from EmbDev.net ARM GCC forum for the tip.
Diffstat (limited to 'Debugger/debug_stub.h')
-rw-r--r--Debugger/debug_stub.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/Debugger/debug_stub.h b/Debugger/debug_stub.h
index 0b1fee4..b090572 100644
--- a/Debugger/debug_stub.h
+++ b/Debugger/debug_stub.h
@@ -168,18 +168,42 @@ FUNCDEF void dbg__bkpt_handler(void);
* Equivalent to GDB breakpoint() routine for ARM code
*/
FUNCDEF void dbg_breakpoint_arm(void);
+inline void dbg_breakpoint_arm(void)
+{
+ asm volatile (".word %a0"
+ : /* Output (empty) */
+ : "X" (BKPT32_INSTR | BKPT32_MANUAL_BKPT)
+ );
+}
+
+#if 0 /* Old asm definitions, in case gas does not recognize %a0 operand */
+
#ifdef __ARM6OR7__
inline void dbg_breakpoint_arm(void) { asm volatile (".word 0xE727FF7F" /* (BKPT32_INSTR | BKPT32_MANUAL_BKPT) */ ); }
#else
inline void dbg_breakpoint_arm(void) { asm volatile (".word 0xE127FF7F" /* (BKPT32_INSTR | BKPT32_MANUAL_BKPT) */ ); }
#endif
+#endif
+
/** dbg_breakpoint_thumb.
* Equivalent to GDB breakpoint() routine for Thumb code
*/
FUNCDEF void dbg_breakpoint_thumb(void);
+inline void dbg_breakpoint_thumb(void)
+{
+ asm volatile (".hword %a0"
+ : /* Output (empty) */
+ : "X" (BKPT16_INSTR | BKPT16_MANUAL_BKPT)
+ );
+}
+
+#if 0 /* Old asm definitions, in case gas does not recognize %a0 operand */
+
inline void dbg_breakpoint_thumb(void) { asm volatile (".hword 0xBE7F" /* (BKPT16_INSTR | BKPT16_MANUAL_BKPT) */); }
+#endif
+
/*@}*/
#else