Debugging Flashcards
1
Q
Failure reproduction
A
a matter of identifying inputs to the program (whether data it receives upon being executed, user inputs, network traffic, or any other form of input) that causes the failure to occur.
2
Q
localize the defect
A
trying to identify the cause of the failure in code.
3
Q
steps to localize (hypothesis):
A
- Observe failure
- Form hypothesis of cause of failure
- Devise a way to test hypothesis, such as analyzing the code you believe caused it or executing the program with the reproduction steps and stopping at the line you believe is wrong
- If the hypothesis was supported (meaning the program failed for the reason you thought it did), stop. Otherwise, return to 1
4
Q
work backwards to localize:
A
- Observe failure
- Identify the line of code that caused the failing output
- Identify the lines of code that caused the line of code in step 2 and any data used on the line in step 2
- Repeat three recursively, analyzing all lines of code for defects along the chain of causality
5
Q
delta debugging
A
compare successful and failing executions of the program.
- Identify a successful set of inputs
- Identify a failing set of inputs
- Compare the differences in state from the successful and failing executions
- Identify a change to input that minimizes the differences in states between the two executions
- Variables and values that are different in these two executions contain the defect
6
Q
work forward to localize:
A
- Execute the program with the reproduction steps
- Step forward one instruction at a time until the program deviates from intended behavior
- This step that deviates or one of the previous steps caused the failure
- easy to follow, but can take a long time because there are so many instructions that can execute.