2. DEFINITION :
A debugger is a software
program used to test and find bugs
(errors) in other programs . A debugger
is also known as a debugging tool.
3. In order to limit the impact of ISS, some
debuggers offer two modes of operation :
Full simulation
Partial simulation
4. There are two types of debuggers :
CorDBG (command-line debugger) – in this ,
compilation of the original c# file using the
debug switch is a must.
DbgCLR (graphic debugger) – used by Visual
Studio .NET
5. Some widely used debuggers are:
Firefox JavaScript debugger
GDB - the GNU debugger
LLDB
Microsoft Visual Studio Debugger
Valgrind
WinDbg
Eclipse debugger API used in a range of IDEs :
1. Eclipse IDE (Java)
2. Nodeclipse (JavaScript)
WDW, the OpenWatcom debugger
6. source-level debugger or symbolic
debugger: When the program "traps" or reaches a preset
condition, the debugger typically shows the location in
the original code ; seen in integrated development
environments.
low-level debugger or a machine-language
debugger : When the program "traps" or reaches a preset
condition, it shows the line in the disassembly (unless it also has
online access to the original source code and can display the
appropriate section of code from the assembly or
compilation).
7. When a program crashes, debuggers show the
position of the error in the target program.
Most debuggers also are capable of running
programs in a step-by-step mode, besides
stopping on specific points.
They also can often modify the state of
programs while they are running.
8. Breakpoints - Setting breakpoints at various positions in the program. The
breakpoints are points in the program at which the programmer wishes
to suspend normal execution of the program and perform other tasks.
Examining values of different memory locations - When the execution of a
program is suspended, the contents of specified memory locations can be
examined. This includes local variables (usually on the stack), function
parameters, and global (extern) variables.
Examining the contents of the program stack - The contents of the program
stack reveals information related to the function call sequence that is
active at that moment.
Depositing values in different memory locations - While the execution of
the debugged program is not underway (yet to start or suspended at a
breakpoint), the programmer can deposit any value in the memory
locations corresponding to the program variables, parameters to
subroutines, and processor registers.
Testing assertions - The programmer may specify relations involving
program values, that must hold at certain positions in the program
during execution.
Detecting conditions - Suspend execution of the program whenever any
user defined condition involving the program variables and/or
parameters is met.
9. Also known as "historical debugging" or "backwards
debugging".
These debuggers make it possible to step a program's execution
backwards in time.
Microsoft Visual Studio offers IntelliTrace reverse debugging for
C#, Visual Basic .NET, and some other languages, but not C++.
Reverse debuggers also exist for C, C++, Java, Python, Perl, and
other languages.
Some are open source; some are proprietary commercial software.
Some reverse debuggers slow down the target by orders of
magnitude, but the best reverse debuggers cause a slowdown of
2× or less.
10. There are four basic steps in debugging:
Discovering the Bug : Is there one? It is not
always obvious that you have a bug. (Why?)
Isolating the Bug : Where is it? Locate the
part(s) of the code that is causing the bug.
Finding the Bug : What exactly is wrong with
the buggy code fragment?
Fixing the Bug : How should the buggy
fragment be rewritten?
11. A “trap" occurs when the program cannot
normally continue because of a programming
bug or invalid data.
For example:
The program might have tried to use an
instruction not available on the current version
of the CPU or attempted to access unavailable
or protected memory.
12. Some debuggers operate on a single specific
language while others can handle multiple
languages transparently.
For example :
If the main target program is written in COBOL but
calls assembly language subroutines
and PL/1 subroutines, the debugger may have to
dynamically switch modes to accommodate the
changes in language as they occur.
13. Some debuggers also incorporate memory
protection to avoid storage violations such
as buffer overflow.
This may be extremely important
in transaction processing environments where
memory is dynamically allocated from
memory 'pools' on a task by task basis.
14. The code to be examined might
alternatively be running on an instruction set
simulator (ISS), a technique that allows great
power in its ability to halt when specific
conditions are encountered.
Note that use of simulators decreases
execution speed.