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

Unit 4.9 Debugging Techniqyes

Debugging is the process of identifying and fixing defects in software after testing has revealed errors. The debugging process involves executing test cases, investigating failures, identifying causes, and ensuring that fixes do not introduce new errors. Common techniques include brute force, backtracking, and cause elimination, with challenges arising from the distinction between bug symptoms and actual causes, timing issues, and sporadic bugs.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Unit 4.9 Debugging Techniqyes

Debugging is the process of identifying and fixing defects in software after testing has revealed errors. The debugging process involves executing test cases, investigating failures, identifying causes, and ensuring that fixes do not introduce new errors. Common techniques include brute force, backtracking, and cause elimination, with challenges arising from the distinction between bug symptoms and actual causes, timing issues, and sporadic bugs.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

DEBUGGING

TECHNIQUES
Definition:

Debugging is the process of detecting,


analyzing, and correcting defects (bugs) in
software to ensure it functions correctly.

Debugging occurs after testing when


errors are identified and need to be fixed.
Debugging Process

1. Execution of Test Cases – Running


tests to identify bugs.
2. Debugging Starts – Investigating
failures and collecting information.
3. Finding Suspected Causes – Identifying
potential reasons for failure.
4. Conducting Additional Tests – Running
more tests to narrow down the error.
5. Identifying Causes – Pinpointing the
actual issue in the code.
6. Performing Corrections – Fixing the
identified error.
7. Conducting Regression Tests –
Ensuring the fix did not introduce new
errors.
8. Generating Test Cases – Creating new
test cases for future validation.
Common Debugging Techniques
1. Brute Force Method:
The least efficient debugging method.It
relies on examining memory dumps, runtime
logs, and print statements.
Developers analyze program execution line
by line to find the error.

Example: A developer adds multiple print


statements to track variable values in a loop.
2. Backtracking Method:

Best suited for small programs.


Starts from the point of failure and traces
backward through the code to find the root
cause.

Example: If an incorrect output appears, the


developer checks previous function calls to
find where the error originated.
3. Cause Elimination Method:

Uses binary partitioning to systematically


eliminate possible error sources.
The program is divided into smaller parts,
and each part is tested separately to isolate
the bug.

Example: If a bug occurs in a program with


multiple modules, each module is tested
separately to find which one contains the error.
Why is Debugging Difficult?
Debugging can be challenging due to
several reasons:

1. Bug Symptoms vs. Actual Cause – The location of the


symptom may be different from where the actual error
occurs.
2. Errors Introduced by Developers – Some logical
mistakes made during coding may not be obvious.
3.Timing Issues – Some bugs appear due to timing
dependencies, especially in multithreading and real-
time systems.
4. Temporary Bug Disappearance – Sometimes,
fixing one issue hides another bug instead of
solving it permanently.

5. Rounding Errors – In numerical applications,


rounding inaccuracies can cause symptoms that
look like bugs.

6. Periodic Bugs – Some errors appear


sporadically, making them harder to detect.

You might also like