This library provides several utility routines for debugging purpose. Almost all debugging utilities work if CEL_DEBUG macro is defined as non-0 value.
To output debug messages on the console or development IDE debugging view, you can use cel_dbgPrintf function. This function works much like as std::printf but it also outputs the messages on the IDE (on Windows, it internally uses OutputDebugString function to do it). And it is disabled when CEL_DEBUG is defined as 0 or not defined.
This library provides CEL_ASSERT for assertion purpose. This function calls abort()
if the condition specified is not true. The following code illustrates how to use it:
The library internally processes several exceptions thrown by low-level functions and you usually see only the top-level thrown exceptions. It's very useful in normal case not to see these internal exceptions but in the debugging phase, it may be useful if you can see these exceptions.
There's an environment variable named _PXLL_DEBUG_FILE
, if you set the value, the library uses logs all the exceptions thrown to the file.
On Windows, _PXLL_DEBUG_FILE
can be defined as follows:
set _PXLL_DEBUG_FILE=C:\work\test.log
There's an environment variable named _CEL_DEBUG_
, if you set the value to 1, the library uses logs all the messages passed to cel_puts and cel_printf functions.
set _CEL_DEBUG_=1
This SDK also provides you the debug versions of the library solely for debugging purpose; the libraries under debug or debug_md must not be used for releasing your products.
Initially, we didn't provide the developers with the debug versions of the library. But recent Visual C++ toolkit does not allow us to link the debug version codes against the release versions of library and it's almost impossible to debug the applications without the debug versions of the library. This is the reason why we finally decided to provide you with the versions.
The debug versions are different to the release versions on the following points:
Please note that anyway the debug versions are for workaround of the link issues and they don't contain the actual debug information. It means that you cannot step into the library internals.
On Windows, CEL_ASSERT internally calls _CrtDbgReport. with _CRT_ASSERT
report type. And the first call to PixelLiveSystem::create() initializes the output of debugging messages using _CrtSetReportMode and _CrtSetReportFile functions. The following table illustrates the configuration:
Report Type | Report Mode |
---|---|
_CRT_WARN | _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG |
_CRT_ERROR | _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_WNDW |
_CRT_ASSERT | _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_WNDW |
And all the messages are written to stderr
. You can also explicitly change this behavior by calling _CrtSetReportMode and _CrtSetReportFile.