diff options
-rw-r--r-- | board/host/board.h | 5 | ||||
-rw-r--r-- | core/host/panic.c | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/board/host/board.h b/board/host/board.h index 4e4c4e7080..553f55c76c 100644 --- a/board/host/board.h +++ b/board/host/board.h @@ -8,6 +8,11 @@ #ifndef __BOARD_H #define __BOARD_H +/* Assertion support */ +#define CONFIG_DEBUG +#define CONFIG_ASSERT_HELP + +/* Optional features */ #define CONFIG_HOSTCMD #define CONFIG_HOST_EMU #define CONFIG_KEYBOARD_PROTOCOL_MKBP diff --git a/core/host/panic.c b/core/host/panic.c index 90ddf55dd7..ee815cb678 100644 --- a/core/host/panic.c +++ b/core/host/panic.c @@ -3,6 +3,9 @@ * found in the LICENSE file. */ +#include <stdio.h> +#include <stdlib.h> + #include "common.h" #include "panic.h" #include "util.h" @@ -11,3 +14,16 @@ struct panic_data *panic_get_data(void) { return NULL; } + +void panic_assert_fail(const char *msg, const char *func, const char *fname, + int linenum) +{ + fprintf(stderr, "ASSERTION FAIL: %s:%d:%s - %s\n", + fname, linenum, func, msg); + fflush(stderr); + + puts("Fail!"); /* Inform test runner */ + fflush(stdout); + + exit(1); +} |