Debugging
Debugging
Debugging
• Once errors are identified in a program code, it is
necessary to first identify the precise program
statements responsible for the errors and then to fix
them.
• Debugging is a methodical process of finding and
reducing the number of bugs, or defects, in a computer
program or a piece of electronic hardware, thus making it
behave as expected.
• Identifying errors in a program code and then fix them up
are known as debugging.
• To debug a program or hardware device is to start with a
problem, isolate the source of the problem, and then fix
it.
Debugging Process
Debugging Approaches
• Brute Force Method
• Backtracking
• Cause Elimination Method
• Program Slicing
Brute Force Method
• Program Slicing
• This technique is similar to back tracking. Here the
search space is reduced by defining slices.
• A slice of a program for a particular variable at a
particular statement is the set of source lines preceding
this statement that can influence the value of that
variable.
Debugging guidelines
The following are some general guidelines for effective
debugging:
• Many times debugging requires a thorough
understanding of the program design. Trying to debug
based on a partial understanding of the system design
and implementation may require an excessive amount of
effort to be put into debugging even simple problems.
• Debugging may sometimes even require full redesign of
the system. In such cases, a common mistakes that
novice programmers often make is attempting not to fix
the error but its symptoms.
• One must be beware of the possibility that an error
correction may introduce new errors. Therefore after
every round of error-fixing, must be carried out.
regression testing