2011-05-05 Yao Qi <yao@codesourcery.com>
authorYao Qi <yao@codesourcery.com>
Thu, 5 May 2011 02:51:28 +0000 (02:51 +0000)
committerYao Qi <yao@codesourcery.com>
Thu, 5 May 2011 02:51:28 +0000 (02:51 +0000)
* gdb.arch/arm-disp-step.S(test_ldr_literal): New.
(test_adr_32bit, test_pop_pc): New.
* gdb.arch/arm-disp-step.exp (test_ldr_literal): New.
(test_adr_32bit, test_pop_pc): New.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.arch/arm-disp-step.S
gdb/testsuite/gdb.arch/arm-disp-step.exp

index 178cd5d87abc6c2b5bd4f96f0b07ffba406effa4..bf126dce8f8ff094d7c57e4c0f9a5f009441c838 100644 (file)
@@ -1,3 +1,10 @@
+2011-05-05  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.arch/arm-disp-step.S(test_ldr_literal): New.
+       (test_adr_32bit, test_pop_pc): New.
+       * gdb.arch/arm-disp-step.exp (test_ldr_literal): New.
+       (test_adr_32bit, test_pop_pc): New.
+
 2011-05-04  Joseph Myers  <joseph@codesourcery.com>
 
        * gdb.base/a2-run.exp (strongarm-*-coff): Don't handle target.
index 14635559e294851ae7c45fdaf229d2d7e2a61c73..fa69e31039346de2ec5bbcb7575266203bd55d87 100644 (file)
@@ -48,6 +48,20 @@ test_ret_end:
        bl test_ldm_stm_pc
 #endif
 
+       /* Test ldrX literal in ARM */
+#if !defined (__thumb__)
+       bl test_ldr_literal
+#endif
+
+       /* Test 32-bit adr in ARM */
+#if !defined(__thumb__)
+       bl test_adr_32bit
+#endif
+
+#if !defined(__thumb__)
+       bl test_pop_pc
+#endif
+
        /* Test str in ARM mode and Thumb-2 */
 #if !defined(__thumb__)
        bl test_str_pc
@@ -123,6 +137,71 @@ test_ldm_stm_pc_ret:
        .size test_ldm_stm_pc, .-test_ldm_stm_pc
 #endif
 
+#if !defined (__thumb__)
+       .global test_ldr_literal
+       .type test_ldr_literal, %function
+test_ldr_literal:
+       ldrh    r0, [pc]
+       .global test_ldrsb_literal
+test_ldrsb_literal:
+       ldrsb   r0, [pc]
+       .global test_ldrsh_literal
+test_ldrsh_literal:
+       ldrsh   r0, [pc]
+       .global test_ldr_literal_end
+test_ldr_literal_end:
+       bx lr
+       .size test_ldr_literal, .-test_ldr_literal
+#endif
+
+
+#if !defined(__thumb__)
+       .global test_adr_32bit
+#if defined(__thumb2__)
+       .code   16
+       .thumb_func
+#endif
+test_adr_32bit:
+       adr     r0, .L6
+       nop
+.L6:
+       nop
+       .global test_adr_32bit_after
+test_adr_32bit_after:
+       adr     r0, .L6
+
+       .global test_adr_32bit_end
+test_adr_32bit_end:
+       bx lr
+       .size test_adr_32bit, .-test_adr_32bit
+#endif
+
+       .global test_pop_pc
+       .type test_pop_pc, %function
+#if defined(__thumb__)
+       .code   16
+       .thumb_func
+#endif
+
+test_pop_pc:
+       ldr     r1, .L5
+#if defined(__thumb__)
+       movs    r0, #1
+       orrs    r1, r0
+#endif
+       push    {r1}
+       push    {r1}
+       .global test_pop_pc_1
+test_pop_pc_1:
+       pop     {r1, pc}
+       .global test_pop_pc_ret
+test_pop_pc_ret:
+       bx lr
+       .align  2
+.L5:
+       .word   test_pop_pc_ret
+       .size test_pop_pc, .-test_pop_pc
+
 #if !defined(__thumb__)
 #if defined (__thumb2__)
        .code   16
