From: Godmar Back Date: Fri, 14 Nov 2008 02:30:41 +0000 (-0500) Subject: fixed backtrace to work with -O (now conforms to X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f3e964987f0a00943e7e5261de250741695fb28;p=pintos-anon fixed backtrace to work with -O (now conforms to http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html ) --- 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]);