[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 25 10:00:04 PST 2024


labath wrote:

> > The patch is still a bit larger than I'd like. I've tried to highlight a few things that could be split off into separate PRs, but I think the biggest question now (not really for you, but for lldb-dap maintainers) is whether this could be using the socket abstractions already present in lldb (instead of building your own). If the answer to that is "yes", then switching to those should probably be a separate patch as well.
> 
> I can split this into smaller patches.

Thanks.

> 
> As far as the socket abstraction, at the moment lldb-dap doesn't use much (if anything) from lldb outside of the API folder. I saw the `lldb/Host/Socket.h` files but they also are built on top of the `IOObject` and interact with the `MainLoop` which would mean taking on a few new dependencies from the Host folder. 

I am aware of that, but I don't think that situation is sustainable in the long run. When lldb-dap was first added, I believe it only supported talking over stdio, so it had like ~zero amount of socket code, and so this kind of purist approach did not hurt (much). However, its getting quite complex now, and I think copying/reimplementing every abstraction it needs is going to come back and bite us.

FWIW, the MainLoop class is self-contained, and might actually be useful if you wanted to support things like listening on IPv4 and v6 sockets simultaneously. And IOObject is just a abstract base, so it also doesn't shouldn't pull in much. We're also making sure (it took a lot of effort to reach that point) that the Host library as a whole does not depend on the rest of lldb.


https://github.com/llvm/llvm-project/pull/116392


More information about the lldb-commits mailing list