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

DEBUGGING

Debugging is the process of finding and fixing errors in software. It involves identifying failure symptoms, tracing bugs to locate errors, and correcting errors. Common debugging techniques include using memory dumps, watch points with output statements or breakpoints, and single stepping through code. Backtracking is a logical debugging approach that starts at failure symptoms and traces code backwards to isolate bugs. Popular debuggers include those in Eclipse, Firefox, GDB, LLDB, Visual Studio, and WinDbg.

Uploaded by

arjun aju
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)
87 views

DEBUGGING

Debugging is the process of finding and fixing errors in software. It involves identifying failure symptoms, tracing bugs to locate errors, and correcting errors. Common debugging techniques include using memory dumps, watch points with output statements or breakpoints, and single stepping through code. Backtracking is a logical debugging approach that starts at failure symptoms and traces code backwards to isolate bugs. Popular debuggers include those in Eclipse, Firefox, GDB, LLDB, Visual Studio, and WinDbg.

Uploaded by

arjun aju
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/ 13

DEBUGGING

DEBUGGING
• Testing phase of SDLC can be divided into two parts :

• 1. Testing Testing involves preparation of test cases,


executing them, and observing the output.
• 2. Debugging If output of testing shows some failure, it is
required to find the bugs that caused the failure and remove
the errors present in the software. This is called debugging.

• Debugging process involves:


• 1. Identification of failure symptoms
• 2. Tracing the bug
• 3. Locating the errors that caused the bug &
• 4. Correcting the errors

• Debugging itself can be considered as a two part process:


• 1. Determining the exact nature of the bug and location of the
suspected error within the program
• 2. Fixing or repairing the program
Debugging Process
Steps in debugging process
• The debugging process is explained in following steps:
• 1. Check the result of testing process output. If the actual
output and expected output are same, then the results are
successful. Otherwise, the output is a failure which needs to
be analyzed.
• 2. Debugging is performed for the analysis of failure. Here, we
identify the cause of problem and correct it. If the symptoms
of failure are not sufficient to find the bug, additional testing is
performed to get more clues to analyze the cause of failure.
• 3. If the failure symptoms are sufficient to provide clues about
bug, then the cause of failure is identified. The bug is traced to
find the actual location of error.
• 4. Once the actual location of error is traced, the bug is
removed with corrections.
• 5. Regression testing is performed to validate corrections.
Debugging Techniques
1. Debugging with memory dump
2. Debugging with watch points
1. Output statements
2. Breakpoint Execution
1. Unconditional breakpoint
2. Conditional breakpoint
3. Temporary breakpoint
4. Internal breakpoint
3. Single stepping

3. BackTracking
Debugging Techniques
• 1. Debugging with memory dump
• • In this technique, a printout of all registers and relevant
memory locations is obtained and studied. The relevant
data and program stored in these registers and memory
locations are observed for any bug in the program
• • This method is used as the last option
• • Following are some drawbacks of this method:
• i. It is difficult to establish the correspondence between
storage locations and the variables in a source program.
• ii. Memory dump might contain massive amount of
irrelevant data
• iii. It is limited to static state of the program as it shows
state of the program at only one instant of time.
Debugging Techniques
• 2. Debugging with watch points
• • Programs final output may not give sufficient clues about the
bug. But, intermediate execution points may provide sufficient
cause of the problem. These points are known as watch points.
• • Debugging with watch points can be implemented with the
following methods:
• i. Output statements
• • In this method, output or print statements are inserted at various
watch points to check the status of variables.
• • The program is compiled and executed with these output
statements.
• Execution of output statements may give some clues to find the
bug.
• • Drawbacks of this method are :
• a. It may require many changes in the program which may mask
an
• error or introduce new errors in the program.
• b. After bug analysis, we may forget to remove the
addedstatements which may cause misinterpretations in the
result
Debugging Techniques
• ii. Breakpoint Execution
• • This is an advanced form of the watch point used with an automated
• debugger program.
• • Break point is a watch point inserted at various places in the program.
• Program is executed up to the breakpoint inserted so that we can
examine the status at that point. Afterwards, the program will resume
and will be executed further until next breakpoint.
• • Breakpoints allows controlled execution of program with necessary
stops
• for intermediate examinations.
• • Advantages of breakpoints over output statements :
• a. There is no need to compile the program after inserting breakpoints
• b. Removing the breakpoints after their requirement is easy
• c. The status of variable or particular conditions can be observed at the
breakpoint. No need to wait for complete execution of the program as
in the case of output statements.
Debugging Techniques
• • Breakpoints can be categorized as follows :
• a. Unconditional breakpoint :-
• It is a simple breakpoint without any condition to be evaluated.
Its execution stops the execution of the program
• b. Conditional breakpoint :-
• At his breakpoint, one Boolean expression is evaluated and if
true, the breakpoint will cause a stop; otherwise execution will
continue.
• c. Temporary breakpoint :
• This breakpoint is used only once in the program. After
executing once, the temporary breakpoint is automatically
removed.
• d. Internal breakpoint :
• These breakpoints are added by the debugger itself for its own
purposes and these are invisible to the user
Debugging Techniques
• iii. Single stepping
• • Single stepping allows the user to watch the status or
condition of
• variables after execution of every single instruction
• • Single stepping is implemented with the help of internal
breakpoints.
• Step-into
• • It means execution proceeds into any function in the current
source statement and stops at the first executable source line
in that function
• ii. Step-over
• • It is also called skip, instead of step.
• It treats function calls as an atomic operation without single
stepping through the called function.
Debugging Techniques
• 3.BackTracking
• • This is a logical approach for debugging
a program.
Debugging Techniques
• Following are the steps for backtracking process :
• i. Observe the symptoms of the failure at the output and reach the site
where the symptoms can be uncovered. For example, one value is not
getting displayed on the output due to non-working of function X.
• ii. From that site, trace the source code starting backwards and move
to the highest level of abstraction of design, the bug will be found in
this path.
• iii. Slowly isolate the module where bug resides using data flow
diagrams of the module.
• iv. Logical backtracking in the isolated module will lead to the actual
bug and error can thus be removed.
• • The person doing debugging using backtracking method must have
knowledge regarding design of the system in order to understand the
logical flow of the program.
• • This is more effective as compared to other methods to locate errors
quickly.
DEBUGGERS
1. Eclipse debugger API used in a range of IDEs:
Eclipse IDE (Java) Nodeclipse (JavaScript)
2. Firefox JavaScript debugger
3. GDB - the GNU debugger
4. LLDB
5. Microsoft Visual Studio Debugger
6. Radare2
7. Valgrind
8. WDW, the OpenWatcom debugger
9. WinDbg

You might also like