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 hanging without error messages when lldb is not installed #1040

Closed oliverhu closed 6 months ago

oliverhu commented 7 months ago

OS: Ubuntu 22.04 VSCode version: 1.85.0 CodeLLDB version: 1.10.0 Compiler: rustc Debuggee: rust binary

CodeLLDB worked well the first time I installed it, however, later I somehow messed up a bit with the conda environment and CodeLLDB started to hang when I start debugging. There was no error message and I could find any useful debug info (there is no error in OUTPUT or DEBUG CONSOLE inside vscode).

Later I ran

❯ lldb --version
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'lldb'

And realized something might be wrong with lldb and installed lldb manually with conda and it went back to normal. I think we need some checks to make sure lldb functions in codelldb.

oliverhu commented 7 months ago

For some reason it worked for a bit and it is hanging again now.. :(

oliverhu commented 7 months ago

Log

Initial debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: "Debug executable 'run'",
  cargo: {
    args: [ 'build', '--bin=run', '--package=llama2' ],
    filter: { name: 'run', kind: 'bin' }
  },
  args: [],
  cwd: '${workspaceFolder}',
  __configurationTarget: 6
}
Raw artifacts:
{
  fileName: '/home/pi/llama2.rs/target/debug/run',
  name: 'run',
  kind: 'bin'
}
Filtered artifacts: 
{
  fileName: '/home/pi/llama2.rs/target/debug/run',
  name: 'run',
  kind: 'bin'
}
Resolved debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: "Debug executable 'run'",
  args: [],
  cwd: '${workspaceFolder}',
  __configurationTarget: 6,
  terminal: 'external',
  relativePathBase: '/home/pi/llama2.rs',
  program: '/home/pi/llama2.rs/target/debug/run',
  sourceLanguages: [ 'rust' ],
  _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/pi/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/lldb/lib/liblldb.so
environment: {}
settings: {
  evaluateForHovers: true,
  commandCompletions: true,
  sourceLanguages: [ 'rust' ]
}
[DEBUG codelldb] Connecting to 127.0.0.1:33073
[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":"rust_panic","label":"Rust: on panic","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":"Debug executable 'run'","args":[],"cwd":"/home/pi/llama2.rs","__configurationTarget":6,"terminal":"external","relativePathBase":"/home/pi/llama2.rs","program":"/home/pi/llama2.rs/target/debug/run","sourceLanguages":["rust"],"_adapterSettings":{"displayFormat":"auto","showDisassembly":"auto","dereferencePointers":true,"suppressMissingSourceFiles":true,"evaluationTimeout":5,"consoleMode":"commands","sourceLanguages":null,"terminalPromptClear":null,"evaluateForHovers":true,"commandCompletions":true,"reproducer":false},"__sessionId":"22ecdcf1-fdee-4740-875d-0b50e66ab471"},"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) 20:35:03 formatters: Initializing
INFO(Python) 20:35:03 formatters.rust: Initializing
[DEBUG codelldb::dap_codec] <-- {"seq":3,"type":"event","event":"initialized"}
[DEBUG codelldb::debug_session] Debug event: 0x5594195f0838 Event: broadcaster = 0x55941a82fbb0 (lldb.target), type = 0x00000002 (modules-loaded), data = {run}
[DEBUG codelldb::dap_codec] <-- {"seq":4,"type":"event","event":"module","body":{"module":{"addressRange":"FFFFFFFFFFFFFFFF","id":"FFFFFFFFFFFFFFFF","name":"run","path":"/home/pi/llama2.rs/target/debug/run","symbolFilePath":"/home/pi/llama2.rs/target/debug/run","symbolStatus":"Symbols loaded."},"reason":"new"}}
[DEBUG codelldb::dap_codec] <-- {"seq":5,"type":"request","command":"runInTerminal","arguments":{"args":["/home/pi/.vscode-server/extensions/vadimcn.vscode-lldb-1.10.0/adapter/codelldb","terminal-agent","--connect=42137"],"cwd":"","kind":"external","title":"Debug executable 'run'"}}
[DEBUG codelldb::dap_codec] --> {"command":"setBreakpoints","arguments":{"source":{"name":"run.rs","path":"/home/pi/llama2.rs/run.rs"},"lines":[464],"breakpoints":[{"line":464}],"sourceModified":false},"type":"request","seq":3}
[DEBUG codelldb::dap_codec] <-- {"seq":6,"type":"response","request_seq":3,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"line":464,"message":"Resolved locations: 0","verified":true}]}}
[DEBUG codelldb::debug_session] Debug event: 0x55941a744028 Event: broadcaster = 0x55941a82fbb0 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 1 type: breakpoint added}
[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":[{"filterId":"rust_panic"}]},"type":"request","seq":7}
[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::debug_session] Debug event: 0x55941a744028 Event: broadcaster = 0x55941a82fbb0 (lldb.target), type = 0x00000001 (breakpoint-changed), data = {bkpt: 2 type: breakpoint added}
[DEBUG codelldb::dap_codec] --> {"type":"response","seq":8,"command":"runInTerminal","request_seq":5,"success":false,"message":"spawn xterm ENOENT"}
[ERROR codelldb::terminal] [61] spawn xterm ENOENT
[DEBUG codelldb::dap_codec] --> {"command":"configurationDone","type":"request","seq":9}
oliverhu commented 7 months ago

Ah, spawn xterm ENOENT tells the problem

Screenshot 2023-12-09 at 8 40 28 PM

Changed to integrated worked. Not sure why it was defaulted to empty