[PATCH] Fix trace file fails on powerpc64

Ulrich Weigand uweigand@de.ibm.com
Mon Oct 27 11:08:00 GMT 2014


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



More information about the Gdb-patches mailing list