UMBC CMSC 201
CSEE | 201 | 201 F'06 | 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, two commands can be used [ALT]-g [ENTER] and then it will prompt for the line number to go to, or 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, 09-Nov-2006 16:18:45 EST