Functions and macros to assert, exit() or abort() and capture backtraces.
More...
#include <Assert.h>
|
static SC_COMPILER_FORCE_INLINE void | unreachable () |
|
static void | exit (int code) |
| Exits current process.
|
|
static void | print (const char *expression, const char *filename, const char *functionName, int lineNumber) |
| Prints an assertion to standard output.
|
|
static void | printAscii (const char *str) |
| Prints an ASCII string to standard output.
|
|
static bool | printBacktrace () |
| Prints backtrace (call stack) of the caller to standard output.
|
|
static bool | printBacktrace (void **backtraceBuffer, size_t backtraceBufferSizeInBytes) |
| Prints backtrace (call stack) previously captured with captureBacktrace() of the caller to standard output.
|
|
static size_t | captureBacktrace (size_t framesToSkip, void **backtraceBuffer, size_t backtraceBufferSizeInBytes, uint32_t *hash) |
| Captures backtrace of calling stack.
|
|
Functions and macros to assert, exit() or abort() and capture backtraces.
◆ captureBacktrace()
static size_t SC::Assert::captureBacktrace |
( |
size_t | framesToSkip, |
|
|
void ** | backtraceBuffer, |
|
|
size_t | backtraceBufferSizeInBytes, |
|
|
uint32_t * | hash ) |
|
staticnodiscard |
Captures backtrace of calling stack.
- Parameters
-
framesToSkip | Number of call stack frames to skip |
backtraceBuffer | A pre-allocated buffer to hold current backtrace |
backtraceBufferSizeInBytes | Size of the backtraceBuffer |
hash | Hash of current stack trace |
- Returns
- number of frames captured in backtraceBuffer
◆ exit()
static void SC::Assert::exit |
( |
int | code | ) |
|
|
static |
Exits current process.
- Parameters
-
code | Return code for calling process |
◆ print()
static void SC::Assert::print |
( |
const char * | expression, |
|
|
const char * | filename, |
|
|
const char * | functionName, |
|
|
int | lineNumber ) |
|
static |
Prints an assertion to standard output.
- Parameters
-
expression | The failed assertion converted to string |
filename | Name of the file where the assertion failed |
functionName | Name of the function containing the assertion that failed |
lineNumber | Line number where the assertion is defined |
◆ printAscii()
static void SC::Assert::printAscii |
( |
const char * | str | ) |
|
|
static |
Prints an ASCII string to standard output.
- Parameters
-
str | Pointer to ASCII string (no UTF8) |
◆ printBacktrace() [1/2]
static bool SC::Assert::printBacktrace |
( |
| ) |
|
|
staticnodiscard |
Prints backtrace (call stack) of the caller to standard output.
- Returns
true
if backtrace was correctly captured and print, false
otherwise
◆ printBacktrace() [2/2]
static bool SC::Assert::printBacktrace |
( |
void ** | backtraceBuffer, |
|
|
size_t | backtraceBufferSizeInBytes ) |
|
staticnodiscard |
Prints backtrace (call stack) previously captured with captureBacktrace() of the caller to standard output.
- Returns
true
if backtrace was correctly captured and print, false
otherwise
The documentation for this struct was generated from the following file: