16using PanicHandlerFn = void (*)(
const char* file,
int line,
const char* message)
noexcept;
25inline void panic(
const char* file,
int line,
const char* message)
noexcept {
27 fn(file, line, message);
30#if defined(CORIUM_CUSTOM_PANIC)
31 CORIUM_CUSTOM_PANIC(file, line, message);
32#elif defined(__arm__) || defined(__thumb__)
33 __asm
volatile(
"bkpt #0");
36 (void)std::fprintf(stderr,
"Corium Panic: %s (%s:%d)\n", message, file, line);
51#if defined(CORIUM_ENABLE_ASSERTIONS) || !defined(NDEBUG)
52#define CORIUM_ASSERT(cond, msg) \
54 if (!(cond)) [[unlikely]] { \
55 ::corium::internal::panic(__FILE__, __LINE__, msg); \
59#define CORIUM_ASSERT(cond, msg) do { (void)sizeof(cond); } while (0)
62#define CORIUM_PANIC(msg) ::corium::internal::panic(__FILE__, __LINE__, msg)
void setPanicHandler(PanicHandlerFn fn) noexcept
Configure the global bare-metal panic handler hook (e.g. for Hardware Fault logging).
Definition Panic.hpp:45
void(*)(const char *file, int line, const char *message) noexcept PanicHandlerFn
Signature of the custom bare-metal panic handler callback.
Definition Panic.hpp:16
void panic(const char *file, int line, const char *message) noexcept
Definition Panic.hpp:25
PanicHandlerFn & getPanicHandler() noexcept
Definition Panic.hpp:20
Definition Application.hpp:16