* [PATCH] Fix trace file fails on powerpc64
@ 2014-10-27 8:48 Yao Qi
2014-10-27 11:08 ` Ulrich Weigand
0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2014-10-27 8:48 UTC (permalink / raw)
To: gdb-patches
I see the following fails on powerpc64-linux,
(gdb) target tfile tfile-basic.tf^M
warning: Uploaded tracepoint 1 has no source location, using raw address^M
Tracepoint 1 at 0x10012358^M
Created tracepoint 1 for target's tracepoint 1 at 0x10012358.^M
(gdb) PASS: gdb.trace/tfile.exp: target tfile tfile-basic.tf
info trace^M
Num Type Disp Enb Address What^M
1 tracepoint keep y 0x0000000010012358 <write_basic_trace_file>^M
installed on target^M
(gdb) FAIL: gdb.trace/tfile.exp: info tracepoints on trace file
-target-select tfile tfile-basic.tf^M
=thread-group-started,id="i1",pid="1"^M
=thread-created,id="1",group-id="i1"^M
&"warning: Uploaded tracepoint 1 has no source location, using raw address\n"^M
=breakpoint-created,bkpt={number="1",type="tracepoint",disp="keep",enabled="y",
addr="0x0000000010012358",at="<write_basic_trace_file>",thread-groups=["i1"],
times="0",installed="y",original-location="*0x10012358"}^M
~"Created tracepoint 1 for target's tracepoint 1 at 0x10012358.\n"^M
^connected^M
(gdb) ^M
FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: select trace file
These fails are caused by writing function descriptor address into trace
file instead of function address. This patch is to teach tfile.c to
write function address on powerpc64 target. With this patch applied,
fails in tfile.exp and mi-traceframe-changed.exp are fixed. Is it
OK?
gdb/testsuite:
2014-10-27 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c (adjust_function_address) [__powerpc64__]:
Get function address from function descriptor.
---
gdb/testsuite/gdb.trace/tfile.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index e69240a..e9c347c 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -130,6 +130,9 @@ adjust_function_address (uintptr_t func_addr)
/* Although Thumb functions are two-byte aligned, function
pointers have the Thumb bit set. Clear it. */
return func_addr & ~1;
+#elif defined __powerpc64__
+ /* Get function address from function descriptor. */
+ return *(uintptr_t *) func_addr;
#else
return func_addr;
#endif
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix trace file fails on powerpc64
2014-10-27 8:48 [PATCH] Fix trace file fails on powerpc64 Yao Qi
@ 2014-10-27 11:08 ` Ulrich Weigand
2014-10-27 12:15 ` Yao Qi
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2014-10-27 11:08 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
Yao Qi wrote:
> These fails are caused by writing function descriptor address into trace
> file instead of function address. This patch is to teach tfile.c to
> write function address on powerpc64 target. With this patch applied,
> fails in tfile.exp and mi-traceframe-changed.exp are fixed. Is it
> OK?
>
> gdb/testsuite:
>
> 2014-10-27 Yao Qi <yao@codesourcery.com>
>
> * gdb.trace/tfile.c (adjust_function_address) [__powerpc64__]:
> Get function address from function descriptor.
> ---
> gdb/testsuite/gdb.trace/tfile.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
> index e69240a..e9c347c 100644
> --- a/gdb/testsuite/gdb.trace/tfile.c
> +++ b/gdb/testsuite/gdb.trace/tfile.c
> @@ -130,6 +130,9 @@ adjust_function_address (uintptr_t func_addr)
> /* Although Thumb functions are two-byte aligned, function
> pointers have the Thumb bit set. Clear it. */
> return func_addr & ~1;
> +#elif defined __powerpc64__
> + /* Get function address from function descriptor. */
> + return *(uintptr_t *) func_addr;
This will break powerpc64le, which uses the ELFv2 ABI without function
descriptors. The correct test should be something like
#elif defined __powerpc64__ && _CALL_ELF != 2
OK with that change.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix trace file fails on powerpc64
2014-10-27 11:08 ` Ulrich Weigand
@ 2014-10-27 12:15 ` Yao Qi
0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2014-10-27 12:15 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
Ulrich Weigand <uweigand@de.ibm.com> writes:
> This will break powerpc64le, which uses the ELFv2 ABI without function
> descriptors. The correct test should be something like
>
> #elif defined __powerpc64__ && _CALL_ELF != 2
OK, fixed.
>
> OK with that change.
Patch below is pushed in.
--
Yao (齐尧)
Subject: [PATCH] Fix trace file fails on powerpc64
I see the following fails on powerpc64-linux,
(gdb) target tfile tfile-basic.tf^M
warning: Uploaded tracepoint 1 has no source location, using raw address^M
Tracepoint 1 at 0x10012358^M
Created tracepoint 1 for target's tracepoint 1 at 0x10012358.^M
(gdb) PASS: gdb.trace/tfile.exp: target tfile tfile-basic.tf
info trace^M
Num Type Disp Enb Address What^M
1 tracepoint keep y 0x0000000010012358 <write_basic_trace_file>^M
installed on target^M
(gdb) FAIL: gdb.trace/tfile.exp: info tracepoints on trace file
-target-select tfile tfile-basic.tf^M
=thread-group-started,id="i1",pid="1"^M
=thread-created,id="1",group-id="i1"^M
&"warning: Uploaded tracepoint 1 has no source location, using raw address\n"^M
=breakpoint-created,bkpt={number="1",type="tracepoint",disp="keep",enabled="y",
addr="0x0000000010012358",at="<write_basic_trace_file>",thread-groups=["i1"],
times="0",installed="y",original-location="*0x10012358"}^M
~"Created tracepoint 1 for target's tracepoint 1 at 0x10012358.\n"^M
^connected^M
(gdb) ^M
FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: select trace file
These fails are caused by writing function descriptor address into trace
file instead of function address. This patch is to teach tfile.c to
write function address on powerpc64 target. With this patch applied,
fails in tfile.exp and mi-traceframe-changed.exp are fixed. Is it
OK?
gdb/testsuite:
2014-10-27 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c (adjust_function_address)
[__powerpc64__ && _CALL_ELF != 2]: Get function address from
function descriptor.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 036da6d..2eea791 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-27 Yao Qi <yao@codesourcery.com>
+
+ * gdb.trace/tfile.c (adjust_function_address)
+ [__powerpc64__ && _CALL_ELF != 2]: Get function address from
+ function descriptor.
+
2014-10-24 Don Breazeal <donb@codesourcery.com>
* gdb.base/foll-fork.exp (test_follow_fork,
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index e69240a..b673211 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -130,6 +130,9 @@ adjust_function_address (uintptr_t func_addr)
/* Although Thumb functions are two-byte aligned, function
pointers have the Thumb bit set. Clear it. */
return func_addr & ~1;
+#elif defined __powerpc64__ && _CALL_ELF != 2
+ /* Get function address from function descriptor. */
+ return *(uintptr_t *) func_addr;
#else
return func_addr;
#endif
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-27 12:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 8:48 [PATCH] Fix trace file fails on powerpc64 Yao Qi
2014-10-27 11:08 ` Ulrich Weigand
2014-10-27 12:15 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox