I was looking at
lldb-server recently and noticed that the target side debugger stub,
lldb-server is a whopping 261 MB after stripping (it weighs in at 1.6 GB with debug info). This is a stark contrast to the relatively svelte
lldb-server from llvm.org which is ~8 MB after stripping.
What you may ask is the cause for the ~32x size increase? It seems that there were changes to the LLDB fork in Swift which pull in a large portion of the LLVM demangler and the Swift compiler on the server side. These will obviously be needed on the client side to be able to reflect the binary metadata and to evaluate the expressions. However, they should not be needed on the server side.
I tried to track down some of the cause of the bloat, with minimal luck. I did find a way to trim about 1 MB (~10%) on the upstream binary, and have a few patches that I will be trying to get through into the LLVM tree which should help reduce the
lldb-server size there, but, that will be largely eclipsed by the rest of the things being dragged into the server in the Swift port. One of the largest contributors to the size here is
ValueObject which causes the preservation of
CompilerInstance (which in turn pulls in
Mangled (which in turn pulls in
This really makes debugging on smaller targets (e.g. android) unnecessarily painful. Unfortunately, I don't see a good way to extricate the additional methods being added to the types in the Swift fork.