CMU 15441 Computer Networking - Systems Dev. Tutorial IV (23 pages)

Previewing pages 1, 2, 22, 23 of 23 page document View the full content.
View Full Document

Systems Dev. Tutorial IV



Previewing pages 1, 2, 22, 23 of actual document.

View the full content.
View Full Document
View Full Document

Systems Dev. Tutorial IV

87 views


Pages:
23
School:
Carnegie Mellon University
Course:
15441 Computer Networking -
Documents

Unformatted text preview:

Systems Dev Tutorial IV Debugging Tips and Tools 15 441 Recitation Overview What is debugging Strategies to live or at least code by Tools of the trade gdb smart logging electric fence ethereal tcpdump What is debugging You tell me Everybody writes codes with bugs What debugging have you needed to do already on the IRC project Things to think about What caused the bug How did you end up finding it How could you have avoided the bug in the firstplace Debugging Philosophy Guiding Steps 1 Think about why you believe the program should produce the output you expected 2 Make assertions until you understand how your view differs from the computer s Coder code will produce output X Computer code will produce Z Requirements for Debugging WHAT program behavior to look for Sometimes this is nearly free e g compiler error or segfault Sometimes it is the hardest part e g logic bugs race conditions How to easily expose information to test hypothesis gdb logging strace ethereal Strategies to Live By Debugging is part art part science You ll improve with experience but we can try to give you a jump start Strategy 1 Debug with Purpose Don t just change code and hope you ll fix the problem Instead make the bug reproducible then use methodical Hypothesis Testing While bug Ask what is the simplest input that produces the bug Identify assumptions that you made about program operation that could be false Ask yourself How does the outcome of this test change guide me toward finding the problem Use pen paper to stay organized Strategy 2 Explain it to Someone Else Often explaining the bug to someone unfamiliar with the program forces you to look at the problem in a different way Before you actually email the TA s Write an email to convince them that you have eliminated all possible explanations Strategy 3 Focus on Recent Changes If you find a NEW bug ask what code did I change recently This favors writing and testing code incrementally using svn diff to see recent changes regression



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Systems Dev. Tutorial IV and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Systems Dev. Tutorial IV and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?