[Pitch] Include lldb-dap in Swift toolchain

I would like to propose that lldb-dap (The LLDB debug adapter from the llvm-project) be included in the Swift toolchain. It is currently included in the Swift Windows toolchain but not in the Linux and macOS versions.

Motivation

This is to provide first party support for debugging in the Visual Studio Code Swift extension and any other third party editor that supports the debug adapter protocol (includes neovim and emacs).

Currently for debugging we are reliant on a third party extension called CodeLLDB (GitHub - vadimcn/codelldb: A native debugger extension for VSCode based on LLDB) to provide support. This was developed to debug rust and C/C++, but we can use it for swift (after some setup). It is written in rust and the author of this extension has no real involvement with the swift community.

Including lldb-dap from the llvm-project in the swift toolchain would allow us to remove our CodeLLDB dependency. We can also be sure that the version of lldb and the debugger adaptor correspond as they come from the same release of the swift toolchain.

The VSCode swift extension already integrates with lldb-dap and this integration is being used extensively on Windows. It would be good if we could supply this for macOS and Linux as well.

This change is additive and does not affect anything else in the toolchain.

Context

You can find out more about the debug adapter protocol here. Official page for Debug Adapter Protocol

14 Likes

Definitely in favour of this. There were places where the divergence between CodeLLDB and Swift triggered actual issues. The LLDB DAP has been pretty stable and working well as an alternative at The Browser Company.

5 Likes

+1 to this - it would be good to use a version of LLDB that has closer ties to Swift and anything that aligns platforms is always a good thing

1 Like

Thanks for bringing this up Adam! Seems like the community is supportive of this idea so I'll go ahead and make the change to include it in the toolchain.

EDIT: Because your post was more recent than this change I thought I had to do something extra, but I just checked and it's already there in the nightly toolchain.

1 Like

That’s great Jonas. I’ll go check the latest nightly.

Hi @JDevlieghere

I downloaded the swift-lang/swift:nightly-jammy docker image from the 29th Feb and I can't find the lldb-dap executable in it.

I worked out why I wasn't seeing lldb-dap in the nightlies. I have been looking at the Linux distributions. I have added a PR to include lldb-dap in the Linux distribution

3 Likes