Lably
Skip to content

Debugger

Software for debugging a computer program

  • 5 min read
  • 6 chapters

Related on Lably

Through Software, Execution (computing) and Computer program

A source-level debugger (a.k.a. symbolic debugger) provides a user experience that integrates the program's source code. Typically, such a debugger can indicate which line of source code corresponds to the execution point of the program and allows for reading and writing memory via the symbols of the source code. In contrast, a low-level debugger (a.k.a. machine-language debugger) shows the execution point as machine code or its associated assembly language and allows memory access by address only.

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, but which will typically be somewhat slower than executing the code directly on the appropriate (or the same) processor. Some debuggers offer two modes of operation, full or partial simulation, to limit this impact.

Features

Typically, debuggers offer a query processor, a symbol resolver, an expression interpreter, and a debug support interface at its top level. Debuggers also offer more sophisticated functions such as running a program step by step (single-stepping or program animation), stopping (breaking) (pausing the program to examine the current state) at some event or specified instruction by means of a breakpoint, and tracking the values of variables.Some debuggers have the ability to modify the program state while it is running. It may also be possible to continue execution at a different location in the program to bypass a crash or logical error.

The same functionality which makes a debugger useful for correcting bugs allows it to be used as a software cracking tool to evade copy protection, digital rights management, and other software protection features. It often also makes it useful as a general verification tool, fault coverage, and performance analyser, especially if instruction path lengths are shown.

Most mainstream debugging engines, such as gdb and dbx, provide console-based command line interfaces. Debugger front-ends are popular extensions to debugger engines that provide IDE integration, program animation, and visualization features.

Handling program errors

If a program is running with a debugger, and an exception occurs because of a programming bug or invalid data, the debugger is notified of the exception. When the program "traps" or reaches a preset condition, the debugger typically shows the location in the original code if it is a source-level debugger or symbolic debugger. If it is a low-level debugger or a machine-language debugger 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).

Record and replay debugging

Record and replay debugging, also known as "software flight recording" or "program execution recording", captures application state changes and stores them to disk as each instruction in a program executes. The recording can then be replayed and interactively debugged to diagnose and resolve defects. Record and replay debugging is useful for remote debugging and for resolving intermittent, non-deterministic, and other hard-to-reproduce defects.

Reverse debugging

Some debuggers include a feature called "reverse debugging", also known as "historical debugging" or "backwards debugging". These debuggers make it possible to step a program's execution backwards in time. Various debuggers include this feature. Microsoft Visual Studio (2010 Ultimate edition, 2012 Ultimate, 2013 Ultimate, and 2015 Enterprise edition) 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. Reverse debugging is very useful for certain types of problems, but is not commonly used.

Time travel debugging

In addition to the features of reverse debuggers, time travel debugging also allow users to interact with the program, changing the history if desired, and watch how the program responds.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication