Phoenix
Object-oriented orthogonally persistent operating system
Namespaces | Defines | Functions
debug.h File Reference

This file contains definitions for system-wide debugging and troubleshooting. More...

This graph shows which files directly or indirectly include this file:

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.

Detailed Description

This file contains definitions for system-wide debugging and troubleshooting.


Define Documentation

#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.

Parameters:
xCondition 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.

Parameters:
xCondition to check. Issue fatal fault if evaluated to false.
#define FAULT (   msg,
  ... 
)    __Fault(__FILE__, __LINE__, msg, ## __VA_ARGS__)

Macro for indicating a fatal fault.

Parameters:
msgMessage 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.


Function Documentation

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.

Parameters:
fileName of the source file where the fault occurred.
lineLine number in a source file where the fault occurred.
msgFormatted message with the description of the fault.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines