microsoft / microsoft/vscode-cmake-tools

Make CMake Tools aware of the legacy version of lldb-mi from cpptools

Open
#2,533 22 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: debug/launch quick fix
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

env:
macOS 10.12.6
Xcode 9.2 (9C40b)
vs code 1.66.2
ms-vscode.cpptools-1.9.8-darwin-x64
ms-vscode.cmake-tools-1.10.5

It can not debug C++ app.

### CMake Tools Diagnostics

```shell
{
"os": "darwin",
"vscodeVersion": "1.66.2",
"cmtVersion": "1.10.5",
"configurations": [
{
"folder": "/Users/witton/CMakeTest",
"cmakeVersion": "3.22.1",
"configured": true,
"generator": "Ninja",
"usesPresets": false,
"compilers": {
"C": "/usr/bin/clang",
"CXX": "/usr/bin/clang++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [
"file:///Users/witton/CMakeTest/main.cpp"
],
"responses": [
{
"uri": "file:///Users/witton/CMakeTest/main.cpp",
"configuration": {
"defines": [],
"standard": "c++14",
"includePath": [],
"compilerPath": "/usr/bin/clang++",
"compilerArgs": [
"-g",
"-O0",
"-Wall",
"-std=c++14"
]
}
}
],
"partialMatches": [],
"targetCount": 1,
"executablesCount": 1,
"librariesCount": 0,
"targets": [
{
"name": "demo",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
```

### Debug Log

