diff options
| author | Felipe Boeira <felipe.boeira@liu.se> | 2019-01-08 18:39:03 +0100 |
|---|---|---|
| committer | Felipe Boeira <felipe.boeira@liu.se> | 2019-01-08 18:39:03 +0100 |
| commit | d4522b8e9854178473adcea0fbb84f23f6e744bd (patch) | |
| tree | fbcf620617c5023154eba3f965b3a982daa64a47 /src/lib/user/debug.c | |
| download | pintos-d4522b8e9854178473adcea0fbb84f23f6e744bd.tar.gz | |
Initial commit
Diffstat (limited to 'src/lib/user/debug.c')
| -rw-r--r-- | src/lib/user/debug.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/user/debug.c b/src/lib/user/debug.c new file mode 100644 index 0000000..f49b874 --- /dev/null +++ b/src/lib/user/debug.c @@ -0,0 +1,25 @@ +#include <debug.h> +#include <stdarg.h> +#include <stdbool.h> +#include <stdio.h> +#include <syscall.h> + +/* Aborts the 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, ...) +{ + va_list args; + + printf ("User process ABORT at %s:%d in %s(): ", file, line, function); + + va_start (args, message); + vprintf (message, args); + printf ("\n"); + va_end (args); + + debug_backtrace (); + + exit (1); +} |
