IntelliJ IDEA 2024.3 Help

Exploring Go core dumps

Sometimes when you debug a program, you need to examine the code execution flow and understand the current state of a program. Go core dump is a file that contains the memory dump of running processes and their status during the life of a program. You can debug core dumps when the program finished its execution or while it is still running.

Create a Go core dump file on Linux

  1. Open a terminal in the directory with the file .

  2. Set the ulimit parameter to unlimited: ulimit -c unlimited.

  3. Build the program by running go build . in the terminal. The build command creates a binary file in the current project folder (for example, awesomeProject).

  4. To create a core dump file, run GOTRACEBACK=crash ./<binary_file_name> (for example, GOTRACEBACK=crash ./awesomeProject). This command creates a core file in the current project folder.

    Create Go core dumps on Linux

View the dump log

  1. Navigate to Run | Open Core Dump.

  2. In the Executable field, specify a path to the binary file (for example, awesomeProject).

  3. In the Core Dump field, specify a path to the core file (for example, core).

  4. Click OK. In the Debug tool window, select a frame that you want to inspect.

    Open the Go core dump in IntelliJ IDEA

View the Go core dump in IntelliJ IDEA

  1. Open or create the Go Build configuration for the Go file.

  2. In the Environment field, click the folder (The folder icon).

  3. In the Environment Variables dialog, click the Add icon (The Add icon).

  4. Click the Name field and type GOTRACEBACK.

  5. Click the Value field and type crash.

  6. Save all changes and click OK.

  7. Run the program Shift+F10. The output for the program is displayed in the debugger window.

    View Go core dumps in IntelliJ IDEA
Last modified: 26 May 2024