# Debugging

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/go/2026.3/llms.txt).

Use the debugger to pause your program, inspect variables and goroutines, and step through function calls.

> **Note:**
> There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from GoLand. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in  [Attach to running Go processes with the debugger](attach-to-running-go-processes-with-debugger.html).

Procedure: Before debugging

1. Configure common [debugging properties and behavior](settings-debugger.html) in `Settings | Build, Execution, Deployment | Debugger`.

> **Tip:**
> If you are new to debugging, the out-of-the-box configuration will work for you. The topics about each debugger functionality provide references and explain the related settings where applicable. If you are an advanced user and looking for some particular property, see the [Debugger](settings-debugger.html) reference section.

2. Define a [run/debug configuration](run-debug-configuration.html) if you are going to use a custom one. This is required if you need some arguments to be passed to the program or some special activity to be performed before launch. For more information about setting up run/debug configurations, refer to the [Run/debug configurations](run-debug-configuration.html) section. Most of the time, you don't need this to debug a simple program that doesn't expect arguments or have any special requirements.

## General debugging procedure

Set breakpoints, start a debugging session, and inspect the program when it stops. Then step through the code or resume execution to the next breakpoint.

Procedure:

1. Define where the program needs to be stopped. This is done using [breakpoints](using-breakpoints.html). Breakpoints are special markers, which represent places and conditions when the debugger needs to step in and freeze the program state. A program, which has been frozen by the debugger is referred to as suspended.

2. [Run your program in debug mode](starting-the-debugger-session.html).

Just like with regular running of the program, you can

at the same time.

3. After the program has been suspended, use the debugger to [get the information about the state of the program](examining-suspended-program.html) and how it changes during running.

The debugger provides you with the information about variable values, profiler labels, the current state of the goroutines,  and so on.

While these tools let you examine the program state at a particular instant, the [stepping](stepping-through-the-program.html) feature gives you the control over step-by-step execution of the program. By combining the tools you can deduce where the bug is coming from and test your program for robustness.

