* [PATCH] Fix aarch64 ftrace JIT condition testcase
@ 2016-04-12 15:13 Antoine Tremblay
2016-04-13 10:00 ` Pierre Langlois
0 siblings, 1 reply; 6+ messages in thread
From: Antoine Tremblay @ 2016-04-12 15:13 UTC (permalink / raw)
To: gdb-patches; +Cc: Antoine Tremblay
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.
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/gdbserver/linux-aarch64-low.c | 4 ++--
1 file changed, 2 insertions(+), 2 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);
}
--
2.7.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix aarch64 ftrace JIT condition testcase
2016-04-12 15:13 [PATCH] Fix aarch64 ftrace JIT condition testcase Antoine Tremblay
@ 2016-04-13 10:00 ` Pierre Langlois
2016-04-13 12:26 ` Antoine Tremblay
0 siblings, 1 reply; 6+ messages in thread
From: Pierre Langlois @ 2016-04-13 10:00 UTC (permalink / raw)
To: Antoine Tremblay, gdb-patches
Hi Antoine,
On 12/04/16 16:13, Antoine Tremblay wrote:
> 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.
Ooops, thanks for the fix! I was a little confused how I could have
missed this, it turns out I had forgotten to had parentheses in
`-(21 << 1) == -42' at the time, so `emit_sub' was not tested here.
I aimed at testing `emit_sub' with the following test case which is
clearly not good enough:
gdb.trace/trace-condition.exp: ftrace: 21 - 21 == 0
Would you be OK with changing it to "42 - 21 == 21" or something?
Thanks again!
Pierre
>
> This patch also fixes the order of aarch64_emit_add for clarity.
>
> 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/gdbserver/linux-aarch64-low.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 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);
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix aarch64 ftrace JIT condition testcase
2016-04-13 10:00 ` Pierre Langlois
@ 2016-04-13 12:26 ` Antoine Tremblay
2016-04-13 12:28 ` [PATCH v2] " Antoine Tremblay
0 siblings, 1 reply; 6+ messages in thread
From: Antoine Tremblay @ 2016-04-13 12:26 UTC (permalink / raw)
To: Pierre Langlois; +Cc: Antoine Tremblay, gdb-patches
Pierre Langlois writes:
> Hi Antoine,
>
> On 12/04/16 16:13, Antoine Tremblay wrote:
>> 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.
>
> Ooops, thanks for the fix! I was a little confused how I could have
> missed this, it turns out I had forgotten to had parentheses in
> `-(21 << 1) == -42' at the time, so `emit_sub' was not tested here.
hehe.
>
> I aimed at testing `emit_sub' with the following test case which is
> clearly not good enough:
>
> gdb.trace/trace-condition.exp: ftrace: 21 - 21 == 0
>
> Would you be OK with changing it to "42 - 21 == 21" or something?
>
Right indeed good idea, I'm sending a v2 with this.
> Thanks again!
np.
Antoine
>> This patch also fixes the order of aarch64_emit_add for clarity.
>>
>> 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/gdbserver/linux-aarch64-low.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 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);
>> }
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] Fix aarch64 ftrace JIT condition testcase
2016-04-13 12:26 ` Antoine Tremblay
@ 2016-04-13 12:28 ` Antoine Tremblay
2016-04-13 12:58 ` Yao Qi
0 siblings, 1 reply; 6+ messages in thread
From: Antoine Tremblay @ 2016-04-13 12:28 UTC (permalink / raw)
To: pierre.langlois, gdb-patches; +Cc: Antoine Tremblay
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
--
2.7.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Fix aarch64 ftrace JIT condition testcase
2016-04-13 12:28 ` [PATCH v2] " Antoine Tremblay
@ 2016-04-13 12:58 ` Yao Qi
2016-04-13 13:42 ` Antoine Tremblay
0 siblings, 1 reply; 6+ messages in thread
From: Yao Qi @ 2016-04-13 12:58 UTC (permalink / raw)
To: Antoine Tremblay; +Cc: pierre.langlois, gdb-patches
Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
> 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.
^^^^^^^ trace_command
Patch is OK to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Fix aarch64 ftrace JIT condition testcase
2016-04-13 12:58 ` Yao Qi
@ 2016-04-13 13:42 ` Antoine Tremblay
0 siblings, 0 replies; 6+ messages in thread
From: Antoine Tremblay @ 2016-04-13 13:42 UTC (permalink / raw)
To: Yao Qi; +Cc: Antoine Tremblay, pierre.langlois, gdb-patches
Yao Qi writes:
> Antoine Tremblay <antoine.tremblay@ericsson.com> writes:
>
>> 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.
> ^^^^^^^ trace_command
>
> Patch is OK to me.
Pushed.
Thanks,
Antoine
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-13 13:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 15:13 [PATCH] Fix aarch64 ftrace JIT condition testcase Antoine Tremblay
2016-04-13 10:00 ` Pierre Langlois
2016-04-13 12:26 ` Antoine Tremblay
2016-04-13 12:28 ` [PATCH v2] " Antoine Tremblay
2016-04-13 12:58 ` Yao Qi
2016-04-13 13:42 ` Antoine Tremblay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox