Finding Bugs Using a Debugger

Learn how to use a debugger to find bugs.

We'll cover the following

What is a debugger?

A debugger is a tool that can help us see what happens when a program is running. As we’ve already mentioned, some bugs can be hard to find and understand just by running the program. Often, we’ll discover a strange behavior in the program, but it might not be obvious what the reason behind this behavior is.

A debugger is an application that’s tailored for a particular programming language and can be used to pause the application at a specified code line. At this point, we can inspect what values all the variables have.

We can also resume the execution of the program or execute it one line at a time to see what happens. Let’s try using a debugger. To do this, we first need to pick a language and then write a small program that contains a logical error. We can take one of the errors that we previously looked at:

Get hands-on with 1200+ tech skills courses.