```shell
[extension] [8366] cmake.debugTarget started
[main] Building folder: CMakeTest demo
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build demo
[proc] Executing command: /usr/local/bin/cmake --build /Users/witton/CMakeTest/build --config Debug --target demo --
[build] ninja: no work to do.
[cmakefileapi-parser] Read reply folder: /Users/witton/CMakeTest/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-d0ba8fd5bc2f594b735c.json","codemodel-v2-3c4997f1553d6835a8ef.json","directory-.-Debug-f5ebdc15457944623624.json","index-2022-05-05T14-38-31-0812.json","target-demo-Debug-0a2e5169e4b80ae610d6.json","toolchains-v1-4efbd97b41bf961ec1dc.json"]
[build] Build finished with exit code 0
[cache] Reading CMake cache file /Users/witton/CMakeTest/build/CMakeCache.txt
[cache] Parsing CMake cache string
[cache] Reading CMake cache file /Users/witton/CMakeTest/build/CMakeCache.txt
[cache] Parsing CMake cache string
[proc] Executing command: /usr/bin/lldb-mi --version
[proc] Executing command: /Users/witton/.vscode/extensions/ms-vscode.cpptools-1.9.8-darwin-x64/debugAdapters/lldb-mi/bin/lldb-mi --version
[proc] Executing command: /usr/bin/gdb --version
[proc] Executing command: /usr/bin/lldb --version
[proc] Executing command: /usr/bin/lldb --version
[main] Debug configuration from cache: {"type":"cppdbg","name":"Debug demo","request":"launch","cwd":"/Users/witton/CMakeTest/build","args":[],"MIMode":"lldb","miDebuggerPath":"/usr/bin/lldb","program":"/Users/witton/CMakeTest/build/demo"}
[main] Starting debugger with following configuration. {"workspace":"file:///Users/witton/CMakeTest","config":{"type":"cppdbg","name":"Debug demo","request":"launch","cwd":"/Users/witton/CMakeTest/build","args":[],"MIMode":"lldb","miDebuggerPath":"/usr/bin/lldb","program":"/Users/witton/CMakeTest/build/demo","environment":[{"name":"ELECTRON_RUN_AS_NODE","value":"1"},{"name":"TMPDIR","value":"/var/folders/my/pxc3drzx37d95dp6dmkd7y2h0000gn/T/"},{"name":"__CF_USER_TEXT_ENCODING","value":"0x1F5:0x19:0x34"},{"name":"SHELL","value":"/bin/bash"},{"name":"HOME","value":"/Users/witton"},{"name":"Apple_PubSub_Socket_Render","value":"/private/tmp/com.apple.launchd.vxo8WaTIAw/Render"},{"name":"SSH_AUTH_SOCK","value":"/private/tmp/com.apple.launchd.UCKTvzSSp6/Listeners"},{"name":"PATH","value":"/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/usr/local/mysql/bin"},{"name":"LOGNAME","value":"witton"},{"name":"XPC_SERVICE_NAME","value":"com.microsoft.VSCode.34496"},{"name":"USER","value":"witton"},{"name":"XPC_FLAGS","value":"0x0"},{"name":"ORIGINAL_XDG_CURRENT_DESKTOP","value":"undefined"},{"name":"VSCODE_CWD","value":"/"},{"name":"VSCODE_NLS_CONFIG","value":"{\"locale\":\"zh-cn\",\"availableLanguages\":{\"*\":\"zh-cn\"},\"_languagePackId\":\"1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn\",\"_translationsConfigFile\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn/tcf.json\",\"_cacheRoot\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn\",\"_resolvedLanguagePackCoreLocation\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn/dfd34e8260c270da74b5c2d86d61aee4b6d56977\",\"_corruptedFile\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn/corrupted.info\",\"_languagePackSupport\":true}"},{"name":"VSCODE_CODE_CACHE_PATH","value":"/Users/witton/Library/Application Support/Code/CachedData/dfd34e8260c270da74b5c2d86d61aee4b6d56977"},{"name":"VSCODE_IPC_HOOK","value":"/Users/witton/Library/Application Support/Code/1.66.2-main.sock"},{"name":"VSCODE_PID","value":"10403"},{"name":"MANPATH","value":"/usr/local/share/man:"},{"name":"HOMEBREW_BOTTLE_DOMAIN","value":"https://mirrors.ustc.edu.cn/homebrew-bottles/bottles"},{"name":"CLICOLOR","value":"1"},{"name":"HOMEBREW_REPOSITORY","value":"/usr/local/Homebrew"},{"name":"PYTHONIOENCODING","value":"utf-8"},{"name":"PWD","value":"/"},{"name":"SHLVL","value":"1"},{"name":"HOMEBREW_PREFIX","value":"/usr/local"},{"name":"INFOPATH","value":"/usr/local/share/info:"},{"name":"HOMEBREW_CELLAR","value":"/usr/local/Cellar"},{"name":"_","value":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron"},{"name":"VSCODE_AMD_ENTRYPOINT","value":"vs/workbench/api/node/extensionHostProcess"},{"name":"VSCODE_PIPE_LOGGING","value":"true"},{"name":"VSCODE_VERBOSE_LOGGING","value":"true"},{"name":"VSCODE_LOG_NATIVE","value":"false"},{"name":"VSCODE_IPC_HOOK_EXTHOST","value":"/var/folders/my/pxc3drzx37d95dp6dmkd7y2h0000gn/T/vscode-ipc-b8711c85-742a-47a1-878d-e832b33f6483.sock"},{"name":"VSCODE_HANDLES_UNCAUGHT_ERRORS","value":"true"},{"name":"VSCODE_LOG_STACK","value":"false"},{"name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL","value":"1"}]},"environment":[{"name":"ELECTRON_RUN_AS_NODE","value":"1"},{"name":"TMPDIR","value":"/var/folders/my/pxc3drzx37d95dp6dmkd7y2h0000gn/T/"},{"name":"__CF_USER_TEXT_ENCODING","value":"0x1F5:0x19:0x34"},{"name":"SHELL","value":"/bin/bash"},{"name":"HOME","value":"/Users/witton"},{"name":"Apple_PubSub_Socket_Render","value":"/private/tmp/com.apple.launchd.vxo8WaTIAw/Render"},{"name":"SSH_AUTH_SOCK","value":"/private/tmp/com.apple.launchd.UCKTvzSSp6/Listeners"},{"name":"PATH","value":"/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/usr/local/mysql/bin"},{"name":"LOGNAME","value":"witton"},{"name":"XPC_SERVICE_NAME","value":"com.microsoft.VSCode.34496"},{"name":"USER","value":"witton"},{"name":"XPC_FLAGS","value":"0x0"},{"name":"ORIGINAL_XDG_CURRENT_DESKTOP","value":"undefined"},{"name":"VSCODE_CWD","value":"/"},{"name":"VSCODE_NLS_CONFIG","value":"{\"locale\":\"zh-cn\",\"availableLanguages\":{\"*\":\"zh-cn\"},\"_languagePackId\":\"1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn\",\"_translationsConfigFile\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn/tcf.json\",\"_cacheRoot\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn\",\"_resolvedLanguagePackCoreLocation\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn/dfd34e8260c270da74b5c2d86d61aee4b6d56977\",\"_corruptedFile\":\"/Users/witton/Library/Application Support/Code/clp/1a7316c624e1dd66d26cf581ee0fb4ca.zh-cn/corrupted.info\",\"_languagePackSupport\":true}"},{"name":"VSCODE_CODE_CACHE_PATH","value":"/Users/witton/Library/Application Support/Code/CachedData/dfd34e8260c270da74b5c2d86d61aee4b6d56977"},{"name":"VSCODE_IPC_HOOK","value":"/Users/witton/Library/Application Support/Code/1.66.2-main.sock"},{"name":"VSCODE_PID","value":"10403"},{"name":"MANPATH","value":"/usr/local/share/man:"},{"name":"HOMEBREW_BOTTLE_DOMAIN","value":"https://mirrors.ustc.edu.cn/homebrew-bottles/bottles"},{"name":"CLICOLOR","value":"1"},{"name":"HOMEBREW_REPOSITORY","value":"/usr/local/Homebrew"},{"name":"PYTHONIOENCODING","value":"utf-8"},{"name":"PWD","value":"/"},{"name":"SHLVL","value":"1"},{"name":"HOMEBREW_PREFIX","value":"/usr/local"},{"name":"INFOPATH","value":"/usr/local/share/info:"},{"name":"HOMEBREW_CELLAR","value":"/usr/local/Cellar"},{"name":"_","value":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron"},{"name":"VSCODE_AMD_ENTRYPOINT","value":"vs/workbench/api/node/extensionHostProcess"},{"name":"VSCODE_PIPE_LOGGING","value":"true"},{"name":"VSCODE_VERBOSE_LOGGING","value":"true"},{"name":"VSCODE_LOG_NATIVE","value":"false"},{"name":"VSCODE_IPC_HOOK_EXTHOST","value":"/var/folders/my/pxc3drzx37d95dp6dmkd7y2h0000gn/T/vscode-ipc-b8711c85-742a-47a1-878d-e832b33f6483.sock"},{"name":"VSCODE_HANDLES_UNCAUGHT_ERRORS","value":"true"},{"name":"VSCODE_LOG_STACK","value":"false"},{"name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL","value":"1"}]}
[extension] [8366] cmake.debugTarget finished (returned undefined)
```

### Additional Information

When I add in settings.json:
```
"cmake.debugConfig": {
"MIMode": "lldb",
"miDebuggerPath": "/Users/witton/.vscode/extensions/ms-vscode.cpptools-1.9.8-darwin-x64/debugAdapters/lldb-mi/bin/lldb-mi"
},
```

it report:
`Unable to find GDB in default search path and /Users/witton/.vscode/extensions/ms-vscode.cpptools-1.9.8-darwin-x64/debugAdapters/lldb-mi/bin/lldb-mi.`

set
`
"miDebuggerPath": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi"
`

or set
`
"MIMode": "gdb",
"miDebuggerPath": "/usr/local/bin/gdb"
`
it does not take effect.

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 with the CMake Tools debug log and the cmake.debugConfig in settings.json, focusing on how the legacy lldb-mi path from cpptools is selected. Done means CMake Tools recognizes that legacy debugger on the reported macOS and allows the C++ app to start debugging.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, typescript, vscode
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.