A debugger is a computer program that let the user to run the program, line by line to examine, find and eliminate bugs from the programs. When a program crashes, debugger tells the programmer what types of errors it finds and often marks the exact location of the error or bug in the target program. It allows the programmer to work interactively, control the execution of the program, stop it at various times when needed, and examine variables etc.
The process of identifying and removing errors from computer hardware or software is referred as debugging. Most of the debugger run programs in a step-by-step mode, in addition to stopping on specific points. They also can often modify the state of programs while they are running.
Features of debugger:
Set Breakpoints: Debugger allow the user to set breakpoints. These breakpoints stop program execution at a specific point on demand to review the debugging process. At that point the program execution drops back into the debugger to look at variables, or continue executing through the code. These breakpoints can be set up on a specific line number, at the beginning of a function, at a specific address etc.
Set Watchpoints: Watchpoints are a particular type of breakpoints which stop the code as soon as a variable changes. A watchpoint looks at the memory address of the variable and alerts the programmer when something is written to it.
Memory protection: Some of the debuggers also include memory protection feature that avoids the storage violations like buffer overflow. This feature is becomes very vital in cases of transaction processing environments.
How Debugger works?
Debugger use instruction-set simulators instead of running a program directly on the processor. This helps them to achieve a higher level of control over the program’s execution. Debugger stop or halt the program according to specific conditions with the help of these simulators.
General Debugging techniques
There are mainly two types of debugging techniques: standard and specialized.
Examples of Debugger: Some widely used debugger include GNU Debugger (GDB), LLDB, Microsoft Visual Studio Debugger, Valgrind, Intel Debugger (IDB) etc.