2019-04-11 23:08:59 +02:00
|
|
|
#pragma once
|
2019-05-17 09:35:23 +02:00
|
|
|
#include "klibc.h"
|
2020-04-27 00:14:37 +02:00
|
|
|
#include "stack.h"
|
2019-04-11 23:08:59 +02:00
|
|
|
|
2020-04-27 00:14:37 +02:00
|
|
|
#define assert(p) \
|
|
|
|
do { \
|
|
|
|
if (!(p)) { \
|
|
|
|
printf("BUG at %s:%d assert(%s)\n", __FILE__, __LINE__, #p); \
|
2021-11-03 23:37:44 +01:00
|
|
|
printStackTrace(3); \
|
2020-04-27 00:14:37 +02:00
|
|
|
while (1) { \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2019-04-11 23:08:59 +02:00
|
|
|
|
2020-04-27 00:14:37 +02:00
|
|
|
#define assertmsg(p, ...) \
|
|
|
|
do { \
|
|
|
|
if (!(p)) { \
|
|
|
|
printf("BUG at %s:%d assert(%s)\n", __FILE__, __LINE__, #p); \
|
|
|
|
printf(__VA_ARGS__); \
|
2021-11-03 23:37:44 +01:00
|
|
|
printStackTrace(3); \
|
2020-04-27 00:14:37 +02:00
|
|
|
while (1) { \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} while (0)
|