Debugging Your Code

_CEL_DEBUG_ macro

This library provides several utility routines for debugging purpose. Almost all debugging utilities work if CEL_DEBUG macro is defined as non-0 value.

Output Debug Messages

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.

Assertion Macros

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:

void some_routine(Image *inImage)
{
CEL_ASSERT(inImage);
...
}

Exception Logs

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.

_PXLL_DEBUG_FILE

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

_CEL_DEBUG_

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

Debug version of the library (Windows)

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.

CEL_ASSERT implementation (Windows)

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

See Also
Windows Development Notes, OS X Development Notes, Redhat Enterprise Linux/CentOS Development Notes

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo