Debugging Techniques If debugging is the process of removing bugs,
We've talked about a little already about how to use printf() statements to debug your programs, and by now all of you realize that it usually takes more time to debug a program than it does to write it. The good news is, as you gain more experience you'll make fewer logic and syntax errors. You'll also get better at debugging your own code. The bad news is, it's going to take a lot of experience. Today we're going to discuss some basic debugging techniques, including the use of a symbolic debugger to help you find and fix errors in your code. Basic steps to debuggingThe basic steps in debugging are the same for debugging computer programs, hardware, social systems, etc.:
Compile time vs. runtime
Compile time errorsThe compiler identifies several kinds of errors:
Linker errorsLinker errors tend to be simple and are usually caused be forgetting to include an object file or failing to define a function in one of them. % gcc proj3.o wator.o proj3.o: In function `main': proj3.o(.text+0x121): undefined reference to `PopulateOcean' wator.o: In function `GetNewPosition': wator.o(.text+0x65a): undefined reference to `GetRandomNumber' collect2: ld returned 1 exit status % Runtime errors
CSEE | 201 | 201 S'05 | lectures | news | resources | help |
|