[ fromfile: debugging.xml id: debugging ]
The compiler can locate and describe syntax errors. The linker can reveal the existence of inconsistencies among program components and give some help as to how to locate them. One of the most challenging aspects to using C++ is learning how to find and fix various kinds of runtime errors.
Runtime errors are logical errors that can exist in a program that is syntactically correct and contains no undefined objects or functions. Effective use of a debugger, a program specifically designed for tracking down runtime errors, can greatly reduce the amount of time spent dealing with these kinds of errors.
A debugger permits the stepwise execution of your code and the inspection of object values. Because debuggers work with compiled code, the early versions could only be used by programmers who were familiar with assembly language. Modern debuggers can step concurrently through the compiled machine code and the original source code. The GNU family of developer tools includes gdb, the source-level GNU debugger, which you can use for C/C++ applications. gdb has been designed with a command-line interface that is quite powerful but not particularly user-friendly. Fortunately, there are several open source graphical facades for gdb, one of which we discuss next. Commercial C++ IDEs (e.g., Visual Studio) generally have built-in source-level debuggers.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |