Fix trace file fails on powerpc64

Message ID 87vbn5vhk8.fsf@codesourcery.com
State New, archived
Headers

Commit Message

Yao Qi Oct. 27, 2014, 12:11 p.m. UTC
  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.
  

Patch

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