microsoft / microsoft/vscode-cpptools

GDB Debugging not working in Codespaces

Aperta
#8,150 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

debugger
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

  1. Add .vscode/launch.json and .vscode/tasks.json to C++ project.
  2. Add task for compiling shared library object.
  3. Add task for compiling executable that links to shared library object.
  4. Open cpp file for executable and click on Run and Debug menu.
  5. Press Play button to start debugging.
  6. See prompt for Environment followed by .vscode/launch.json file 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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema in Codespaces con le versioni indicate di VS Code e dell’estensione C/C++, usando i file del workspace .vscode/launch.json e .vscode/tasks.json. Confronta Run and Debug con VS Code locale e Remote Containers, quindi traccia il modo in cui viene individuata la configurazione di avvio del workspace. Il lavoro è completato quando la configurazione esistente viene rispettata e GDB si avvia da Run and Debug senza la richiesta Environment.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, vscode
Ambito
developer-experience, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
28/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.