You are on page 1of 15

Debugging

A Nightmare?
The story of
“BUGS”
What is
Debugging?
Debugging...

Locating and Fixing Errors


Steps:

● Identify the Location and Nature of error.


● Correcting or fixing error
Types/Approaches:
> Brute Force
> Backtracking
> Breakpoint
> Induction
> Deduction
> Testing
Brute Force
● Involves Memory Dumps
● A memory dump is a snapshot of execution
sequence
Backtracking
● It is refinement of brute force method.
● Source code is traced out backwards.
● Reverse direction of the flow of control.
● Small size problems.
● Should be the last resort.
Breakpoint
● Stopping the program execution at breakpoint.
● Each breakpoint is associated with a
particular instruction.
● Breakpoint is also performed with watch
values.
● The incorrect or unexpected values are
monitored with watch values.
Debugging by induction
● Reasoning or thoughtful strategy.
● Start with the symptoms of the error in the
result of one or more test eases and looking
for relationships among the symptoms.
● The error is often uncovered.
Debugging by deduction
● This is the kind of cause elimination
method.
● On the basis of cause hypothesis, lists of
possible causes are enumerated.
● Now the tests are conducted to eliminate
causes to remove errors in the system.
● If all the causes are eliminated then
errors are fixed and hypothesis is proved.
Otherwise, hypothesis is refined to
eliminate errors.
Debugging by testing
● Uses test cases to locate errors.
● Test cases in testing cover many conditions
and statements.
● Test cases in debugging focuses on small
number of conditions and statements.
Pair programming

You might also like