JMU
Debugging
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Getting to Debugging
The Debugging Process
  1. Stabilize - Understand the symptom and the trigger condition identified by the test so that the failure can be reproduced.
  2. Localize - Locate the fault.
    • Examine the sections of code that are likely to be influenced by the trigger condition.
    • Form a hypothesis about the fault.
    • Instrument the relevant sections of code.
    • Execute the code using the instrumentation.
    • Prove or disprove the hypothesis. If proven, go to step 3; otherwise go to step 2.
  3. Correct - Fix the fault.
  4. Verify - Test the fix and run regression tests.
  5. Globalize - Look for and fix similar defects in other parts of the system. Refactor if necessary.
Nerd Humor
http://imgs.xkcd.com/comics/debugging.png
(Courtesy of xkcd)
Instrumentation Techniques