Skip to content

Instantly share code, notes, and snippets.

@yuxuan-z19
Last active May 3, 2025 05:14
Show Gist options
  • Save yuxuan-z19/4d86652d55a9b8e962939fda670fe698 to your computer and use it in GitHub Desktop.
Save yuxuan-z19/4d86652d55a9b8e962939fda670fe698 to your computer and use it in GitHub Desktop.
VSCode debugger configs for Modern Fortran
// .vscode/launch.json
{
"configurations": [
{
"name": "Fortran: gfortran build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "Fortran: gfortran build active file",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
// .vscode/tasks.json
{
"tasks": [
{
"type": "shell",
"label": "Fortran: gfortran build active file",
"command": "/usr/bin/gfortran",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger"
}
],
"version": "2.0.0"
}
@yuxuan-z19
Copy link
Author

For those who are new to the VSCode debugger, please take a look at the comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment