THIS CHAPTER TEACHES YOU TWO TECHNIQUES you can use to debug your programs. One involves using the preprocessor to allow for the conditional inclusion of debugging statements in your program. The other technique involves the use of an interactive debugger. In this chapter, you are introduced to a popular debugger called
gdb. Even if you use a different debugger (such as
dbx, or one built in to an IDE tool), it is likely that your debugger will have similarities to
As noted in Chapter 13, “The Preprocessor,” conditional compilation is useful when debugging programs. The C preprocessor can be used to insert debugging code into your program. By appropriate use of
#ifdef statements, ...