0% found this document useful (0 votes)
27 views

Debugging

Goor work done

Uploaded by

adivarshney1606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Debugging

Goor work done

Uploaded by

adivarshney1606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

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

• This is the most common method of debugging


but is the least efficient method.
• In this approach, the program is loaded with print
statements to print the intermediate values with
the hope that some of the printed values will help
to identify the statement in error.
• This approach becomes more systematic with
the use of a symbolic debugger (also called a
source code debugger), because values of
different variables can be easily checked and
break points and watch points can be easily set
to test the values of variables effortlessly.
Backtracking
• This is also a fairly common approach. In this
approach, beginning from the statement at which
an error symptom has been observed, the
source code is traced backwards until the error
is discovered.
• Unfortunately, as the number of source lines to
be traced back increases, the number of
potential backward paths increases and may
become unmanageably large thus limiting the
use of this approach.
Cause Elimination Method
• In this approach, a list of causes which could possibly
have contributed to the error symptom is developed and
tests are conducted to eliminate each.
• A related technique of identification of the error from the
error symptom is the software fault tree analysis.

• 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

You might also like