From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 01/11] More tests in gdb.arch/insn-reloc.c
Date: Wed, 07 Oct 2015 09:26:00 -0000 [thread overview]
Message-ID: <1444209985-15829-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1444209985-15829-1-git-send-email-yao.qi@linaro.org>
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-05 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.
---
gdb/testsuite/gdb.arch/insn-reloc.c | 50 ++++++++++++++++++++++++++++++++++---
1 file changed, 47 insertions(+), 3 deletions(-)
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
};
--
1.9.1
next prev parent reply other threads:[~2015-10-07 9:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-07 9:26 [PATCH 00/11] Displaced stepping on AArch64 GNU/Linux Yao Qi
2015-10-07 9:26 ` Yao Qi [this message]
2015-10-07 9:26 ` [PATCH 02/11] Move target_read_uint32 out of aarch64_relocate_instruction Yao Qi
2015-10-07 9:26 ` [PATCH 03/11] Move append_insns " Yao Qi
2015-10-07 9:26 ` [PATCH 08/11] New test case gdb.arch/disp-step-insn-reloc.exp Yao Qi
2015-10-07 9:26 ` [PATCH 07/11] Support displaced stepping in support_displaced_stepping for aarch64*-*-linux* Yao Qi
2015-10-07 9:26 ` [PATCH 10/11] Rename emit_load_store to aarch64_emit_load_store Yao Qi
2015-10-07 9:27 ` [PATCH 06/11] Support displaced stepping in aarch64-linux Yao Qi
2015-10-13 20:26 ` Sergio Durigan Junior
2015-10-14 8:37 ` Yao Qi
2015-10-07 9:27 ` [PATCH 11/11] Mention the change in NEWS Yao Qi
2015-10-07 15:38 ` Eli Zaretskii
2015-10-07 9:27 ` [PATCH 05/11] Move aarch64_relocate_instruction to arch/aarch64-insn.c Yao Qi
2015-10-07 9:27 ` [PATCH 09/11] Rename emit_insn to aarch64_emit_insn Yao Qi
2015-10-07 9:27 ` [PATCH 04/11] Use visitor in aarch64_relocate_instruction Yao Qi
2015-10-12 10:35 ` [PATCH 00/11] Displaced stepping on AArch64 GNU/Linux Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444209985-15829-2-git-send-email-yao.qi@linaro.org \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox