vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.42k stars 237 forks source link

CodeLLDB not working with Clang 15.0.0 x86_64-apple-darwin23.1.0 #1026

Closed yanggeorge closed 8 months ago

yanggeorge commented 8 months ago

OS: Sonoma 14.1 VSCode version: 1.83.1 C/C++ IntelliSense version: v1.18.0 CMake Tools version: v1.16.20 CodeLLDB version: v1.10.0 Compiler: Clang 15.0.0 x86_64-apple-darwin23.1.0 Debuggee: Executable Files

launched debug process exits with code -1 . Everything was fine until I upgraded macOS to Sonoma 14.1 and installed xcode 15.01. So I suspect that the lldb in the bin directory of codelldb might be incompatible with clang-1500.0.40.1, is that possible?

I create a demo project to reproduce this problem. there are only two files. CMakeLists.txt

cmake_minimum_required(VERSION 3.15)
project(demo)
add_compile_options(-g)
add_executable(demo main.cpp)

main.cpp

#include <iostream>

int main() {
    std::cout << "hello" << std::endl;
}

and settings.json

{
    "editor.tabSize": 4,
    "files.autoSave": "afterDelay",
    "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
    "lldb.verboseLogging": true
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "demo",
            "program": "${command:cmake.launchTargetPath}",
            "args": [],
            "cwd": "${workspaceFolder}"
        }
    ]
}

Using /usr/bin/lldb to debug my target is fine. but If using /Users/ym/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/lldb/bin/lldb to debug my target goes wrong like below

