microsoft / microsoft/vscode-cpptools

c++ debugger doesn't run

Offen
#11,533 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Fehler mit der gezeigten launch.json- und tasks-Konfiguration zu reproduzieren, und untersuche dann die Registerkarte Debugger, Problems, Output und Debug Console, während du die aufgeführten gdb- und g++-Pfade verwendest. Vergleiche das Verhalten mit der standardmäßigen Konfiguration „g++: build and debug“. Als erledigt gilt die Aufgabe, wenn der Debugger aktiv bleibt, an Breakpoints anhält und einen hilfreichen Fehler meldet, wenn der Start fehlschlägt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, nixos, vscode
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.