diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 178cd5d87a..bf126dce8f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-05-05 Yao Qi + + * 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 * gdb.base/a2-run.exp (strongarm-*-coff): Don't handle target. diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.S b/gdb/testsuite/gdb.arch/arm-disp-step.S index 14635559e2..fa69e31039 100644 --- a/gdb/testsuite/gdb.arch/arm-disp-step.S +++ b/gdb/testsuite/gdb.arch/arm-disp-step.S @@ -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 diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.exp b/gdb/testsuite/gdb.arch/arm-disp-step.exp index 3bea521abb..0427a046d9 100644 --- a/gdb/testsuite/gdb.arch/arm-disp-step.exp +++ b/gdb/testsuite/gdb.arch/arm-disp-step.exp @@ -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 ##########################################