Windows VSCode debug problems

When I debug a simple hello world application, I am unable to see variable contents.
I get: "Unable to determine byte size." when I hover and local/global areas are empty.
I did find this note: Swift · vadimcn/codelldb Wiki · GitHub, but I was not able to reconfigure the alternate lldb backend.
I am using Swift 6.0.2, VS Code 1.95.3, CodeLLDB 1.11.1, and Swift 1.11.3
Any ideas on how to proceed?

Jesper, did you try these steps?

If you're having trouble debugging with CodeLLDB, Swift toolchains as of Swift 6.0 ship with the lldb-dap binary which you can use as an alternative to the CodeLLDB extension. To use this in VS Code set the setting "swift.debugger.useDebugAdapterFromToolchain": true in your VS Code user settings.json.

Starting with Swift 6, lldb-dap is the recommended tool for debugging from Visual Studio Code (and other tools that support the Debug Adapter Protocol). As @plemarquand pointed out, we started shipping it in the toolchain so it automatically picks up the correct LLDB with Swift support.

For now the Swift plugin still supports both CodeLLDB (for older toolchains) and lldb-dap but the goal is to support only the latter moving forward, and have the Swift extension depend on the LLDB-DAP extension. It's not that there's anything wrong with CodeLLDB, but lldb-dap is part of the LLVM Project and so that means we have control over the DAP implementation (the lldb-dap binary) as well as the corresponding VSCode extension (LLDB-DAP in the marketplace).

I enabled "Use the LLDB debug adapter packaged with the Swift toolchain..." and also "additional Swift diagnostics".
When I do that, I am unable to launch the (very basic) "Hello World" application. I don't see any diagnostics.
If I uncheck the "Use the LLDB..." checkbox, then I can launch and step (but not see variable contents).
This is on my Windows 10 machine

Some common pitfalls I've discovered so far:

  • make sure the codelldb extension's settings are pointing to lldb.dll from the downloaded toolchain
  • make sure that python39.dll is in PATH
  • make sure the binary is linked with lld and not link.exe (link.exe seems to truncate the DWARF section names)
  • make sure VCToolsInstallDir points to your MSVC tools dir