[lldb] Fetching symbols in the background with dsymForUUID
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 16 Aug 2022 00:37:34 +0000 (17:37 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 16 Aug 2022 00:57:24 +0000 (17:57 -0700)
commit11f45f36dcf54b0fe8e54ce5e410e24f3b9b5a1e
tree35488c204c618316c63d6a351e914015a0e0075d
parent8d36a82d0a3d118329b9f24b33e58d0a28360891
[lldb] Fetching symbols in the background with dsymForUUID

On macOS, LLDB uses the DebugSymbols.framework to locate symbol rich
dSYM bundles. [1] The framework uses a variety of methods, one of them
calling into a binary or shell script to locate (and download) dSYMs.
Internally at Apple, that tool is called dsymForUUID and for simplicity
I'm just going to refer to it that way here too, even though it can be
be an arbitrary executable.

The most common use case for dsymForUUID is to fetch symbols from the
network. This can take a long time, and because the calls to the
DebugSymbols.framework are blocking, it takes a while to launch the
process. This is expected and therefore many people don't use this
functionality, but instead use add-dsym when they want symbols for a
given frame, backtrace or module. This is a little faster because you're
only fetching symbols for the module you care about, but it's still a
slow, blocking operation.

This patch introduces a hybrid approach between the two. When
symbols.enable-background-lookup is enabled, lldb will do the equivalent
of add-dsym in the background for every module that shows up in the
backtrace but doesn't have symbols for. From the user's perspective
there is no slowdown, because the process launches immediately, with
whatever symbols are available. Meanwhile, more symbol information is
added over time as the background fetching completes.

[1] https://lldb.llvm.org/use/symbols.html

rdar://76241471

Differential revision: https://reviews.llvm.org/D131328
12 files changed:
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Core/DebuggerEvents.h
lldb/include/lldb/Core/ModuleList.h
lldb/include/lldb/Symbol/LocateSymbolFile.h
lldb/include/lldb/Target/Target.h
lldb/source/Core/CoreProperties.td
lldb/source/Core/Debugger.cpp
lldb/source/Core/DebuggerEvents.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Symbol/LocateSymbolFile.cpp
lldb/source/Symbol/LocateSymbolFileMacOSX.cpp