vadimcn / codelldb

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

Remote debugging: No such file or directory #963

Closed tgeorg-ethz closed 1 year ago

tgeorg-ethz commented 1 year ago

OS: Ubuntu 20.04.5 LTS VSCode version: 1.79.2 CodeLLDB version: v1.9.2 Compiler: Rust Debuggee: aarch64-linux-gnu

I'm currently trying to debug an application that is supposed run as root. As vscode run from user mode (to my knowledge) does not offer a way to attach to a binary run as root, I'm doing this by spawning an lldb-server as root (sudo lldb-server platform --server --listen localhost:7777) and then attaching to that server.

So to recap I'm trying to attach to an lldb-server running on the same machine

I'm using the following config based on the one described here

        {
            "name": "Remote launch",
            "request": "launch",
            "type": "lldb",
            "program": "${workspaceFolder}/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga", // Local path.
            "initCommands": [
                "platform select remote-linux",
                "platform connect connect://localhost:7777",
            ],
        }

However when launching the debug session in vscode I get

image

Unfortunately I get no information what the file is that wasn't found. I'm certain that the path to the binary is correct as changing that gives me an entirely different error telling me that the binary wasn't found.

Attaching to the lldb-server via lldb from the command line does work just fine:

$ lldb
(lldb) platform select remote-linux
  Platform: remote-linux
 Connected: no
(lldb) platform connect connect://localhost:7777
  Platform: remote-linux
    Triple: aarch64-unknown-linux-gnu
OS Version: 5.4.0 (5.4.0-131-generic)
    Kernel: #147-Ubuntu SMP Fri Oct 14 17:09:03 UTC 2022
  Hostname: zuestoll07
 Connected: yes