index 3bea521abb7b5e54c6ea261eed257f4594b84a5c..0427a046d98b5edd7b3131f9116bb40d0bf6b16f 100644 (file)
@@ -68,6 +68,42 @@ proc test_ldm_stm_pc {} {
     gdb_continue_to_breakpoint "continue to test_ldm_stm_pc_ret" \
        ".*bx lr.*"
 }
+
+#########################################
+# Test ldrX literal
+proc test_ldr_literal {} {
+    global srcfile
+    global gdb_prompt
+
+    gdb_test_multiple "break *test_ldr_literal" "break test_ldr_literal" {
+       -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
+           pass "break test_ldr_literal"
+       }
+       -re "No symbol.*\r\n$gdb_prompt $" {
+           return 0
+       }
+    }
+
+    gdb_test "break *test_ldrsb_literal" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_ldrsb_literal"
+    gdb_test "break *test_ldrsh_literal" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_ldrsh_literal"
+    gdb_test "break *test_ldr_literal_end" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_test_ldr_literal_end"
+
+    gdb_continue_to_breakpoint "continue to test_ldr_literal" \
+       ".*ldrh.*r0\,.*\[pc\].*"
+    gdb_continue_to_breakpoint "continue to test_ldrsb_literal" \
+       ".*ldrsb.*r0\,.*\[pc\].*"
+    gdb_continue_to_breakpoint "continue to test_ldrsh_literal" \
+       ".*ldrsh.*r0\,.*\[pc\].*"
+    gdb_continue_to_breakpoint "continue to test_ldr_literal_ret" \
+       ".*bx lr.*"
+}
+
 ##########################################
 # Test call/ret.
 proc test_call_ret {} {
@@ -126,6 +162,52 @@ proc test_ldr_from_pc {} {
        ".*bx lr.*"
 }
 
+proc test_adr_32bit {} {
+    global srcfile
+    global gdb_prompt
+
+    gdb_test_multiple "break *test_adr_32bit" "break test_adr_32bit" {
+       -re "Breakpoint.*at.* file .*$srcfile, line.*\r\n$gdb_prompt $" {
+           pass "break test_adr"
+       }
+       -re "No symbol.*\r\n$gdb_prompt $" {
+           return 0
+       }
+    }
+
+    gdb_test "break *test_adr_32bit_after" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_adr_32bit_after"
+
+    gdb_test "break *test_adr_32bit_end" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_adr_32bit_end"
+
+    gdb_continue_to_breakpoint "test_adr_32bit" \
+       ".*adr.*r0\,.*\.L6.*"
+    gdb_continue_to_breakpoint "test_adr_32bit_after" \
+       ".*adr.*r0\,.*\.L6.*"
+    gdb_continue_to_breakpoint "test_adr_32bit_end" \
+       ".*bx lr.*"
+}
+
+#########################################
+# Test pop to PC
+proc test_pop_pc {} {
+    global srcfile
+    gdb_test "break *test_pop_pc_1" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_pop_pc"
+    gdb_test "break *test_pop_pc_ret" \
+       "Breakpoint.*at.* file .*$srcfile, line.*" \
+       "break test_pop_pc_ret"
+
+    gdb_continue_to_breakpoint "continue to test_pop_pc" \
+       ".*b.*\{r1\, pc\}.*"
+    gdb_continue_to_breakpoint "continue to test_pop_pc_ret" \
+        ".*bx lr.*"
+}
+
 ###########################################
 
 proc test_str_pc {} {
@@ -201,6 +283,12 @@ test_ldr_from_pc
 
 test_ldm_stm_pc
 
+test_ldr_literal
+
+test_adr_32bit
+
+test_pop_pc
+
 test_str_pc
 ##########################################