microsoft / microsoft/vscode-cpptools
GDB Debugging not working in Codespaces
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Bug type: Debugger
Describe the bug
- OS and Version: Codespaces
- VS Code Version: 1.60.1
- C/C++ Extension Version: 1.6.0
- Other extensions you installed (and if the issue persists after disabling them): Live Share Extension Pack, yes persists.
- A clear and concise description of what the bug is.
Run & Debug does not run GDB but instead prompts for Environment and then opens existing .vscode/launch.json file.
To Reproduce
- Add
.vscode/launch.jsonand.vscode/tasks.jsonto C++ project. - Add task for compiling shared library object.
- Add task for compiling executable that links to shared library object.
- Open cpp file for executable and click on
Run and Debugmenu. - Press
Playbutton to start debugging. - See prompt for Environment followed by
.vscode/launch.jsonfile opened in editor.
Additional context
This bug does not exist when running Run and Debug in a local VSCode instance or in a VSCode Remote Container instance. The Remote Container instance uses the same devcontainer as Codespaces so has an identical environment. Running GDB manually in the Codespaces terminal works as expected.
Symptoms appear to show that the .vscode/launch.json file is not being found or being ignored in this environment. Syntax errors in the file do not change anything, although removing it and then following the Environment and Task prompts will recreate the file in the correct location but then exhibit the same symptoms afterwards.
.vscode/launch.json:
{
"name": "Local",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set library path",
"text": "set env LD_LIBRARY_PATH=${workspaceFolder}",
"ignoreFailures": false
}
],
"preLaunchTask": "<Custom Task Name>",
"miDebuggerPath": "/usr/bin/gdb"
}
** Workaround **
Add VSCode User Setting:
"launch": {
"configurations": [
{
"name": "Global",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set library path",
"text": "set env LD_LIBRARY_PATH=${workspaceFolder}",
"ignoreFailures": false
}
],
"miDebuggerPath": "/usr/bin/gdb"
}
],
"compounds": []
}
Run Build Task Manually
Press F5 to run Debug
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Problem in Codespaces mit den aufgeführten Versionen von VS Code und der C/C++-Erweiterung unter Verwendung der Workspace-Dateien .vscode/launch.json und .vscode/tasks.json nachzustellen. Vergleiche Run and Debug mit lokalem VS Code und Remote Containers und verfolge anschließend, wie die Launch-Konfiguration des Workspace gefunden wird. Die Aufgabe ist erledigt, wenn die vorhandene Konfiguration berücksichtigt wird und GDB über Run and Debug ohne die Environment-Eingabeaufforderung startet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, vscode
- Bereich
- developer-experience, devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 28/100