This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix aarch64 ftrace JIT condition testcase
- From: Antoine Tremblay <hexa at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 13 Apr 2016 13:41:19 -0000
- Subject: [binutils-gdb] Fix aarch64 ftrace JIT condition testcase
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=45e3745ed0e034fdec5beee0738f383bd6e2e045
commit 45e3745ed0e034fdec5beee0738f383bd6e2e045
Author: Antoine Tremblay <antoine.tremblay@ericsson.com>
Date: Wed Apr 13 09:40:00 2016 -0400
Fix aarch64 ftrace JIT condition testcase
This patch fixes the following failure:
FAIL: gdb.trace/trace-condition.exp: ftrace: -(21 << 1) == -42: check 10
frames were collected.
This was due to aarch64_emit_sub using the wrong order in its operands, so the
operation would end up being 42 - 0 rather than 0 - 42.
This patch also fixes the order of aarch64_emit_add for clarity.
The test case for emit_sub is fixed so that the proper order of
the operands is needed for the test to pass.
Tested on aarch64-native-extended-gdbserver.
Note: trace-condition.exp was broken a bit so I had to modify it to run
the test. A fix is coming for that in another patch.
gdb/gdbserver/ChangeLog:
* linux-aarch64-low.c (aarch64_emit_add): Switch x1 and x0.
(aarch64_emit_sub): Likewise.
gdb/testsuite/ChangeLog:
* gdb.trace/trace-condition.exp (foreach): Fix emit_sub testcase.
Diff:
---
gdb/gdbserver/ChangeLog | 5 +++++
gdb/gdbserver/linux-aarch64-low.c | 4 ++--
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.trace/trace-condition.exp | 2 +-
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0d2df72..44c4f12 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-13 Antoine Tremblay <antoine.tremblay@ericsson.com>
+
+ * linux-aarch64-low.c (aarch64_emit_add): Switch x1 and x0.
+ (aarch64_emit_sub): Likewise.
+
2016-04-12 Pedro Alves <palves@redhat.com>
* utils.c (prepare_to_throw_exception): Delete.
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 12fe2e6..d237bde 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -2258,7 +2258,7 @@ aarch64_emit_add (void)
uint32_t *p = buf;
p += emit_pop (p, x1);
- p += emit_add (p, x0, x0, register_operand (x1));
+ p += emit_add (p, x0, x1, register_operand (x0));
emit_ops_insns (buf, p - buf);
}
@@ -2272,7 +2272,7 @@ aarch64_emit_sub (void)
uint32_t *p = buf;
p += emit_pop (p, x1);
- p += emit_sub (p, x0, x0, register_operand (x1));
+ p += emit_sub (p, x0, x1, register_operand (x0));
emit_ops_insns (buf, p - buf);
}
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e7a0f3f..a1a4c04 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2016-04-13 Antoine Tremblay <antoine.tremblay@ericsson.com>
+
+ * gdb.trace/trace-condition.exp (foreach): Fix emit_sub testcase.
+
2016-04-13 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/instruction_history.c (loop): Add declaration.
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index 2c47028..44fd720 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -138,7 +138,7 @@ foreach trace_command { "trace" "ftrace" } {
# Test various operations to cover as many opcodes as possible.
test_tracepoints $trace_command "21 + 21 == 42" 10
- test_tracepoints $trace_command "21 - 21 == 0" 10
+ test_tracepoints $trace_command "42 - 21 == 21" 10
test_tracepoints $trace_command "21 * 2 == 42" 10
test_tracepoints $trace_command "21 << 1 == 42" 10
test_tracepoints $trace_command "42 >> 1 == 21" 10