X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flib%2Fdebug.c;h=7d520638c8cd9a9e8e60a3874b5ce5ae1dee7845;hb=f6ed960fb20e2dc6607e6adf11461bf13fce5834;hp=2388a2daa3f23c7773c21094122b13c17c413610;hpb=d5b6f0eba392ee44f68cda2a821eac8fffa683e2;p=pintos-anon diff --git a/src/lib/debug.c b/src/lib/debug.c index 2388a2d..7d52063 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -61,8 +61,9 @@ debug_message (const char *file, int line, const char *function, } } -/* Halts the OS, printing the source file name, line number, and - function name, plus a user-specific message. */ +/* Halts the OS or user program, printing the source file name, + line number, and function name, plus a user-specific + message. */ void debug_panic (const char *file, int line, const char *function, const char *message, ...) @@ -73,7 +74,12 @@ debug_panic (const char *file, int line, const char *function, intr_disable (); #endif - printf ("PANIC at %s:%d in %s(): ", file, line, function); +#ifdef KERNEL + printf ("Kernel PANIC at %s:%d in %s(): ", file, line, function); +#else + printf ("User process panic at %s:%d in %s(): ", file, line, function); +#endif + va_start (args, message); vprintf (message, args); printf ("\n"); @@ -83,7 +89,7 @@ debug_panic (const char *file, int line, const char *function, #ifdef KERNEL serial_flush (); - for (;;); + power_off (); #else exit (1); #endif