aboutsummaryrefslogtreecommitdiff
path: root/debug/backtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/backtrace.c')
-rw-r--r--debug/backtrace.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/debug/backtrace.c b/debug/backtrace.c
index 969d699..2ed0112 100644
--- a/debug/backtrace.c
+++ b/debug/backtrace.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <unwind.h>
#include <unwind-link.h>
+#include <arch_backtrace.h>
struct trace_arg
{
@@ -63,6 +64,16 @@ backtrace_helper (struct _Unwind_Context *ctx, void *a)
int
__backtrace (void **array, int size)
{
+ if (size <= 0)
+ return 0;
+
+ /* Try the architecture-specific implementation first. */
+ {
+ int result = __arch_backtrace (array, size);
+ if (result >= 0)
+ return result;
+ }
+
struct trace_arg arg =
{
.array = array,
@@ -72,7 +83,7 @@ __backtrace (void **array, int size)
.cnt = -1
};
- if (size <= 0 || arg.unwind_link == NULL)
+ if (arg.unwind_link == NULL)
return 0;
UNWIND_LINK_PTR (arg.unwind_link, _Unwind_Backtrace)