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

Could not load liblldb.dll (err=0x0000007E) when trying to run Rust EXE #1032

Open loop-evgeny opened 7 months ago

loop-evgeny commented 7 months ago

OS: Windows 7 x64 VSCode version: 1.70.2 CodeLLDB version: 1.10.0 Compiler: rustc 1.73.0 Debuggee: Windows x64, simplest possible "HelloWorld" EXE with PDB (but fails even without debugging)

When I try to run a trivial "Hello world" Rust program from VS Code, whether with or without debugging, it fails with the error below.

Verbose log
Initial debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug',
  program: '${workspaceFolder}/main.exe',
  args: [],
  cwd: '${workspaceFolder}',
  __configurationTarget: 6,
  noDebug: true
}
Resolved debug configuration: {
  type: 'lldb',
  request: 'launch',
  name: 'Debug',
  program: '${workspaceFolder}/main.exe',
  args: [],
  cwd: '${workspaceFolder}',
  __configurationTarget: 6,
  noDebug: true,
  relativePathBase: 'e:\\Source\\RustBook\\HelloWorld',
  _adapterSettings: {
    displayFormat: 'auto',
    showDisassembly: 'auto',
    dereferencePointers: true,
    suppressMissingSourceFiles: true,
    evaluationTimeout: 5,
    consoleMode: 'commands',
    sourceLanguages: null,
    terminalPromptClear: null,
    evaluateForHovers: true,
    commandCompletions: true,
    reproducer: false
  }
}
liblldb: USER_DIR\.vscode\extensions\vadimcn.vscode-lldb-1.10.0\lldb\bin\liblldb.dll
environment: {}
settings: { evaluateForHovers: true, commandCompletions: true }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Could not load \"USER_DIR\\\\.vscode\\\\extensions\\\\vadimcn.vscode-lldb-1.10.0\\\\lldb\\\\bin\\\\liblldb.dll\" (err=0x0000007E)"', adapter\codelldb\bin/main.rs:57:57
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Debug adapter exit code=101 (0x65), signal=null.

I have checked the Troubleshooting page and set lldb.verboseLogging=true before generating the log above.

jcaselman-keysight commented 4 months ago

liblldb.dll needs the microsoft Visual C++ Redistributable for Visual Studio 2015, this error went away for me after installing it

loop-evgeny commented 4 months ago

Thanks, but that did not fix it for me. I still get the same error.

jcaselman-keysight commented 4 months ago

@loop-evgeny you may be able to troubleshoot further by analyzing the liblldb.dll from your error "USER_DIR\\\\.vscode\\\\extensions\\\\vadimcn.vscode-lldb-1.10.0\\\\lldb\\\\bin\\\\liblldb.dll\with the latest release of https://github.com/lucasg/Dependencies

This is how I identified the missing Microsoft Redistributable in my environment. Good luck :slightly_smiling_face:

loop-evgeny commented 4 months ago

Thanks! The problem turned out to be that api-ms-win-core-path-l1-1-0.dll, referenced by python39.dll, is missing, because I'm on Windows 7. I was able to work around that using https://github.com/nalexandru/api-ms-win-core-path-HACK, but damn, that's quite a confusing error!

Unfortunately, even with that workaround, my breakpoints are not hit and I do not see stdout output in the VS Code Terminal - no idea why. So I still cannot really use VS Code to run Rust programs, let alone debug them.