From f025f685e965ac9ee1cd35ff3636c8554d9939d2 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Sat, 1 Oct 2016 13:25:22 +0200 Subject: kern: Improve assertions and panics. * kern/assert.h (Assert): Add function argument. (assert): Supply function argument. * kern/debug.c (Assert): Add function argument. Unify message format. (panic): Rename to 'Panic', add location information. * kern/debug.h (panic): Rename, and add a macro version that supplies the location. * linux/dev/include/linux/kernel.h: Use the new panic macro. --- kern/debug.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'kern/debug.h') diff --git a/kern/debug.h b/kern/debug.h index 6c8977b8..1a5cd07c 100644 --- a/kern/debug.h +++ b/kern/debug.h @@ -60,7 +60,11 @@ extern void log (int level, const char *fmt, ...); extern void panic_init(void); -extern void panic (const char *s, ...) __attribute__ ((noreturn)); +extern void Panic (const char *file, int line, const char *fun, + const char *s, ...) + __attribute__ ((noreturn, format (printf, 4, 5))); +#define panic(s, ...) \ + Panic (__FILE__, __LINE__, __FUNCTION__, s, ##__VA_ARGS__) extern void SoftDebugger (const char *message); extern void Debugger (const char *message) __attribute__ ((noreturn)); -- cgit v1.2.3