In this lesson, we’ll learn to execute our code step by step using a debugger. This way, we’ll be able to see the output each line produces and how different variables change during the life of a program.

Motivation

Once we learn to use the debugger, we will be able to understand the code by setting breakpoints and analyzing the values of different variables (state of the program).

Our main focus at this point is to familiarize ourselves with the debugger tool. We’ll look at the animations and then practice each step in the debugger tool given below.

Later in the course, we’ll focus on ways to make the most of the debugger tool by learning how to look for logical (semantic and runtime) errors. This way, we’ll come to appreciate the advantages and uses of the debugger even more.

Let’s dive into our GDBCompiler and debugger for C/C++ tutorial!

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy