I'm working on a project where I debug with GDB and OpenOCD. Sometimes we use VS Code for this purpose and I encountered an issue that the Run & Debug session won't launch when PYTHONHOME/PYTHONPATH are set to another Python installation. If I set the paths empty or to the correct mingw path in the current environment, it works.
Here is my launch.json config
"name": "GDB-Launch OpenOCD",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/output/openocd_debug.exe",
"args": [
"-f${workspaceFolder}/output/openocd_debug.cfg"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/output/",
"environment": [
{"name": "PYTHONHOME", "value": "${config:mingw_path}\\mingw64\\bin"},
{"name": "PYTHONPATH", "value": "${config:mingw_path}\\mingw64\\lib\\python3.7"}
],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "${config:mingw_path}\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
I have a workaround where I put
"terminal.integrated.env.windows": {
"PYTHONHOME": "",
"PYTHONPATH": ""
}
inside of settings.json (either project settings or user settings works). But I still want to know why and how there is an issue.
I do not get an error message or some weird output. When I want to start the Debug session, WindowsDebugLauncher gets called, changes compiler paths and then it freezes. In a working setup this process is the same but after that GDB (Debug console) and OpenOCD get called and open up.