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

Unable to debug after connecting to macOS via "Remote - SSH" #1079

Open MistEO opened 3 months ago

MistEO commented 3 months ago

environment

Local: Windows 11 x86_64 Server: macOS 14.3.1 Arm64 VSCode version: 1.87.1 VSCode Remote - SSH version: v0.109.0 CodeLLDB version: v1.10.0 Compiler: Homebrew clang version 17.0.6 Debuggee: C++ binary

my problem

I have a mac mini that I use as a server, and after I connect it via the Remote-SSH on my local PC, I can't debug my code.

_FE1WQ~QL012PNSA0K9C8}9

my attempts

  1. sudo DevToolsSecurity -enable

    image

    still not work, and the error message has not changed.

  2. Directly debug locally on mac

    When I started debugging for the first time, a dialog popped up asking me to enter a password

    `PA (6A7V(@F@UHK(FE~W4W

    then, everything works fine.

    image

  3. debug on Linux via Remote-SSH ( a Linux server, and I use Windows 11 VSCode Remote-SSH to connect to it)

    everything works fine.

    image

my guess

It is worth noting that when I was debugging locally on my mac, a dialog box popped up asking me to enter my password. When I debug remotely through Remote-SSH, as the error message says "this is a non-interactive debug session", maybe it is the inability to pop up this dialog box that causes the error?

verbose log

Verbose log
Initial debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'MaaPiCli - Debug',
  program: '${workspaceFolder}/build/bin/Debug/MaaPiCli',
  args: [],
  cwd: '${workspaceFolder}',
  preLaunchTask: 'build_picli',
  __configurationTarget: 6
}
Resolved debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'MaaPiCli - Debug',
  program: '${workspaceFolder}/build/bin/Debug/MaaPiCli',
  args: [],
  cwd: '${workspaceFolder}',
  preLaunchTask: 'build_picli',
  __configurationTarget: 6,
  relativePathBase: '/Users/mreo/code/MaaFramework',
  _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/mreo/.vscode-server/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:50992
[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":"MaaPiCli - Debug","program":"/Users/mreo/code/MaaFramework/build/bin/Debug/MaaPiCli","args":[],"cwd":"/Users/mreo/code/MaaFramework","preLaunchTask":"build_picli","__configurationTarget":6,"relativePathBase":"/Users/mreo/code/MaaFramework","_adapterSettings":{"displayFormat":"auto","showDisassembly":"auto","dereferencePointers":true,"suppressMissingSourceFiles":true,"evaluationTimeout":5,"consoleMode":"commands","sourceLanguages":null,"terminalPromptClear":null,"evaluateForHovers":true,"commandCompletions":true,"reproducer":false},"__sessionId":"8930354f-e71c-47ad-b3b1-156d50b54164"},"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) 16:16:50 formatters: Initializing
INFO(Python) 16:16:50 formatters.rust: Initializing
[DEBUG codelldb::dap_codec] <-- {"seq":3,"type":"event","event":"initialized"}
[DEBUG codelldb::debug_session] Debug event: 0x600000bd82d8 Event: broadcaster = 0x12fa685f8 (lldb.target), type = 0x00000002 (modules-loaded), data = {MaaPiCli}
[DEBUG codelldb::dap_codec] <-- {"seq":4,"type":"event","event":"module","body":{"module":{"addressRange":"FFFFFFFFFFFFFFFF","id":"FFFFFFFFFFFFFFFF","name":"MaaPiCli","path":"/Users/mreo/code/MaaFramework/build/bin/Debug/MaaPiCli","symbolFilePath":"/Users/mreo/code/MaaFramework/build/bin/Debug/MaaPiCli","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] <-- {"seq":5,"type":"request","command":"runInTerminal","arguments":{"args":["/Users/mreo/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/adapter/codelldb","terminal-agent","--connect=50994"],"cwd":"","kind":"integrated","title":"MaaPiCli - Debug"}}
[DEBUG codelldb::dap_codec] --> {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":3}
[DEBUG codelldb::dap_codec] --> {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
[DEBUG codelldb::dap_codec] --> {"command":"setInstructionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
[DEBUG codelldb::dap_codec] <-- {"seq":6,"type":"response","request_seq":3,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] <-- {"seq":7,"type":"response","request_seq":4,"success":true,"command":"setDataBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] <-- {"seq":8,"type":"response","request_seq":5,"success":true,"command":"setInstructionBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] --> {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[{"filterId":"cpp_throw"}]},"type":"request","seq":6}
[DEBUG codelldb::dap_codec] <-- {"seq":9,"type":"response","request_seq":6,"success":true,"command":"setExceptionBreakpoints"}
[DEBUG codelldb::debug_session] Debug event: 0x600000bd8358 Event: broadcaster = 0x12fa685f8 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: breakpoint added}
[DEBUG codelldb::dap_codec] --> {"command":"configurationDone","type":"request","seq":7}
[DEBUG codelldb::dap_codec] --> {"type":"response","seq":8,"command":"runInTerminal","request_seq":5,"success":true,"body":{"shellProcessId":10407}}
[DEBUG codelldb::dap_codec] <-- {"seq":10,"type":"event","event":"output","body":{"category":"console","output":"Launching: /Users/mreo/code/MaaFramework/build/bin/Debug/MaaPiCli\n"}}
[ERROR codelldb::debug_session] process exited with status -1 (this is a non-interactive debug session, cannot get permission to debug processes.)
[DEBUG codelldb::dap_codec] <-- {"seq":11,"type":"response","request_seq":2,"success":false,"command":"","message":"process exited with status -1 (this is a non-interactive debug session, cannot get permission to debug processes.)","show_user":true}
[DEBUG codelldb::dap_codec] <-- {"seq":12,"type":"response","request_seq":7,"success":true,"command":"configurationDone"}
[DEBUG codelldb::dap_codec] --> {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":9}
[DEBUG codelldb::dap_codec] <-- {"seq":13,"type":"response","request_seq":9,"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.

DavidMSCode commented 1 month ago

I had the same problem in #1045. The problem is that the debugserver shipped with codelldb requires authentication despite the user being in the _developer group. To fix follow the workaround in #456 and delete the debugserver in the extensions folder. BUT, make sure it's the extensions folder for vscode-server not the vscode client on the mac. See #1045 for more details.