From d4522b8e9854178473adcea0fbb84f23f6e744bd Mon Sep 17 00:00:00 2001 From: Felipe Boeira Date: Tue, 8 Jan 2019 18:39:03 +0100 Subject: Initial commit --- src/lib/user/debug.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/lib/user/debug.c (limited to 'src/lib/user/debug.c') 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 +#include +#include +#include +#include + +/* 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); +} -- cgit v1.2.1