[lldb][macOS] Index shared cache files by UUID & filename (#180874)
The shared cache index only had accessors for getting a file from a
shared cache by filename. In some environments like iOS Simulator, a
filename can be either the actual realpath name of the framework in an
SDK or simulator runtime install location, or rooted on / like
/System/LibraryFrameworks/SwiftUI.framework. Because the searches for
binaries were by filename, this divergence would be a problem. However,
searching for binaries by the binary's UUID can remove that ambiguity.
I changed HostInfoMacOSX's store of SharedCacheImageInfo's to have a
std::vector of all of the SharedCacheImageInfo's in a shared cache. Then
I create a mapping of filename-to-SharedCacheImageInfo* and a mapping of
UUID-to-SharedCacheImageInfo*, both pointing into the now-frozen
std::vector. I added a HostInfo::GetSharedCacheImageInfo method to fetch
an entry by shared-cache UUID + file UUID, in addition to the previous
shared-cache UUID + filename.
Have HostInfoMacOSX store the filenames it gets from the libdyld SPI in
ConstStrings to make it clear that they have infinite lifetime in the
process, and we don't need to do anything further.
rdar://148939795
---------
Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>