| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright 2019 EfficiOS Inc. |
| 5 | */ |
| 6 | |
| 7 | #include <stdio.h> |
| 8 | |
| 9 | #include "common/assert.h" |
| 10 | #include "common/common.h" |
| 11 | |
| 12 | void bt_common_assert_failed(const char *file, int line, const char *func, |
| 13 | const char *assertion) |
| 14 | { |
| 15 | fprintf(stderr, |
| 16 | "%s\n%s%s%s (╯°□°)╯︵ ┻━┻ %s %s%s%s%s:%s%d%s: %s%s()%s: " |
| 17 | "%sAssertion %s%s`%s`%s%s failed.%s\n", |
| 18 | bt_common_color_reset(), |
| 19 | bt_common_color_bold(), |
| 20 | bt_common_color_bg_yellow(), |
| 21 | bt_common_color_fg_bright_red(), |
| 22 | bt_common_color_reset(), |
| 23 | bt_common_color_bold(), |
| 24 | bt_common_color_fg_bright_magenta(), |
| 25 | file, |
| 26 | bt_common_color_reset(), |
| 27 | bt_common_color_fg_green(), |
| 28 | line, |
| 29 | bt_common_color_reset(), |
| 30 | bt_common_color_fg_cyan(), |
| 31 | func, |
| 32 | bt_common_color_reset(), |
| 33 | bt_common_color_fg_red(), |
| 34 | bt_common_color_bold(), |
| 35 | bt_common_color_fg_bright_red(), |
| 36 | assertion, |
| 37 | bt_common_color_reset(), |
| 38 | bt_common_color_fg_red(), |
| 39 | bt_common_color_reset()); |
| 40 | bt_common_abort(); |
| 41 | } |