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=bb940d21474958a1d8ee2abffdcb6bac27918398;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");