aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/backtrace.c')
-rw-r--r--sysdeps/generic/backtrace.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/generic/backtrace.c b/sysdeps/generic/backtrace.c
index 7ac1d5f..2d329e1 100644
--- a/sysdeps/generic/backtrace.c
+++ b/sysdeps/generic/backtrace.c
@@ -44,6 +44,11 @@ extern void *__libc_stack_end;
# define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
#endif
+/* By default we assume that the stack grows downward. */
+#ifndef INNER_THAN
+# define INNER_THAN <
+#endif
+
struct layout
{
struct layout *next;
@@ -67,7 +72,8 @@ __backtrace (array, size)
current = (struct layout *) top_frame;
while (cnt < size)
{
- if ((void *) current < top_stack || (void *) current > __libc_stack_end)
+ if ((void *) current INNER_THAN top_stack
+ || !((void *) current INNER_THAN __libc_stack_end))
/* This means the address is out of range. Note that for the
toplevel we see a frame pointer with value NULL which clearly is
out of range. */