Debugging with Mozilla rr
Mozilla rr is a tool that you can use to record, replay, and debug applications. The main idea of Mozilla rr is to help you catch non-trivial bugs.
Mozilla rr records the whole program execution. It means that you can debug the recorded trace only when the program ends its execution. For servers and other long-running applications, you must terminate the running application (for example, by sending the SIGTERM signal from the console). After the recording, you can replay the execution in the debugger as many times as you need. Read more about Mozilla rr on the official Mozilla rr site.
Debug code with Mozilla rr
Install Mozilla rr. For installation instructions, see the Building And Installing.
In GoLand, 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, see Do not suspend code execution and Breakpoints.
Click the Run icon () in the gutter and select Record and Debug <configuration_name>. In the Debugger tool window, you can see a status of variables, processes, and threads on different stages of code execution.
Navigate through the recorded trace
In the Trace directory field, specify a path to the trace directory.
In the Debugger tool window, click the Resume Program icon () to continue program execution, or click the Rewind icon below to run the debug session backwards until the previous breakpoint.