From patchwork Wed Apr 13 12:28:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 11727 Received: (qmail 58399 invoked by alias); 13 Apr 2016 12:28:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 58384 invoked by uid 89); 13 Apr 2016 12:28:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=1387, 138, 7 X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 13 Apr 2016 12:28:52 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id CB.43.03614.95B3E075; Wed, 13 Apr 2016 14:28:10 +0200 (CEST) Received: from elxa4wqvvz1.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.84) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 13 Apr 2016 08:28:49 -0400 From: Antoine Tremblay To: , CC: Antoine Tremblay Subject: [PATCH v2] Fix aarch64 ftrace JIT condition testcase Date: Wed, 13 Apr 2016 08:28:42 -0400 Message-ID: <1460550522-16417-1-git-send-email-antoine.tremblay@ericsson.com> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes 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. --- gdb/gdbserver/linux-aarch64-low.c | 4 ++-- gdb/testsuite/gdb.trace/trace-condition.exp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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