aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-07-05 11:23:30 +0800
committerTat-Chee Wan (USM)2011-07-05 11:23:30 +0800
commit0a17d7ae48b32cce9e9c7e7de80610ae429c7e26 (patch)
tree8946d9f84baf1acd8edc385cde643c0279bb132f
parentf8c74550cf2a06f62499e4abbcd1c82afb9a3d42 (diff)
added gdb step command execution example routine
-rw-r--r--Debugger/debug_test.S63
-rw-r--r--Debugger/debug_test.h3
2 files changed, 66 insertions, 0 deletions
diff --git a/Debugger/debug_test.S b/Debugger/debug_test.S
index 91e19d2..ed4ae14 100644
--- a/Debugger/debug_test.S
+++ b/Debugger/debug_test.S
@@ -29,6 +29,58 @@ dbg__test_arm_bkpt:
dbg__bkpt_arm /* Trigger ARM Manual Breakpoint */
ldmfd sp!,{pc}
+
+/**********************************************
+ * dbg__test_arm_instrstep Test Routine
+ * Used to test GDB Stepping command
+ * This routine exercises the mov, add, ldr, ldm, b, bl,
+ * and bx instructions which modify the PC (R15)
+ * In addition, conditional instructions are also evaluated.
+ *
+ */
+ .global dbg__test_arm_instrstep
+dbg__test_arm_instrstep:
+ stmfd sp!, {lr}
+ bl dbg__test_arm_instr_sub1
+ ldr r1, =test_arm_2 /* R1: pointer to test_arm_2 */
+ ldr r2, =test_arm_2 /* R2: pointer to test_arm_2 (should not be triggered) */
+ mov pc, r1
+
+test_arm_1:
+ subs r0, r0, #1
+ addne pc, r1, #4 /* If R0 > 0, keep branching to a new location */
+ /* else R0 == 0 */
+ b exit_dbg__test_arm_instrstep
+
+test_arm_2:
+ sub r0, r0, #1
+ cmp r0, #8
+ bls test_arm_1
+ bhi test_arm_3
+ beq test_arm_2
+ ldr pc, =test_arm_1
+
+test_arm_3:
+ /* case for r0 == 9 */
+ sub r0, r0, #1
+ teq r0, #5
+ ldreq r2, =test_arm_1
+ ldrne r2, =test_arm_3
+ bx r2
+
+exit_dbg__test_arm_instrstep:
+ bl dbg__test_arm_instr_sub2
+ ldmfd sp!, {pc}
+
+dbg__test_arm_instr_sub1:
+ mov r0, #10
+ bx lr
+
+dbg__test_arm_instr_sub2:
+ stmfd sp!, {r4, lr}
+ mov r0, #TRUE
+ ldmfd sp!, {r4, pc}
+
/**********************************************
* dbg__test_thumb_bkpt Test Routine
*
@@ -50,4 +102,15 @@ _thumb_entry:
dbg__bkpt_thumb
bx lr
+
+/**********************************************
+ * dbg__test_thumb_instrstep Test Routine
+ * Used to test GDB Stepping command
+ *
+ */
+ .global dbg__test_thumb_instrstep
+dbg__test_thumb_instrstep:
+ bx lr
+
+
.end
diff --git a/Debugger/debug_test.h b/Debugger/debug_test.h
index 6680f58..1c004e7 100644
--- a/Debugger/debug_test.h
+++ b/Debugger/debug_test.h
@@ -27,6 +27,9 @@
FUNCDEF void dbg__test_arm_bkpt(void);
FUNCDEF void dbg__test_thumb_bkpt(void);
+FUNCDEF void dbg__test_arm_instrstep(void);
+FUNCDEF void dbg__test_thumb_instrstep(void);
+
/*@}*/
#endif