Skip to content

Instantly share code, notes, and snippets.

@Sasha-hk
Created May 5, 2022 19:42
Show Gist options
  • Save Sasha-hk/83598591c69404e4ef412562374a3741 to your computer and use it in GitHub Desktop.
Save Sasha-hk/83598591c69404e4ef412562374a3741 to your computer and use it in GitHub Desktop.

Debugging C++ with VS Code on linux

Launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "g++ - Build and debug active file",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}/${fileBasenameNoExtension}",
      "args": [],
      "stopAtEntry": true,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "logging": {"traceResponse": true},
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "C/C++: g++ build active file",
      "miDebuggerPath": "/bin/gdb"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment