# Debugging with Mozilla rr

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

> **TL;DR**
> Mozilla rr and its features are available only on Linux machines.
>
>
>
> Ensure that your CPU is compatible with Mozilla rr. See the list of limitations at [the official Mozilla rr site](https://rr-project.org/) in the Limitations section.

Mozilla rr records program execution so you can replay it in the debugger and investigate the same sequence of events more than once.

To debug a recording, wait for the application to exit or click stop the recording in the Debug tool window. You can then inspect the recorded execution and move forward or backward between breakpoints.

Procedure: Debug code with Mozilla rr

1. Install Mozilla rr. For installation instructions, refer to the [Building And Installing](https://github.com/mozilla/rr/wiki/Building-And-Installing).

2. In IntelliJ IDEA, set a breakpoint. To set a breakpoint, click the gutter near the code line where you want the debugger to stop code execution. For more information about breakpoints, refer to [Debug code](debugging-code.html) and [Breakpoints](using-breakpoints.html).

3. Click the Run icon (![The Run icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.runConfigurations.testState.run.svg)) in the gutter and select Record and Debug <configuration_name>. After recording finishes, inspect variables and goroutines in the Debug tool window.

Procedure: Navigate through the recorded trace

1. Navigate to `Run | Debug Saved Trace`.

2. In the Trace directory field, specify a path to the trace directory.

3. Click OK.

4. In the Debug tool window, click Resume Program to move forward to the next breakpoint, or Rewind to move backward to the previous breakpoint.

Procedure: Collecting Mozilla rr traces

1. In the application directory, build an executable with optimizations and inlining disabled:

```BASH
go build -gcflags="all=-N -l" -o myApp
```

Keep the debug information in the executable. Do not use linker flags such as `-w` or `-s` that remove information needed by the debugger.

2. Open the terminal and run the following Mozilla rr command: `rr record <path_to_the_application_executable>`

As a result, the Mozilla rr trace files appear in the following folder: `~/.local/share/rr/<executable_name>`

Procedure: Remote debugging with Mozilla rr

1. On the remote machine, [collect the Mozilla rr trace](#collecting-mozilla-rr-traces).

2. On the remote machine, start Delve with a loopback listener:

```BASH
dlv --headless --api-version=2 --listen=127.0.0.1:2345 replay /path/to/trace/dir
```

Replace `/path/to/trace/dir` with the recorded trace directory.

3. On your local machine, forward the debugger port through SSH:

```BASH
ssh -N -L 2345:127.0.0.1:2345 user@remote-host
```

Replace `user` and `remote-host` with your SSH username and the remote computer's address. Keep the connection open while debugging. Delve connections are not authenticated; keep the debugger port private.

4. On the local machine, create the Go Remote run/debug configuration. Set Host to `127.0.0.1` and Port to `2345`. For more information about creating run/debug configurations, refer to [Create a run/debug configuration](run-debug-configuration.html#createExplicitly).

5. On the local machine, ensure that the Go Remote run/debug configuration is selected from the list of configurations.

6. On the local machine, click `Run | Debug <remote_configuration_name>`. Alternatively, press `Shift+F9` (Windows), `⌃ D` (macOS), `⇧ F9` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ D` (macOS System Shortcuts), `Shift+F9` (XWin), `Shift+F9` (GNOME), `Shift+F9` (KDE), `Shift+F9` (Emacs), `Shift+F9` (Sublime Text), `⌃ D` (Sublime Text (macOS)), `Alt+F5` (Visual Studio), `⌥ F5` (Visual Studio (macOS)), `Ctrl+F5` (NetBeans), `Alt+Shift+D` (Eclipse), `⌘ F11` (Eclipse (macOS)).