WorkingDir: /scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga
(lldb) file /scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga
Current executable set to '/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga' (aarch64).
(lldb) run
Process 10265 launched: '/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga' (aarch64)
...
Verbose log
Initial debug configuration: {
  name: 'Remote launch',
  request: 'launch',
  type: 'lldb',
  program: '${workspaceFolder}/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga',
  sourceMap: { '/': '${workspaceFolder}/10f10m_sync/syncN/timely-on-fpga' },
  initCommands: [
    'platform select remote-linux',
    'platform connect connect://localhost:7777'
  ],
  __configurationTarget: 6
}
Resolved debug configuration: {
  name: 'Remote launch',
  request: 'launch',
  type: 'lldb',
  program: '${workspaceFolder}/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga',
  sourceMap: { '/': '${workspaceFolder}/10f10m_sync/syncN/timely-on-fpga' },
  initCommands: [
    'platform select remote-linux',
    'platform connect connect://localhost:7777'
  ],
  __configurationTarget: 6,
  relativePathBase: '/scratch/tgeorg/2022-bsc-nstern-report',
  _adapterSettings: {
    displayFormat: 'auto',
    showDisassembly: 'auto',
    dereferencePointers: true,
    suppressMissingSourceFiles: true,
    evaluationTimeout: 5,
    consoleMode: 'commands',
    sourceLanguages: null,
    terminalPromptClear: null,
    evaluateForHovers: true,
    commandCompletions: true,
    reproducer: false
  }
}
liblldb: /home/enzian/.vscode-server/extensions/vadimcn.vscode-lldb-1.9.2/lldb/lib/liblldb.so
environment: {}
settings: { evaluateForHovers: true, commandCompletions: true }
[DEBUG codelldb] Connecting to 127.0.0.1:42909
[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":"en","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":{"name":"Remote launch","request":"launch","type":"lldb","program":"/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga","sourceMap":{"/":"/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga"},"initCommands":["platform select remote-linux","platform connect connect://localhost:7777"],"__configurationTarget":6,"relativePathBase":"/scratch/tgeorg/2022-bsc-nstern-report","_adapterSettings":{"displayFormat":"auto","showDisassembly":"auto","dereferencePointers":true,"suppressMissingSourceFiles":true,"evaluationTimeout":5,"consoleMode":"commands","sourceLanguages":null,"terminalPromptClear":null,"evaluateForHovers":true,"commandCompletions":true,"reproducer":false},"__sessionId":"f6be8e54-3d7a-4b4f-9acc-f2856d393544"},"type":"request","seq":2}
[INFO  codelldb::debug_session::launch] Set target.source-map args: "/" "/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga" 
[DEBUG codelldb::dap_codec] <-- {"seq":2,"type":"event","event":"output","body":{"category":"console","output":"Console is in 'commands' mode, prefix expressions with '?'.\n"}}
[DEBUG codelldb::dap_codec] <-- {"seq":3,"type":"event","event":"output","body":{"category":"console","output":"Executing script: initCommands\n"}}
[DEBUG codelldb::debug_session] platform select remote-linux -> SuccessFinishResult, Error:  Success
    Output Message:
      Platform: remote-linux
     Connected: no

[DEBUG codelldb::dap_codec] <-- {"seq":4,"type":"event","event":"output","body":{"category":"console","output":"  Platform: remote-linux\n Connected: no\n\n"}}
[DEBUG codelldb::debug_session] platform connect connect://localhost:7777 -> SuccessFinishResult, Error:  Success
    Output Message:
      Platform: remote-linux
        Triple: aarch64-unknown-linux-gnu
    OS Version: 5.4.0 (5.4.0-131-generic)
      Hostname: zuestoll07
     Connected: yes
    WorkingDir: /scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga
        Kernel: #147-Ubuntu SMP Fri Oct 14 17:09:03 UTC 2022

[DEBUG codelldb::dap_codec] <-- {"seq":5,"type":"event","event":"output","body":{"category":"console","output":"  Platform: remote-linux\n    Triple: aarch64-unknown-linux-gnu\nOS Version: 5.4.0 (5.4.0-131-generic)\n  Hostname: zuestoll07\n Connected: yes\nWorkingDir: /scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga\n    Kernel: #147-Ubuntu SMP Fri Oct 14 17:09:03 UTC 2022\n\n"}}
INFO(Python) 19:28:32 formatters: Initializing
INFO(Python) 19:28:32 formatters.rust: Initializing
[DEBUG codelldb::dap_codec] <-- {"seq":6,"type":"event","event":"initialized"}
[DEBUG codelldb::debug_session] Debug event: 0xaaaaeea933e8 Event: broadcaster = 0xaaaaeef53570 (lldb.target), type = 0x00000002 (modules-loaded), data = {hello_fpga}
[DEBUG codelldb::dap_codec] <-- {"seq":7,"type":"event","event":"module","body":{"module":{"addressRange":"FFFFFFFFFFFFFFFF","id":"FFFFFFFFFFFFFFFF","name":"hello_fpga","path":"/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga","symbolFilePath":"/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] --> {"command":"setBreakpoints","arguments":{"source":{"name":"execute.rs","path":"/scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/timely/src/execute.rs"},"lines":[],"breakpoints":[],"sourceModified":false},"type":"request","seq":3}
[DEBUG codelldb::dap_codec] <-- {"seq":8,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] --> {"command":"setFunctionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":4}
[DEBUG codelldb::dap_codec] <-- {"seq":9,"type":"response","request_seq":4,"success":true,"command":"setFunctionBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] --> {"command":"setDataBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":5}
[DEBUG codelldb::dap_codec] <-- {"seq":10,"type":"response","request_seq":5,"success":true,"command":"setDataBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] --> {"command":"setInstructionBreakpoints","arguments":{"breakpoints":[]},"type":"request","seq":6}
[DEBUG codelldb::dap_codec] <-- {"seq":11,"type":"response","request_seq":6,"success":true,"command":"setInstructionBreakpoints","body":{"breakpoints":[]}}
[DEBUG codelldb::dap_codec] --> {"command":"setExceptionBreakpoints","arguments":{"filters":[],"filterOptions":[{"filterId":"cpp_throw"}]},"type":"request","seq":7}
[DEBUG codelldb::dap_codec] <-- {"seq":12,"type":"response","request_seq":7,"success":true,"command":"setExceptionBreakpoints"}
[DEBUG codelldb::debug_session] Debug event: 0xaaaaeea933e8 Event: broadcaster = 0xaaaaeef53570 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: breakpoint added}
[DEBUG codelldb::dap_codec] --> {"command":"configurationDone","type":"request","seq":8}
[DEBUG codelldb::dap_codec] <-- {"seq":13,"type":"event","event":"output","body":{"category":"console","output":"Launching: /scratch/tgeorg/2022-bsc-nstern-report/10f10m_sync/syncN/timely-on-fpga/target/debug/examples/hello_fpga\n"}}
[ERROR codelldb::debug_session] No such file or directory
[DEBUG codelldb::dap_codec] <-- {"seq":14,"type":"response","request_seq":2,"success":false,"command":"","message":"No such file or directory","show_user":true}
[DEBUG codelldb::dap_codec] <-- {"seq":15,"type":"response","request_seq":8,"success":true,"command":"configurationDone"}
[DEBUG codelldb::dap_codec] --> {"command":"disconnect","arguments":{"restart":false},"type":"request","seq":9}
[DEBUG codelldb::dap_codec] <-- {"seq":16,"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.

If there's any further information I can provide, please let me know <3