diff options
author | Yao Qi <yao@codesourcery.com> | 2011-09-18 14:34:55 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2011-09-18 14:34:55 +0000 |
commit | 3451853062d59da1ad23ecd872775ed22c8a0b85 (patch) | |
tree | 727f0ec517c99152580beeffec9d155039f025b3 /gdb/testsuite/gdb.arch/arm-disp-step.S | |
parent | 2b16b2e33b3b4c5c0e1563de1ab761be73006be4 (diff) | |
download | fsf-binutils-gdb-3451853062d59da1ad23ecd872775ed22c8a0b85.zip fsf-binutils-gdb-3451853062d59da1ad23ecd872775ed22c8a0b85.tar.gz fsf-binutils-gdb-3451853062d59da1ad23ecd872775ed22c8a0b85.tar.bz2 |
Support displaced stepping for Thumb 16-bit insns.
gdb/
* arm-tdep.c (THUMB_NOP) Define.
(thumb_copy_unmodified_16bit): New.
(thumb_copy_b, thumb_copy_bx_blx_reg): New.
(thumb_copy_alu_reg): New.
(arm_copy_svc): Move some common code to ...
(install_svc): ... here. New.
(thumb_copy_svc): New.
(install_pc_relative): New.
(thumb_copy_pc_relative_16bit): New.
(thumb_decode_pc_relative_16bit): New.
(thumb_copy_16bit_ldr_literal): New.
(thumb_copy_cbnz_cbz): New.
(cleanup_pop_pc_16bit_all): New.
(thumb_copy_pop_pc_16bit): New.
(thumb_process_displaced_16bit_insn): New.
(thumb_process_displaced_32bit_insn): New.
(thumb_process_displaced_insn): process thumb instruction.
Support displaced stepping for Thumb 32-bit insns.
gdb/
* arm-tdep.c (thumb_copy_unmodified_32bit): New.
(thumb2_copy_preload): New.
(thumb2_copy_copro_load_store): New.
(thumb2_copy_b_bl_blx): New.
(thumb2_copy_alu_imm): New.
(thumb2_copy_load_reg_imm): New.
(thumb2_copy_load_literal): New
(thumb2_copy_block_xfer): New.
(thumb_32bit_copy_undef): New.
(thumb_32bit_copy_unpred): New.
(thumb2_decode_ext_reg_ld_st): New.
(thumb2_decode_svc_copro): New.
(decode_thumb_32bit_store_single_data_item): New.
(thumb_copy_pc_relative_32bit): New.
(thumb_decode_pc_relative_32bit): New.
(decode_thumb_32bit_ld_mem_hints): New.
(thumb2_copy_table_branch): New
(thumb_process_displaced_32bit_insn): Process Thumb 32-bit
instructions.
gdb/testsuite/
* gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb
instructions.
(test_adr_32bit, test_pop_pc): Likewise.
(test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for
Thumb instructions.
* gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt
in gdb_test_multiple.
(test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
Diffstat (limited to 'gdb/testsuite/gdb.arch/arm-disp-step.S')
-rw-r--r-- | gdb/testsuite/gdb.arch/arm-disp-step.S | 166 |
1 files changed, 152 insertions, 14 deletions
diff --git a/gdb/testsuite/gdb.arch/arm-disp-step.S b/gdb/testsuite/gdb.arch/arm-disp-step.S index fa69e31..1da7191 100644 --- a/gdb/testsuite/gdb.arch/arm-disp-step.S +++ b/gdb/testsuite/gdb.arch/arm-disp-step.S @@ -48,20 +48,32 @@ test_ret_end: bl test_ldm_stm_pc #endif - /* Test ldrX literal in ARM */ -#if !defined (__thumb__) + /* Test ldrX literal in ARM and Thumb-2 */ +#if !defined (__thumb__) || defined(__thumb2__) bl test_ldr_literal #endif - /* Test 32-bit adr in ARM */ -#if !defined(__thumb__) - bl test_adr_32bit + /* Test ldr literal in Thumb */ +#if defined(__thumb__) + bl test_ldr_literal_16 #endif -#if !defined(__thumb__) - bl test_pop_pc + /* Test cbnz/cbz in Thumb-2 */ +#if defined(__thumb2__) + bl test_cbz_cbnz #endif + /* Test adr in Thumb and Thumb-2 */ +#if defined(__thumb__) + bl test_adr +#endif + /* Test 32-bit adr in ARM and Thumb-2 */ +#if defined(__thumb2__) || !defined(__thumb__) + bl test_adr_32bit +#endif + + bl test_pop_pc + /* Test str in ARM mode and Thumb-2 */ #if !defined(__thumb__) bl test_str_pc @@ -136,8 +148,8 @@ test_ldm_stm_pc_ret: .word test_ldm_stm_pc_ret .size test_ldm_stm_pc, .-test_ldm_stm_pc #endif - -#if !defined (__thumb__) + +#if !defined (__thumb__) || defined(__thumb2__) .global test_ldr_literal .type test_ldr_literal, %function test_ldr_literal: @@ -154,8 +166,66 @@ test_ldr_literal_end: .size test_ldr_literal, .-test_ldr_literal #endif +#if defined(__thumb__) + .global test_ldr_literal_16 + .code 16 + .thumb_func +test_ldr_literal_16: + ldr r0, .L2 + .global test_ldr_literal_16_end +test_ldr_literal_16_end: + bx lr + .align 2 +.L2: + .word test_ldr_literal_16 + .size test_ldr_literal_16, .-test_ldr_literal_16 +#endif -#if !defined(__thumb__) +#if defined(__thumb2__) + .global test_cbz_cbnz + .code 16 + .thumb_func +test_cbz_cbnz: + movs r0, #0 + .global test_zero_cbnz +test_zero_cbnz: + cbnz r0, .L3 + .global test_zero_cbz +test_zero_cbz: + cbz r0, .L3 +.L3: + movs r0, #1 + .global test_non_zero_cbz +test_non_zero_cbz: + cbz r0, .L4 + .global test_non_zero_cbnz +test_non_zero_cbnz: + cbnz r0, .L4 + nop +.L4: + .global test_cbz_cbnz_end +test_cbz_cbnz_end: + bx lr + .size test_cbz_cbnz, .-test_cbz_cbnz +#endif + +#if defined(__thumb__) + .global test_adr + .code 16 + .thumb_func +test_adr: + adr r0, .L8 + nop + nop + nop +.L8: + .global test_adr_end +test_adr_end: + bx lr + .size test_adr, .-test_adr +#endif + +#if defined(__thumb2__) || !defined(__thumb__) .global test_adr_32bit #if defined(__thumb2__) .code 16 @@ -184,22 +254,90 @@ test_adr_32bit_end: #endif test_pop_pc: - ldr r1, .L5 + ldr r1, .L1_right + ldr r2, .L1_wrong #if defined(__thumb__) movs r0, #1 orrs r1, r0 + orrs r2, r0 #endif push {r1} - push {r1} + push {r2} .global test_pop_pc_1 test_pop_pc_1: pop {r1, pc} + +test_pop_pc_2_start: + ldr r1, .L2_right +#if defined(__thumb__) + movs r0, #1 + orrs r1, r0 +#endif + push {r1} + .global test_pop_pc_2 +test_pop_pc_2: + pop {pc} + + /* Test pop instruction with full register list. */ +test_pop_pc_3_start: + ldr r1, .L3_right + ldr r2, .L3_wrong +#if defined(__thumb__) + movs r0, #1 + orrs r1, r0 + orrs r2, r0 +#endif + push {r7} + push {r1} /* Push the right address so that PC will get it. */ + /* Push the wrong address so r0-r7 will get the wrong a ddress. If PC + is set from any of them, we can get a FAIL. */ + push {r2} + push {r2} + push {r2} + push {r2} + push {r2} + push {r2} + push {r2} + push {r2} +test_pop_pc_3: + pop {r0,r1,r2,r3,r4,r5,r6,r7,pc} .global test_pop_pc_ret test_pop_pc_ret: + pop {r7} bx lr + + .global test_pop_pc_1_right +test_pop_pc_1_right: + b test_pop_pc_2_start /* right */ + .global test_pop_pc_1_wrong +test_pop_pc_1_wrong: + b test_pop_pc_2_start /* wrong */ + .global test_pop_pc_2_right +test_pop_pc_2_right: + b test_pop_pc_3_start /* right */ + .global test_pop_pc_2_wrong +test_pop_pc_2_wrong: + b test_pop_pc_3_start /* wrong */ + .global test_pop_pc_3_right +test_pop_pc_3_right: + b test_pop_pc_ret /* right */ + .global test_pop_pc_3_wrong +test_pop_pc_3_wrong: + b test_pop_pc_ret /* wrong */ + .align 2 -.L5: - .word test_pop_pc_ret +.L1_right: + .word test_pop_pc_1_right +.L1_wrong: + .word test_pop_pc_1_wrong +.L2_right: + .word test_pop_pc_2_right +.L2_wrong: + .word test_pop_pc_2_wrong +.L3_right: + .word test_pop_pc_3_right +.L3_wrong: + .word test_pop_pc_3_wrong .size test_pop_pc, .-test_pop_pc #if !defined(__thumb__) |