Phoenix
Object-oriented orthogonally persistent operating system
|
This file contains definitions for system-wide debugging and troubleshooting. More...
Go to the source code of this file.
Namespaces | |
namespace | anonymous_namespace{debug.h} |
Defines | |
#define | ASSERT(x) _ASSERT(x) |
Macro for assertions implementations. | |
#define | ENSURE(x) _ASSERT(x) |
Macro for persistent assertions implementations. | |
#define | NOT_REACHED() FAULT("Unreachable code reached") |
Macro for marking places in the code which should never be reached. | |
#define | FAULT(msg,...) __Fault(__FILE__, __LINE__, msg, ## __VA_ARGS__) |
Macro for indicating a fatal fault. | |
Functions | |
void | __Fault (const char *file, int line, const char *msg,...) __FORMAT(printf |
Fault handler. |
This file contains definitions for system-wide debugging and troubleshooting.
#define ASSERT | ( | x | ) | _ASSERT(x) |
Macro for assertions implementations.
Use it to insert an assertion in the code. The assertions are compiled in debug build only. So use it with caution, do not place functions calls into assertion condition. Use ENSURE macro for making persistent checks.
x | Condition to check. Issue fatal fault if evaluated to false. |
#define ENSURE | ( | x | ) | _ASSERT(x) |
Macro for persistent assertions implementations.
It is always compiled in both debug and release builds so it can be used as part of regular code for fatal faults checks.
x | Condition to check. Issue fatal fault if evaluated to false. |
#define FAULT | ( | msg, | |
... | |||
) | __Fault(__FILE__, __LINE__, msg, ## __VA_ARGS__) |
Macro for indicating a fatal fault.
msg | Message to log or output. |
#define NOT_REACHED | ( | ) | FAULT("Unreachable code reached") |
Macro for marking places in the code which should never be reached.
Reaching the marked place will cause fatal fault.
void __Fault | ( | const char * | file, |
int | line, | ||
const char * | msg, | ||
... | |||
) |
Fault handler.
This function should be defined in each component to handle various fatal faults, such as failed asserts, invalid internal state, unexpected execution paths etc.
file | Name of the source file where the fault occurred. |
line | Line number in a source file where the fault occurred. |
msg | Formatted message with the description of the fault. |