We have some corefiles which are intended to debug a standalone binary, and have an LC_NOTE mach-o load command with the UUID and/or address of that binary. If the search for that binary fails for any reason, we don't load the intended binary. ProcessMachCore then falls back to doing an exhaustive scan of the corefile memory pages looking for a darwin kernel or a userland dyld binary. And the case where this comes up most often, there is a darwin kernel. lldb starts doing a darwin kernel debug session and that's not at all what the user is intending to do.
This patch changes ProcessMachCore::LoadBinariesViaMetadata to return if any metadata record was found, even if we didn't find the binary, and ProcessMachCore::LoadBinariesAndSetDYLD will only start an exhaustive search if we had no metadata.
Since LoadBinariesViaMetadata can fail and we now care about the return value, what do you think about the name TryLoadBinariesViaMetadata? I think a name that indicates that it may fail to actually load would make it easier to read at a glance.