~/me/cxx/demo/build/ [dev*] /Users/ym/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/lldb/bin/lldb ./demo                                
(lldb) target create "./demo"
Current executable set to '/Users/ym/me/cxx/demo/build/demo' (x86_64).
(lldb) r
Process 25535 launched: '/Users/ym/me/cxx/demo/build/demo' (x86_64)
Process 25535 exited with status = -1 (0xffffffff) lost connection
(lldb) 
Verbose log
 Initial debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'demo',
  program: '${workspaceFolder}/build/demo',
  args: [],
  cwd: '${workspaceFolder}',
  __configurationTarget: 6
}
Resolved debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'demo',
  program: '${workspaceFolder}/build/demo',
  args: [],
  cwd: '${workspaceFolder}',
  __configurationTarget: 6,
  relativePathBase: '/Users/ym/me/cxx/demo',
  _adapterSettings: {
    displayFormat: 'auto',
    showDisassembly: 'auto',
    dereferencePointers: true,
    suppressMissingSourceFiles: true,
    evaluationTimeout: 5,
    consoleMode: 'commands',
    sourceLanguages: null,
    terminalPromptClear: null,
    evaluateForHovers: true,
    commandCompletions: true,
    reproducer: false
  }
}
liblldb: /Users/ym/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/lldb/lib/liblldb.dylib
environment: {}
settings: { evaluateForHovers: true, commandCompletions: true }
[DEBUG codelldb] Connecting to 127.0.0.1:54284
[DEBUG codelldb] New debug session
[DEBUG codelldb::dap_codec] --> {"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"lldb","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"zh-cn","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true},"type":"request","seq":1}
[DEBUG codelldb::dap_codec] <-- {"seq":1,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"exceptionBreakpointFilters":[{"default":true,"filter":"cpp_throw","label":"C++: on throw","supportsCondition":true},{"default":false,"filter":"cpp_catch","label":"C++: on catch","supportsCondition":true}],"supportTerminateDebuggee":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionFilterOptions":true,"supportsExceptionInfoRequest":true,"supportsFunctionBreakpoints":true,"supportsGotoTargetsRequest":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsReadMemoryRequest":true,"supportsSetVariable":true,"supportsSteppingGranularity":true,"supportsWriteMemoryRequest":true}}
[DEBUG codelldb::dap_codec] --> {"command":"launch","arguments":{"type":"lldb","request":"launch","name":"demo","program":"/Users/ym/me/cxx/demo/build/demo","args":[],"cwd":"/Users/ym/me/cxx/demo","__configurationTarget":6,"relativePathBase":"/Users/ym/me/cxx/demo","_adapterSettings":{"displayFormat":"auto","showDisassembly":"auto","dereferencePointers":true,"suppressMissingSourceFiles":true,"evaluationTimeout":5,"consoleMode":"commands","sourceLanguages":null,"terminalPromptClear":null,"evaluateForHovers":true,"commandCompletions":true,"reproducer":false},"__sessionId":"791f3d28-d2ab-4485-aea1-74f172475c3c"},"type":"request","seq":2}
[DEBUG codelldb::dap_codec] <-- {"seq":2,"type":"event","event":"output","body":{"category":"console","output":"Console is in 'commands' mode, prefix expressions with '?'.\n"}}
INFO(Python) 12:25:50 formatters: Initializing
INFO(Python) 12:25:50 formatters.rust: Initializing
[DEBUG codelldb::dap_codec] <-- {"seq":3,"type":"event","event":"initialized"}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9a2e478 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000002 (modules-loaded), data = {demo}
[DEBUG codelldb::dap_codec] <-- {"seq":4,"type":"event","event":"module","body":{"module":{"addressRange":"FFFFFFFFFFFFFFFF","id":"FFFFFFFFFFFFFFFF","name":"demo","path":"/Users/ym/me/cxx/demo/build/demo","symbolFilePath":"/Users/ym/me/cxx/demo/build/demo","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] <-- {"seq":5,"type":"request","command":"runInTerminal","arguments":{"args":["/Users/ym/.vscode/extensions/vadimcn.vscode-lldb-1.10.0/adapter/codelldb","terminal-agent","--connect=54288"],"cwd":"","kind":"integrated","title":"demo"}}
[DEBUG codelldb::dap_codec] --> {"command":"setBreakpoints","arguments":{"source":{"name":"main.cpp","path":"/Users/ym/me/cxx/demo/main.cpp"},"lines":[4],"breakpoints":[{"line":4}],"sourceModified":false},"type":"request","seq":3}
[DEBUG codelldb::dap_codec] --> {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
[DEBUG codelldb::dap_codec] --> {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
[DEBUG codelldb::dap_codec] --> {"command":"setInstructionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":6}
[DEBUG codelldb::dap_codec] --> {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[]},"type":"request","seq":7}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9a43b18 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: breakpoint added}
[DEBUG codelldb::dap_codec] <-- {"seq":6,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"line":4,"message":"Resolved locations: 0","verified":true}]}}
[DEBUG codelldb::dap_codec] <-- {"seq":7,"type":"response","request_seq":4,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] <-- {"seq":8,"type":"response","request_seq":5,"success":true,"command":"setDataBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] <-- {"seq":9,"type":"response","request_seq":6,"success":true,"command":"setInstructionBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] <-- {"seq":10,"type":"response","request_seq":7,"success":true,"command":"setExceptionBreakpoints"}
[DEBUG codelldb::dap_codec] --> {"type":"response","seq":8,"command":"runInTerminal","request_seq":5,"success":true,"body":{"shellProcessId":25255}}
[DEBUG codelldb::dap_codec] --> {"command":"configurationDone","type":"request","seq":9}
[DEBUG codelldb::dap_codec] <-- {"seq":11,"type":"event","event":"output","body":{"category":"console","output":"Launching: /Users/ym/me/cxx/demo/build/demo\n"}}
[DEBUG codelldb::dap_codec] <-- {"seq":12,"type":"event","event":"output","body":{"category":"console","output":"Launched process 25383\n"}}
[DEBUG codelldb::dap_codec] <-- {"seq":13,"type":"response","request_seq":2,"success":true,"command":"launch"}
[DEBUG codelldb::debug_session] Debug event: 0x7f81cdb09768 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000004 (modules-unloaded), data = {demo}
[DEBUG codelldb::dap_codec] <-- {"seq":14,"type":"response","request_seq":9,"success":true,"command":"configurationDone"}
[DEBUG codelldb::dap_codec] <-- {"seq":15,"type":"event","event":"module","body":{"module":{"id":"100000000","name":""},"reason":"removed"}}
[DEBUG codelldb::debug_session] Debug event: 0x7f81cdb09868 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: locations removed}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c98d3b88 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: locations resolved}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9f8fd58 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000002 (modules-loaded), data = {dyld, demo}
[DEBUG codelldb::dap_codec] <-- {"seq":16,"type":"event","event":"breakpoint","body":{"breakpoint":{"id":1,"line":4,"message":"Resolved locations: 1","verified":true},"reason":"changed"}}
[DEBUG codelldb::dap_codec] <-- {"seq":17,"type":"event","event":"module","body":{"module":{"addressRange":"10000C000","id":"10000C000","name":"dyld","path":"/usr/lib/dyld","symbolFilePath":"/usr/lib/dyld","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9a45fd0 Event: broadcaster = 0x7f81ca1d0038 (lldb.process), type = 0x00000001 (state-changed), data = { process = 0x7f81ca1d0000 (pid = 25383), state = running}
[DEBUG codelldb::dap_codec] <-- {"seq":18,"type":"event","event":"module","body":{"module":{"addressRange":"100000000","id":"100000000","name":"demo","path":"/Users/ym/me/cxx/demo/build/demo","symbolFilePath":"/Users/ym/me/cxx/demo/build/demo","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] <-- {"seq":19,"type":"event","event":"continued","body":{"allThreadsContinued":true,"threadId":235698}}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c98e39c8 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000004 (modules-unloaded), data = {demo}
[DEBUG codelldb::dap_codec] <-- {"seq":20,"type":"event","event":"module","body":{"module":{"id":"FFFFFFFFFFFFFFFF","name":""},"reason":"removed"}}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9f46858 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: locations removed}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9e08528 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: locations resolved}
[DEBUG codelldb::dap_codec] <-- {"seq":21,"type":"event","event":"breakpoint","body":{"breakpoint":{"id":1,"line":4,"message":"Resolved locations: 1","verified":true},"reason":"changed"}}
[DEBUG codelldb::debug_session] Debug event: 0x7f81cdb13c28 Event: broadcaster = 0x7f81cd091620 (lldb.target), type = 0x00000002 (modules-loaded), data = {dyld, demo}
[DEBUG codelldb::dap_codec] <-- {"seq":22,"type":"event","event":"module","body":{"module":{"addressRange":"7FF811AEF000","id":"7FF811AEF000","name":"dyld","path":"/usr/lib/dyld","symbolFilePath":"/usr/lib/dyld","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] <-- {"seq":23,"type":"event","event":"module","body":{"module":{"addressRange":"100000000","id":"100000000","name":"demo","path":"/Users/ym/me/cxx/demo/build/demo","symbolFilePath":"/Users/ym/me/cxx/demo/build/demo","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] --> {"command":"threads","type":"request","seq":10}
[DEBUG codelldb::dap_codec] <-- {"seq":24,"type":"response","request_seq":10,"success":true,"command":"threads","body":{"threads":[{"id":235698,"name":"1: tid=235698"}]}}
[DEBUG codelldb::debug_session] Debug event: 0x7f81c9a46070 Event: broadcaster = 0x7f81ca1d0038 (lldb.process), type = 0x00000001 (state-changed), data = { process = 0x7f81ca1d0000 (pid = 25383), state = exited}
[DEBUG codelldb::dap_codec] <-- {"seq":25,"type":"event","event":"output","body":{"category":"console","output":"Process exited with code -1.\n"}}
[DEBUG codelldb::dap_codec] <-- {"seq":26,"type":"event","event":"exited","body":{"exitCode":-1}}
[DEBUG codelldb::dap_codec] <-- {"seq":27,"type":"event","event":"terminated","body":{}}
[DEBUG codelldb::dap_codec] --> {"command":"disconnect","arguments":{"restart":false,"terminateDebuggee":false},"type":"request","seq":11}
[DEBUG codelldb::dap_codec] <-- {"seq":28,"type":"response","request_seq":11,"success":true,"command":"disconnect"}
[DEBUG codelldb::dap_session] Client has disconnected
[DEBUG codelldb::debug_session] End of the requests stream
[DEBUG codelldb::debug_session] DebugSession::drop()
[DEBUG codelldb] End of the debug session
[DEBUG codelldb] Exiting
Debug adapter exit code=0 (0x0), signal=null.
vadimcn commented 8 months ago

Duplicate of #999 I think.

yanggeorge commented 8 months ago

@vadimcn thanks.