Chapter 5 Debugging Programs

Debugging a program is a two-phase process. The first phase involves correcting compiler and linker errors during the build process. These errors usually consist of incorrect language syntax, undeclared variables, misspelled keywords, or incorrect paths.

The second debugging phase occurs after any syntax errors are corrected and the project is successfully built. If the program does not perform correctly, you'll have to analyze the internal workings of the program. This means using a debugger to set breakpoints and examine variables, which allows you to locate the bug, correct it with the editor, and rebuild the program.

The Graphical Development Environment offers features for performing both phases of debugging with both Windows and DOS programs.

In addition, the Development Environment supports debugging of both EXE and DLL projects. This chapter covers debugging an EXE project. If you want to debug a DLL project, you need to first create an appropriate EXE shell program to call the DLL. Using the Run/Debug dialog box from the Options menu, you specify the name of the program that calls the DLL project.

In this chapter, you use the GENERIC program to learn debugging strategies and techniques within the development environment.