The debugging interface of Visual Studio

Debug mode

First, before trying to use the debugger, make sure that the compilation of the project is in debug mode.

Breakpoints

We can insert a breakpoint by clicking on the left of the line we want to insert it to and we can remove it by clicking on it.

By putting the cursor on a breakpoint, an icon allowing us to disable it appears.

Alternatively, we can right click on a line to insert/remove/disable a breakpoint from the menu that appears.

Controlling the debugger

When we launch a program from Visual Studio, using the following button, it is automatically executed with the debugger.

If there are breakpoints, the execution of the program will stop when they are reached.

Alternatively, we can right click on a line and click on Run To Cursor to make the debugger run the program until that line is reached.

When the debugger is launched and comes to a stop, the debugging interface appears.

In the following 3 buttons:

The first one makes the debugger step into the function, the second one makes the debugger execute the next line of code and the last one makes it leave the current function.

By clicking on the button Continue, we can make the debugger continue the execution of the program (Until it crashes, a breakpoint is reached or the program terminates).

From the two following buttons:

We can close the debugger by clicking on the first one and restart it with the second one.

The value of the variables

When the execution of a program is stopped, we can see the value of a variable by putting the cursor on its name.

We can also see the value of the variables at the bottom-left of the window:

The function call stack