2. What is Debugging ?
◙ It is the process of fixing a bug in the software. In other words, it refers to
identifying, analyzing and removing errors.
◙ Debugging occurs as a consequence of successful testing .
◙ Debugging is not testing but often occurs as a consequence of testing .
3. Outcomes of Debugging :-
The debugging process will usually have one of two outcomes -
◙ The cause will be found and corrected or
◙ the cause will not be found .
5. Difference between Testing and
Testing is a process of finding bugs or
errors in a software product that is
done manually by tester or can be
Debugging is a process of fixing the
bugs found in testing phase .
Programmer or developer is
responsible for debugging and it can’t
A software bug is an error, flaw, failure or
fault in a computer program or system that
causes it to produce an incorrect or
unexpected result, or to behave in
unintended ways. The process of finding
and fixing bugs is termed "debugging"
A mistake in coding is called Error, error found by tester is called
Defect, defect accepted by development team then it is called Bug,
build does not meet the requirements then it Is Failure.”
9. Debugging Strategies
Debugging has one overriding objective - to find and correct cause of software error or
defect . The objective is a realized by a combination of systematic evaluation , intuition
and luck .
Eg.- A lamp in shivam’s house does not work . if nothing in the house works , the cause
must be in the main circuit breaker or outside ; shivam look around to see whether the
neighborhood is blacked out . I plug the suspect lamp into working socket and working
appliance into a suspect circuit . So goes the alternation of hypothesis and test .
10. Methods of Debugging -
◘ It is the common and least efficient method . this method is applied when
all else fails .
◘ Using a ‘ Let the computer find the error ’ philosophy ,
◘ memory dumps are taken , run time traces are invoked .
◘ scatter print statements throughout your program.
◘ Debugging with automated debugging tools .
◘ It is a debugging strategy .
◘ In other words , it is called reasoning and thoughtful strategy .
◘ It starts with symptoms of error , possibly in result of one or more test cases
and looking for the relationships among the symptoms , the error is often
13. General Example :-
◘ Last few times , shivam cuts his hair , it grew back . Inductive reasoning allows him to
generalize that after he cut his hair , it will always grew back .
The process of deduction proceeds from some general theories or premises,
using the processes of elimination and refinement, to arrive at a conclusion
(the location of the error).
“ Something impossible occurred , only solid
information is that it did occur . So we must
think backwards from the results to discover the
reasons . ”
◙ This method is effectively used for locating errors in small programs .This
method starts at the location where a symptom has been uncovered .
◙ we have to start tracing the program backward one step at a time
evaluating the values of all variables until the cause of error is found.
◙ The resulting debugger offers a structured view of dynamic events, similar
to lexical scope rules' effect on static visibility.
◙ This strategy is useful but in a large program with many thousands lines of
code, the number of backward paths increases and becomes unmanageably
17. In other words, start at the point where program gives incorrect result .
At this point you must deduce from output .By performing a mental reverse
execution of block from this point and repeat using the process of -
“ If this was the state of program at this point , then this must have been the
state of program up here ” .
18. Cause Elimination
It is manifested by induction or deduction and introduces the concept of
binary partitioning .
A “cause hypothesis ” is devised and the aforementioned data are used to
prove or disprove the hypothesis .
19. Debugging Tools
◙ Each of the above debugging approaches can be
supplemented with debugging tools. For debugging we can
apply wide variety of debugging tools such as debugging
compilers, dynamic debugging aids, automatic test case
generators, memory dumps and cross reference maps.
21. ◙ WinDbg is a multipurpose debugger for the Microsoft Windows computer operating system
. It can be used to debug user mode applications, device drivers, and the operating system
itself in kernel mode (kernel based memory dumps ) .
◙ dbx is a source-level debugger found primarily on Solaris, AIX, IRIX, Tru64 UNIX, Linux
and BSD operating systems. It provides symbolic debugging for programs written in C, C++,
Pascal, FORTRAN and Java.
◙ The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems
and works for many programming languages .
◙ Xcode - macOS ◙ ADB ◙ LLDB debugger
◙ Immunity Debugger
I.e when a test case uncovers an error , debugging is the process that results in the removal of error .
For eg . When heart started to love , Brain spotted love as functional error and tried to debug it .
Firstly test cases are created
Then all the cases are executed
After it we get results of testing , we debug ,
Suspeccted cause - if there is any suspected cause - Additional test then again test cases
Identified cause - correct it - regression test - system update does not reintroduce error - regression test aim at checking - 1 Functionality - black box
2 . Architecture - grey box
Dynamic testing - variable changes with time .
Testing - eg web - Selenium
App - jenkins
Failure - When a defect reaches the end customer it is called a Failure.
Fault - An incorrect step, process or data definition in a computer program which causes the program to perform in an unintended or unanticipated manner.
Self - Blame
Understand the system means understand frameworks , read api’s , etc
Start at beginning
Gather low level details and see failure
Divide and conquer the code , fix the noise first , but don’t go nuts
Change one variable first and restart , choose rifle not shotgun
Keep an audit trail - write down these - what u did , in what order , etc
Check plug - question assumptions .
Brute force is trial and error method
Memory dumps - process in which contents of memory are displayed and stored , in case of system crash , these dumps are used to examine the status of program .
Runtime Tracing is a feature for monitoring real-time dynamic interaction analysis of code. Runtime Tracing uses exclusive Source Code Insertion (SCI) instrumentation technology to generate trace data, which is turned into UML sequence diagrams . Tracing feature outputs a static .tsf file for each instrumented source file as well as a dynamic .tdf file.
First step is enumeration , all u know about is what program did correctly and incorrectly .
Observe the patterns .
Relationship 4 . by relationship , devise a hypothesis , one or more
5. Proove the hypothesis , not skip this , if you skip , these u are only skipping symptoms , not a bug .
Develop list of concievable causes of error .
Examine all data by looking contradictons, try to eliminate .
Refine hypothesis .
Checkpoints are marked , checkpointing schemes are used , like print statements .
Lexical scope is a convention used with many programming languages that sets the scope (range of functionality) of a variable .