launch.json selects the incorrect debugger executable.
See original GitHub issueBrief Issue Summary
On my computer I have many different GCC installations, I have many LLVM installations etc…
When using the launch.json
example here, the incorrect dbgExe is selected.
Expected:
Expected behaviour, Cmake Tools select the correct debugger, the same one used if launched using the CMake Tools dedicated debug button.
Apparent Behavior:
The resulting error is this:
However the compiler is this:
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: C:/utils/bin/mingw64/bin/clang.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: C:/utils/bin/mingw64/bin/clang++.exe - skipped
Platform and Versions
- Operating System: Windows
- CMake Version: cmake version 3.19.0-rc3
- VSCode Version: 1.55.2
- CMake Tools Extension Version: 1.7.7
- Compiler/Toolchain: Clang 11.1.0
Other Notes/Information
I use clang from winlibs: http://www.winlibs.com/
My exact configuration in launch.json:
{
"name": "Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "PATH",
"value": "$PATH:${command:cmake.getLaunchTargetDirectory}"
}
],
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Configure launch.json for C/C++ debugging in Visual Studio ...
Specifies the full path to the executable the debugger will launch or attach to. The debugger requires this location in order to load...
Read more >[Debug] Wrong launch configuration is selected when trying to ...
Wrong launch configuration is selected for debugging when trying to launch a compound configuration if launch.json become opened in the editor.
Read more >vscode debug setting in launch.json with custom executable ...
1 Answer 1 · Delete "program" from launch.json. · Press Ctrl+Shift+P · Search "Python: Select Interpreter" · Select pipenv interpreter path.
Read more >launch.vs.json schema reference (C++) - Microsoft Learn
Describes the schema elements for the `launch.vs.json` file. ... executable file in Solution Explorer and choose Debug and Launch Settings.
Read more >VS Code | Build, Run and Debug in C++ - GeeksforGeeks
Then choose “g++.exe – Build and debug active file”. It refers to g++ GNU C++ compiler. After this a Launch.json file will appear, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fair enough, in that case is there anything like: ${command:cmake.debuggerPath}
That can be used to work around the difference?
The difference is because the
type": "cppdbg"
inlaunch.json
uses the debug adapter from Microsoft C/C++ Extension. It only uses the values defined in thelaunch.json
. It will try its best to fill in the missing files, E.g.miDebuggerPath
based on PATH.The CMake extension extends on top of the Microsoft C/C++ Extension and their debug button provides the additional configuration fields to C/C++ Extension Debug Adapter.