Abort
Description
Custom abort function that can be redirected for testing purposes. Traps directly via the architecture’s native trap instruction. If a callback is registered via OnAbort, it runs first; control then falls through to the trap (a callback that wants to short-circuit Abort must longjmp or exit itself).
Success
Function does not return. Any registered callback runs first, then the hardware trap fires.
Failure
Function cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Log.h:19:
// Forward declaration to avoid circular includes
void Abort(void);
///
- In
Log.h:48:
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
Abort(); \
} while (0)- In
Log.h:134:
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
Abort(); \
} while (0)- In
Log.h:222:
///
#define ASSERT_OR_FATAL(cond, msg) \
((cond) ? 0 : (LogWrite(LOG_MESSAGE_TYPE_FATAL, __func__, __LINE__, (msg)), Abort(), 0))
///
"stack-protector: canary corrupted -- buffer overflow detected"
);
Abort();
// Abort() is not declared noreturn in Misra/Std/Log.h (it's a
// function pointer indirection through OnAbort in some
- In
Sys.c:255:
}
void Abort(void) {
if (g_abort_callback) {
g_abort_callback();- In
TestRunner.c:288:
if (expect_failure) {
WriteFmt(" [Expected failure: Test aborted as expected]\n");
test_result = true; // Abort was the contract.
} else {
WriteFmt(" [Unexpected failure: Test aborted unexpectedly]\n");
Last updated on