This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARM backtrace() adjustment


Mark Shinwell (and others here, but he did the heavy lifting) tracked
down why backtrace() was stopping in our ARM NPTL builds without
returning any frames.  The current stack frame was not offset,
but the first stack frame was, so it appeared we'd wandered off into
the woods.

This improves the situation - at least, if you're using gcc 3.x, or
Mark's patch just approved for 4.2.  In the future, we're going to need
to come up with some other way to do this, at least for EABI targets.

-- 
Daniel Jacobowitz
CodeSourcery

2006-06-08  Mark Shinwell  <shinwell@codesourcery.com>

        * sysdeps/arm/nptl/pthreaddef.h (CURRENT_STACK_FRAME): Add -12.

Index: sysdeps/arm/nptl/pthreaddef.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/arm/nptl/pthreaddef.h,v
retrieving revision 1.1
diff -u -p -r1.1 pthreaddef.h
--- sysdeps/arm/nptl/pthreaddef.h	16 Nov 2005 19:03:42 -0000	1.1
+++ sysdeps/arm/nptl/pthreaddef.h	8 Jun 2006 17:38:03 -0000
@@ -30,8 +30,16 @@
 #define TCB_ALIGNMENT		16
 
 
-/* Location of current stack frame.  */
-#define CURRENT_STACK_FRAME	__builtin_frame_address (0)
+/* Location of current stack frame.
+
+   __builtin_frame_address (0) returns the value of the hard frame
+   pointer, which will point at the location of the saved PC on the
+   stack.  Below this in memory is the remainder of the linkage info,
+   occupying 12 bytes.  Therefore in order to address from
+   CURRENT_STACK_FRAME using "struct layout", we need to have the macro
+   return the hard FP minus 12.  Of course, this makes no sense
+   without the obsolete APCS stack layout...  */
+#define CURRENT_STACK_FRAME	(__builtin_frame_address (0) - 12)
 
 
 /* XXX Until we have a better place keep the definitions here.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]