|UMBC CMSC 201 Spring '02||CSEE | 201 | 201 S'02 | lectures | news | help|
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.
Messages like :
Here are the lines of sample.c from line 26 to 36 :
There is also a warning message:
Instead of cutting or commenting out every line that comes up with an error, it's important to try to understand what's causing that error.
In xemacs, the command [ESC]-x line (press escape, press x, then type the word line and hit enter) will turn on the line numbering. The line you're on will appear on the bottom bar. Like this :
ISO8--**-XEmacs: sample.c (C Font)----L30--All----------------
To jump to a line, the command [ESC]-x goto line (press escape, press x, then type the two words goto line and hit enter) will prompt you for the line number you want to go to. Then type in the line number and hit enter.
In vi, the command [CTRL]->g (hold down the control key while pressing "g") will show you what line you are on. To jump to a line, type in the line number and then press "G".
Thursday, 17-Jan-2002 13:52:21 EST