<Start> <Intro> <Install> <Legal> <Screen> <Buffer> <Sprite> <Input> <Misc> <Debug> <Utes> <Author>
Debugging

Overview

Debugging information can be compiled into JLib programs if debug support is built into the library when it is built. The generation of debug support is turned on by defining JDEBUG in the target header file jconfig.h. Please note that the library debugging code has nothing at all to do with symbolic debugging code as generated by your compiler options. The library debugging facilities may be used in your own programs to aid development.

Debug support may be default debugging code as described here, or target specific debug activity (which will be documented in targets.doc or target.txt). If JDEBUG is not defined when the library is built, all library debugging code is stripped from the final executable, and all debugging statements have no effect.

When compiled in, debug support takes the form of a runtime stack manipulated by the library which is dumped if an error occurs, allowing you to see which function caused any problems. In addition, a stream of debug information can be generated which prints every function entered and left, and any ancillary debug information included in the program code. The printing of functions entered and left, and ancillary debug statements can be activated for all or only parts of your program .

Once the library has been built with default debugging enabled, the following macros are available to provide debugging information:

JLIB_DEBUG_ON Dump debug information from this point.

JLIB_DEBUG_TRACE Dump all functions entered/left from this point.

JLIB_DEBUG_OFF Stop dumping all debugging information.

JLIB_ENTER(x) Record our entry to function x.

JLIB_LEAVE Record our leaving the current function.

These apply after JLIB_DEBUG_ON or TRACE

JLIB_DUMP_STACK Record our leaving the current function.

JLIB_SPRINTF(str,val) Print the string str with a specifier for val.

JLIB_PRINT_DEBUG_INFO(x) Print the string x.

You can use the debugging macros in you own programs if you wish, follow the style of the library source code if you are unsure of how to go about this.

Next Section: Library Utilities

<Start> <Intro> <Install> <Legal> <Screen> <Buffer> <Sprite> <Input> <Misc> <Debug> <Utes> <Author>