I'm trying to create a GDB debugging pipeline for my c files in VS Code (windows). You can find my tasks.json and launch.json below.
Now if the path to my source file(s) doesn't contain any spaces this works fine. However, if it does include spaces I will receive a message like this whenever the debugger tries to break:

This is because the source file it's looking for is actually located at
E:\Libraries\Dropbox\UNI\Semester 5\test.c
And I'm guessing either GDB has sent VS Code a bad link to the file, or VS Code doesn't understand spaces in it's file paths (which I doubt). Sorry but I don't really understand the link between GDB and VS Code during the debugging session.
Does anyone know how to fix this?
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build C Program",
"type": "shell",
"command": "gcc",
"options": {"cwd": "${fileDirname}"},
"args": [
"-g", "-o", "${fileBasenameNoExtension}.exe", "${fileBasename}"
],
"group": {"kind": "build","isDefault": true}
}
]
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\cygwin64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "Build C Program"
}
]
}