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?p=pintos-anon;a=commitdiff_plain;h=425760a116e437cf758541d5e3a52e0d6a1e1a47 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]);