From: Ben Pfaff Date: Mon, 10 Nov 2008 04:07:40 +0000 (-0800) Subject: Make backtraces slightly more reliable. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64d029bf5cb18b21d187fbed01c45fedb451f0e8;p=pintos-anon Make backtraces slightly more reliable. We now ignore pointers that are not null but still clearly wild. We could check that there's really a valid PDE and PTE (I think Linux does this) but it would take more code and be ugly. --- diff --git a/src/lib/debug.c b/src/lib/debug.c index 6d7c9e1..1dc1bf8 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -17,7 +17,7 @@ debug_backtrace (void) printf ("Call stack:"); for (frame = __builtin_frame_address (0); - frame != NULL && frame[0] != NULL; + (uintptr_t) frame >= 0x1000 && frame[0] != NULL; frame = frame[0]) printf (" %p", frame[1]); printf (".\n");