microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

Failing to start debugger on macOS #5694

Open tfar opened 4 years ago

tfar commented 4 years ago

Type: Debugger

Describe the bug

Additional context My launch.json contents:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/tool",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "miDebuggerPath": "/usr/bin/lldb",
            "logging": {
                "trace": true,
                "traceResponse": true,
                "engineLogging": true
            }
        }
    ]
}

Output of code --log trace --verbose when hitting the debug button:

[main 2020-06-25T08:00:41.340Z] menubarService#updateMenubar 1
[11243:0625/100042.272838:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebug", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[11243:0625/100042.401881:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebugResolve", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[11243:0625/100042.402678:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebug", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[11243:0625/100042.423564:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebug", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[11243:0625/100042.477098:INFO:CONSOLE(1670)] "%cTRACE color: #888 [File Watcher (node.js)] [ADDED] /Users/tobias/Library/Application Support/Code/logs/20200625T100002/ms-vscode.cpptools.txt", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[main 2020-06-25T08:00:42.573Z] menubarService#updateMenubar 1
[11243:0625/100042.702000:INFO:CONSOLE(1670)] "%cTRACE color: #888 [File Watcher (node.js)] >> normalized [ADDED] /Users/tobias/Library/Application Support/Code/logs/20200625T100002/ms-vscode.cpptools.txt", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[11243:0625/100043.924122:INFO:CONSOLE(1670)] "%c  ERR color: #f33 timeout after 1000 ms: Error: timeout after 1000 ms
    at t.RawDebugSession.handleErrorResponse (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3160:190)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3159:451
    at async t.RawDebugSession.shutdown (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3157:536)", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[main 2020-06-25T08:00:44.686Z] menubarService#updateMenubar 1
WardenGnaw commented 4 years ago

The miDebuggerPath requires the debugger to have a machine interface (MI). lldb itself does not support a MI Mode, you will need to point miDebuggerPath to lldb-mi.

LLVM has removed lldb-mi from its toolchain and XCode does not ship it anymore. So for macOS Catalina, the cpptools extension ships its own version of lldb-mi, you can exclude miDebuggerPath from your launch.json and we will auto-resolve that path.

tfar commented 4 years ago

Alright. I've removed the miDebuggerPath, with my launch.json now looking like:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/QA/UnitTest/checker",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb"
        }
    ]
}

Now I see the following in the logs when I hit the debug button:

[23727:0625/222039.646499:INFO:CONSOLE(1670)] "%cTRACE color: #888 [text file model] load() - enter file:///Users/tobias/Development/swift-public/Swiften/Client/BlockList.cpp", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[main 2020-06-25T20:20:39.885Z] menubarService#updateMenubar 1
[23727:0625/222040.741562:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebug", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[23727:0625/222040.746952:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebugResolve", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[23727:0625/222040.747922:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebug", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[23727:0625/222040.771155:INFO:CONSOLE(1670)] "%cTRACE color: #888 onWillActivateByEvent:  onDebug", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)
[main 2020-06-25T20:20:41.027Z] menubarService#updateMenubar 1
[23727:0625/222042.223168:INFO:CONSOLE(1670)] "%c  ERR color: #f33 timeout after 1000 ms: Error: timeout after 1000 ms
    at t.RawDebugSession.handleErrorResponse (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3160:190)
    at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3159:451
    at async t.RawDebugSession.shutdown (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3157:536)", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js (1670)

Which looks pretty much the same as before.

WardenGnaw commented 4 years ago

Can you share the logs from the debug console? engineLogs will be printed there.

tfar commented 4 years ago

The logs from debug consoleare empty. In the output tab right next to it, there is no entry for C/C++ logs either. 🤷

tfar commented 4 years ago

@WardenGnaw Any idea how to get down to the issue of missing debug console?

WardenGnaw commented 4 years ago

From the empty debug console it seems like VS Code isnt calling our debug adapter at all. This may be a weird state that may require you to reinstall VS Code and the extension.

Just to check, dDo you have lldb-mi in ~/.vscode/extensions/ms.vscode-cpptools-0.28.3/debugAdapters/lldb-mi, and if so, can it run in the commandline?

tfar commented 4 years ago

Yes. Running that works and answers like:

 ~> ~/.vscode/extensions/ms-vscode.cpptools-0.28.3/debugAdapters/lldb-mi/bin/lldb-mi
(gdb)