Next: Utility Routines Up: Trace Library Previous: Operations

Usage Rules

Trace and assert statements are macros which are only active in DEBUG mode (see section 12). In OPTIMIZE mode, debugging and trace statements go away completely. One should keep this in mind to avoid bugs that show up only in OPTIMIZE mode. For example, the statment:


        xAssert( mapResolve(map, key, &p) == XK_SUCCESS );

will have no effect in OPTIMIZE mode. One should be careful to separate the operation and the check of the return code:


        res = mapResolve(map, key, &p);
        xAssert( res == XK_SUCCESS );

If you are writing a new protocol, you should insert trace statements. Even though there will never be bugs left after you release your protocol, it may help others in debugging their protocol which sits on top of, or below, yours. Don't delete these very helpful debugging libraries when you are done.

The trace levels listed in section 8.1 are in increasing order of severity. When an x-kernel runs with tracing enabled, trace statements associated with a trace variable will print if their trace level is at least as severe as the value of the trace variable. For example, if the TCP trace variable is set to TR_GROSS_EVENTS, this will cause TCP trace statements with trace levels of TR_GROSS_EVENTS, TR_ERRORSand TR_ALWAYSto be displayed. To display all TCP trace statements, one would set the TCP trace variable to have the value TR_FULL_TRACE.



Next: Utility Routines Up: Trace Library Previous: Operations


Tue Nov 29 16:28:56 MST 1994