Blog - What Does a Debugger Do?
July 17, 2020

What Does a Debugger Do?

Debugging Best Practices

Are your applications running slow? Perhaps they aren’t behaving correctly, or are unexpectedly crashing?

There are a number of causes for performance issues in applications, and these issues can be found and solved using a process called debugging.

Back to top

What Is Debugging?

Debugging is the process of analyzing how your program runs, how it generates data in order to find defects and issues in your code. These errors or defects are referred to as “bugs”, hence the term “debugging.”

Debugging is not always about finding problems in the code. It can also be used to simple learn how code runs so a developer gains a thorough understanding of it before they refactor or enhance the code with new functionality. This form of debugging is typically called dynamic analysis.

A debugger is a fantastic tool for either of these cases.

Back to top

What Does a Debugger Do?

A debugger is a tool that is typically used to allow the user to view the execution state and data of another application as it is running. Debuggers allow users to halt the execution of the program, examine the values of variables, step execution of the program line by line, and set breakpoints on lines or specific functions that, when hit, will halt execution of the program at that spot. In this view, seeing how the program is viewed by their computer, the user can discover how a program flows, identify incorrect code and data, and find semantic errors in the program.

Back to top

How to Debug a Program

There are a number of different techniques or ways you can go about debugging an application.

Interactive Debugging

The most common debugging technique is interactive debugging. In this process, you’ve loaded your program with the debuggers graphical user interface (GUI) and analyze the running program by stepping through code, setting break points, examining program data, and looking at how it's running.

Reverse Debugging

Advanced debuggers allow users to record the execution of the program and allow users to perform all the usual operations for stepping code in reverse. This time-saving technology allows developers to quickly hone in on errors in one debugging session. Reverse debugging is also a fantastic tool for performing dynamic analysis and gaining a thorough understanding of how a program runs.

Remote Debugging

Interactive debugging is often coupled with remote debugging. With remote debugging, you are debugging an application that is deployed on a different computer from a remote location. This could be anywhere — the other side of the lab, the other side of your campus, or even across the country or world. A debugger needs the capabilities to be able to debug remotely on that type of system.

Post-Mortem Debugging

Post-mortem debugging is a technique where you've gathered information during a run, but you don't have access to it until later, and then your programming crashes. In this scenario, you want to gather as much information as you can so it can be analyzed later to diagnose what happened during the run of your program.

Delta Debugging

Also called comparative debugging, this is a way of comparing one run to another, or two programs running side-by-side and looking for ways that they differ in their execution of the lines that they're going through, or the ways that their data differs between the two.

Batch Debugging

This may also be referred to as unintended debugging. In this scenario, the debugger is still in control of your program even while you're not sitting in front of a GUI. The debugger is driving the program through to completion and along the way it will save that off, so that a post-mortem debugging can be performed later.

Back to top

TotalView Debugging Tools

Perforce’s debugger, TotalView, provides all of the features and more discussed in this article. It also supports all of the debugging techniques listed earlier, providing all the tools required by developers to efficiently debug and dynamically analyze their complex applications.

See how debugging a program is easier and faster with TotalView by signing up for a free trial.

Try Free

Additional Resources

Back to top