microsoft / microsoft/vscode-cpptools

c++ debugger doesn't run

Aperta
#11,533 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Environment
  • OS and version: nixos 23.02
  • VS Code: 1.78.2
  • C/C++ extension: 1.17.5
  • OS and version of remote machine (if applicable): -
  • GDB / LLDB version: 13.1
Bug Summary and Steps to Reproduce

Bug Summary:

Launching a c++ debugger from vscode doesn't launch debugger. For a moment the debugging icons show up, but quickly thedDebugger quits doesn't stopping on breakpoints. No error messages show anywhere in vscode console/problems/output.

Steps to reproduce:

  1. Use the default debugger configuration called "g++: build and debug" or configure launch.json like below:
// launch.json
"configurations": [
    {
      "name": "(gdb) Launch 1",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}/${fileBasenameNoExtension}",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
          {
              "description": "Enable pretty-printing for gdb",
              "text": "-enable-pretty-printing",
              "ignoreFailures": true
          },
          {
              "description": "Set Disassembly Flavor to Intel",
              "text": "-gdb-set disassembly-flavor intel",
              "ignoreFailures": true
          }
      ]
    },
 ]
}
  1. From withing vs code debugger tab start the debugger (in the example a configuration "(gdb) Launch 1"
  2. Observe how debugger seemingly starts, icons (start/continue/stop) show up for a moment but then disappear and nothing more happens.
  3. Inspect how nothing shows up in problems/output/debug console.
Debugger Configurations
{ "configurations": [
    {
      "name": "(gdb) Launch 1",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}/${fileBasenameNoExtension}",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
          {
              "description": "Enable pretty-printing for gdb",
              "text": "-enable-pretty-printing",
              "ignoreFailures": true
          },
          {
              "description": "Set Disassembly Flavor to Intel",
              "text": "-gdb-set disassembly-flavor intel",
              "ignoreFailures": true
          }
      ]
    },
  ]
}

{
  "tasks": [
    {
      "type": "cppbuild",
      "label": "C/C++: g++ build active file",
      "command": "/home/zmrocze/.nix-profile/bin/g++",
      "args": [
        "-fdiagnostics-color=always",
        "-g",
        "${file}",
        "-o",
        "${fileDirname}/${fileBasenameNoExtension}"
      ],
      "options": {
        "cwd": "${fileDirname}"
      },
      "problemMatcher": [
        "$gcc"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Task generated by Debugger."
    }
  ],
  "version": "2.0.0"
}
Debugger Logs
Nothing shows up anywhere after I enabled logging like hinted ^ above.
Other Extensions

No response

Additional Information

I'm using nixos so it might be bit weirder with the linker, I've hit problems before when the linker couldn't find something during compilation. BUT here this is irrelevant: 1) I can compile succesfully with these compilers, also from within vscode. 2) there's no indication whatsover from vscode that anything failed.

Versions:

$ which gdb
/home/zmrocze/.nix-profile/bin/gdb
$ which g++
/home/zmrocze/.nix-profile/bin/g++
$ g++ (GCC) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

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 con la configurazione launch.json e tasks mostrata, quindi esamina le schede Debugger, Problems, Output e Debug Console mentre utilizzi i percorsi gdb e g++ elencati. Confronta il comportamento con la configurazione predefinita “g++: build and debug”. Il lavoro è completato quando il debugger rimane attivo, si arresta sui breakpoint e segnala un errore utile quando l’avvio non riesce.

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

Valutazione

Stack tecnologico
cpp, nixos, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.