Next: Performance Enhancing Tools
Up: Debugging tools
Previous: Following are the possible
- dbx can be used to step through the code and find the problem.
- Generous use of printf statements to print the various information at
the various steps can be helpful.
It is better if the information printed is only one line
long otherwise output is very cluttered.
- All the debugging statements can be enclosed in #ifdef _DEBUG_ and #endif
pairs. Then use #define _DEBUG_, at the beginning of the source file to enable debugging. For example,
#define _DEBUG_ /* Only once and at the begininng of any source file */
........
#ifdef _DEBUG_
printf("If I am here, there is a problem. Count = %d\n", Count);
#endif
The debugging statements can be disabled by removing the statement #define _DEBUG_.
Sushil Prasad
Fri Oct 9 10:28:36 EDT 1998