microsoft / microsoft/vscode-cpptools

c++ debugger doesn't run

Open
#11,533 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the launch.json and tasks configuration shown, then inspect the debugger tab, Problems, Output, and Debug Console while using the listed gdb and g++ paths. Compare behavior with the default “g++: build and debug” configuration. Done means the debugger remains active, stops on breakpoints, and reports a useful error when launch fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, nixos, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.