00001 #include <debug.h>
00002
00003 #include <stdarg.h>
00004 #include <stdbool.h>
00005 #include <stddef.h>
00006 #include <stdio.h>
00007 #include <string.h>
00008
00009
00010
00011
00012
00013 void
00014 debug_backtrace (void)
00015 {
00016 static bool explained;
00017 void **frame;
00018
00019 printf ("Call stack: %p", __builtin_return_address (0));
00020 for (frame = __builtin_frame_address (1);
00021 (uintptr_t) frame >= 0x1000 && frame[0] != NULL;
00022 frame = frame[0])
00023 printf (" %p", frame[1]);
00024 printf (".\n");
00025
00026 if (!explained)
00027 {
00028 explained = true;
00029 printf ("The `backtrace' program can make call stacks useful.\n"
00030 "Read \"Backtraces\" in the \"Debugging Tools\" chapter\n"
00031 "of the Pintos documentation for more information.\n");
00032 }
00033 }