summaryrefslogtreecommitdiff
path: root/libc-parts
diff options
context:
space:
mode:
authorneal <neal>2008-02-11 09:49:54 +0000
committerneal <neal>2008-02-11 09:49:54 +0000
commit70fb1f5adcc824eb80ab5e85856ed253ff35678e (patch)
treecb0d49cf60eb8d66b68689da64b00f4a9df4c63d /libc-parts
parentd74240e3cf99a32dadade7e414ce5aabee6f1982 (diff)
2008-02-11 Neal H. Walfield <neal@gnu.org>
* backtrace.c (RA): Return if __builtin_frame_address returns 0. Correctly assign the return address to the appropriate slot in ARRAY. (backtrace): Limit to four stack frames.
Diffstat (limited to 'libc-parts')
-rw-r--r--libc-parts/ChangeLog7
-rw-r--r--libc-parts/backtrace.c15
2 files changed, 17 insertions, 5 deletions
diff --git a/libc-parts/ChangeLog b/libc-parts/ChangeLog
index 2f60049..9c5364d 100644
--- a/libc-parts/ChangeLog
+++ b/libc-parts/ChangeLog
@@ -1,5 +1,12 @@
2008-02-11 Neal H. Walfield <neal@gnu.org>
+ * backtrace.c (RA): Return if __builtin_frame_address returns 0.
+ Correctly assign the return address to the appropriate slot in
+ ARRAY.
+ (backtrace): Limit to four stack frames.
+
+2008-02-11 Neal H. Walfield <neal@gnu.org>
+
* _exit.c (_exit): Destroy the activity by finding its associated
storage and deallocating that. If killing the activity fails, try
the same approach with the thread.
diff --git a/libc-parts/backtrace.c b/libc-parts/backtrace.c
index 293dad0..c222ef9 100644
--- a/libc-parts/backtrace.c
+++ b/libc-parts/backtrace.c
@@ -19,10 +19,14 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define RA(level) \
- if (level < size && __builtin_return_address ((level) + 1)) \
- *array = __builtin_return_address ((level) + 1); \
- else \
+#define RA(level) \
+ if (level < size && __builtin_frame_address ((level) + 1)) \
+ { \
+ array[level] = __builtin_return_address ((level) + 1); \
+ if (array[level] == 0) \
+ return (level) + 1; \
+ } \
+ else \
return level;
int
@@ -32,6 +36,7 @@ backtrace (void **array, int size)
RA(1);
RA(2);
RA(3);
+ return 4;
RA(4);
RA(5);
RA(6);
@@ -48,5 +53,5 @@ backtrace (void **array, int size)
RA(18);
RA(19);
RA(20);
- return 20;
+ return 21;
}