diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-10-12 11:28:38 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-10-12 11:28:38 +0100 |
commit | 8240f4421f7ab761ff5476d16090789d2332b676 (patch) | |
tree | 0464b2027605af92315de8e5a01aa84aa6b4e92d /gdb | |
parent | 2520f728b710c0249cde01b8cfb4872a22ef10b6 (diff) | |
download | gdb-8240f4421f7ab761ff5476d16090789d2332b676.zip gdb-8240f4421f7ab761ff5476d16090789d2332b676.tar.gz gdb-8240f4421f7ab761ff5476d16090789d2332b676.tar.bz2 |
More tests in gdb.arch/insn-reloc.c
This patch adds more tests in gdb.arch/insn-reloc.c to cover
instruction BL and cover B.CON when CON is false. These new added
tests can be used for displaced stepping too.
gdb/testsuite:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* gdb.arch/insn-reloc.c (can_relocate_bcond): Rename to ...
(can_relocate_bcond_true): ... it.
(can_relocate_bcond_false): New function.
(foo): Likewise.
(can_relocate_bl): Likewise.
(testcases) [__aarch64__]: Add can_relocate_bcond_false and
can_relocate_bl.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/insn-reloc.c | 50 |
2 files changed, 57 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fbbe7ed..afde9d3 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2015-10-12 Yao Qi <yao.qi@linaro.org> + + * gdb.arch/insn-reloc.c (can_relocate_bcond): Rename to ... + (can_relocate_bcond_true): ... it. + (can_relocate_bcond_false): New function. + (foo): Likewise. + (can_relocate_bl): Likewise. + (testcases) [__aarch64__]: Add can_relocate_bcond_false and + can_relocate_bl. + 2015-10-12 Pierre-Marie de Rodat <derodat@adacore.com> * gdb.base/nested-addr.c: New file. diff --git a/gdb/testsuite/gdb.arch/insn-reloc.c b/gdb/testsuite/gdb.arch/insn-reloc.c index c7148a2..dc6d8b6 100644 --- a/gdb/testsuite/gdb.arch/insn-reloc.c +++ b/gdb/testsuite/gdb.arch/insn-reloc.c @@ -159,7 +159,7 @@ can_relocate_b (void) */ static void -can_relocate_bcond (void) +can_relocate_bcond_true (void) { int ok = 0; @@ -469,6 +469,48 @@ can_relocate_ldr (void) else fail (); } + +/* Make sure we can relocate a B.cond instruction and condition is false. */ + +static void +can_relocate_bcond_false (void) +{ + int ok = 0; + + asm (" mov x0, #8\n" + " tst x0, #8\n" /* Clear the Z flag. */ + "set_point10:\n" /* Set tracepoint here. */ + " b.eq 0b\n" /* Condition is false. */ + " mov %[ok], #1\n" + " b 1f\n" + "0:\n" + " mov %[ok], #0\n" + "1:\n" + : [ok] "=r" (ok) + : + : "0", "cc"); + + if (ok == 1) + pass (); + else + fail (); +} + +static void +foo (void) +{ +} + +/* Make sure we can relocate a BL instruction. */ + +static void +can_relocate_bl (void) +{ + asm ("set_point11:\n" + " bl foo\n" + " bl pass\n"); /* Test that LR is updated correctly. */ +} + #endif /* Functions testing relocations need to be placed here. GDB will read @@ -482,7 +524,7 @@ static testcase_ftype testcases[] = { can_relocate_jump #elif (defined __aarch64__) can_relocate_b, - can_relocate_bcond, + can_relocate_bcond_true, can_relocate_cbz, can_relocate_cbnz, can_relocate_tbz, @@ -490,7 +532,9 @@ static testcase_ftype testcases[] = { can_relocate_adr_forward, can_relocate_adr_backward, can_relocate_adrp, - can_relocate_ldr + can_relocate_ldr, + can_relocate_bcond_false, + can_relocate_bl, #endif }; |