
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 21:40:08 up 6 days, 16:45, 1 user, load average: 0.58, 0.58, 0.61
35 lines
642 B
C
35 lines
642 B
C
#ifndef __DEBUG_H__
|
|
#define __DEBUG_H__
|
|
|
|
#include <common.h>
|
|
|
|
#define Log(format, ...) \
|
|
printf("\33[1;35m[%s,%d,%s] " format "\33[0m\n", \
|
|
__FILE__, __LINE__, __func__, ## __VA_ARGS__)
|
|
|
|
#define TRACE(format, ...) \
|
|
printf("\33[1;36m" format "\33[0m\n", \
|
|
## __VA_ARGS__)
|
|
|
|
#undef panic
|
|
#define panic(format, ...) \
|
|
do { \
|
|
Log("\33[1;31msystem panic: " format, ## __VA_ARGS__); \
|
|
halt(1); \
|
|
} while (0)
|
|
|
|
#ifdef assert
|
|
# undef assert
|
|
#endif
|
|
|
|
#define assert(cond) \
|
|
do { \
|
|
if (!(cond)) { \
|
|
panic("Assertion failed: %s", #cond); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define TODO() panic("please implement me")
|
|
|
|
#endif
|