CS-211 Debugging Guidelines
Sometimes you run into a problem in your code. Whether it breaks during runtime or compile time, please make sure to follow these steps before asking for help:
- Spend at least 10 minutes trying to figure it out for yourself.
- Use the gdb debugger...
- Set break points at interesting points in your code.
- Run under the debugger until you hit a breakpoint.
- When you hit a breakpoint look at the current value of variables to see if you can figure out what is going on.
- Print debugger...
- Add printf statements to your code to determine the control flow of your code and variable values.
- Run your code with these extra printf statements to either figure out exactly what the problem is, or where you need more print statements to gather more information.
- Once you have figured out the problem, don't forget to remove all those print statements that you added. We don't want to see debug stuff, and you may get points subtracted for printing out extra stuff.
- Research...
- Talk to your buddies in the class. Are they seeing anything similar? How did they solve the problem? (It's OK to talk to your buddies as long as you don't copy their code.)
- If you are getting a specific error message from the compiler or run-time, try googling that message. It's amazing how often others on the web have solved the same problem you are facing.
- Check out StackOverflow to see if the question has been asked and answered there.
- Email the Professor and/or the TA's
- Attach the latest version of your code to the email as an attached file.
- Cut and paste error messages into your note if they aren't too extensive. Otherwise, cut and paste them into a text file and attach it to the email. Screen captures are an alternative, but they are harder to search or copy than text files.
- We'll answer as quick as we can... if you don't get a response within 24 hours, email again.