StuBS
Loading...
Searching...
No Matches
Debugging functions

Macros

#define STRINGIFY(S)   #S
 Converts a macro parameter into a string.
 
#define assert_size(TYPE, SIZE)    static_assert(sizeof(TYPE) == (SIZE), "Wrong size for " STRINGIFY(TYPE))
 Statically ensure (at compile time) that a data type (or variable) has the expected size.
 
#define assert(EXP)
 Ensure (at execution time) an expression evaluates to true, print an error message and stop the CPU otherwise.
 
#define kernelpanic(MSG)
 Print an error message in the debug window and stop the current core.
 

Detailed Description

Macro Definition Documentation

◆ assert

#define assert ( EXP)
Value:
do { \
if (__builtin_expect(!(EXP), 0)) { \
assertion_failed(STRINGIFY(EXP), __func__, __FILE__, __LINE__); \
} \
} while (false)
#define STRINGIFY(S)
Converts a macro parameter into a string.
Definition assert.h:24

Ensure (at execution time) an expression evaluates to true, print an error message and stop the CPU otherwise.

Parameters
EXPThe expression to be checked

◆ assert_size

#define assert_size ( TYPE,
SIZE )    static_assert(sizeof(TYPE) == (SIZE), "Wrong size for " STRINGIFY(TYPE))

Statically ensure (at compile time) that a data type (or variable) has the expected size.

Parameters
TYPEThe type to be checked
SIZEExpected size in bytes

◆ kernelpanic

#define kernelpanic ( MSG)
Value:
do { \
DBG << "PANIC: '" << (MSG) << "' in " << __func__ \
<< " @ " << __FILE__ << ":" << __LINE__ << ") - CPU stopped." \
<< endl; \
Core::die(); \
} while (0)
#define DBG
An output stream, which is displayed in the debug window of the core it was executed on.
Definition output.h:39

Print an error message in the debug window and stop the current core.

Parameters
MSGerror message

◆ STRINGIFY

#define STRINGIFY ( S)    #S

Converts a macro parameter into a string.

Parameters
SExpression to be converted
Returns
stringified version of S