patch for PR 2632
Philip Blundell
Philip.Blundell@pobox.com
Fri Jul 12 15:34:00 GMT 2002
2002-07-12 Philip Blundell <philb@gnu.org>
* sysdeps/generic/backtrace.c (FIRST_FRAME_POINTER): New macro.
(__backtrace): Use it.
* sysdeps/arm/frame.h (FIRST_FRAME_POINTER): Define. [PR libc/2632]
Index: sysdeps/arm/frame.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/arm/frame.h,v
retrieving revision 1.3
diff -u -r1.3 frame.h
--- sysdeps/arm/frame.h 6 Jul 2001 04:55:48 -0000 1.3
+++ sysdeps/arm/frame.h 12 Jul 2002 22:33:32 -0000
@@ -1,5 +1,5 @@
/* Definition of stack frame structure. ARM/APCS version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,3 +24,5 @@
void *__unbounded sp;
void *__unbounded return_address;
};
+
+#define FIRST_FRAME_POINTER ADVANCE_STACK_FRAME (__builtin_frame_address (0))
Index: sysdeps/generic/backtrace.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/backtrace.c,v
retrieving revision 1.7
diff -u -r1.7 backtrace.c
--- sysdeps/generic/backtrace.c 6 Jul 2001 04:55:48 -0000 1.7
+++ sysdeps/generic/backtrace.c 12 Jul 2002 22:33:32 -0000
@@ -1,5 +1,5 @@
/* Return backtrace of current program state. Generic version.
- Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -58,6 +58,11 @@
# define ADVANCE_STACK_FRAME(next) BOUNDED_1 ((struct layout *) (next))
#endif
+/* By default, the frame pointer is just what we get from gcc. */
+#ifndef FIRST_FRAME_POINTER
+# define FIRST_FRAME_POINTER __builtin_frame_address (0)
+#endif
+
int
__backtrace (array, size)
void **array;
@@ -68,7 +73,7 @@
void *__unbounded top_stack;
int cnt = 0;
- top_frame = __builtin_frame_address (0);
+ top_frame = FIRST_FRAME_POINTER;
top_stack = CURRENT_STACK_FRAME;
/* We skip the call to this function, it makes no sense to record it. */
More information about the Libc-hacker
mailing list