From 425760a116e437cf758541d5e3a52e0d6a1e1a47 Mon Sep 17 00:00:00 2001 From: Godmar Back Date: Thu, 13 Nov 2008 21:30:41 -0500 Subject: [PATCH] fixed backtrace to work with -O (now conforms to http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html ) --- src/lib/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/debug.c b/src/lib/debug.c index 1dc1bf8..b4f8c2d 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -15,8 +15,8 @@ debug_backtrace (void) static bool explained; void **frame; - printf ("Call stack:"); - for (frame = __builtin_frame_address (0); + printf ("Call stack: %p", __builtin_return_address (0)); + for (frame = __builtin_frame_address (1); (uintptr_t) frame >= 0x1000 && frame[0] != NULL; frame = frame[0]) printf (" %p", frame[1]); -- 2.30.2