This started out with one small idea I had and then got a bit of PatchCreep while I was digging into a subsystem I haven't touched in a year or two. The patch is all isolated to darwin kernel debugging, it doesn't modify anything outside of that. The things I changed here:
- When looking on the local filesystem for a kernel binary + dSYM pair, if that fails, look through any dSYMs that we saw alone without a binary, and load those as a binary+dSYM pair all by itself. It's not ideal, but it will mostly work.
- Remove the 'platform.plugin.darwin-kernel.search-locally-for-kexts' setting. I originally added this setting when I first added the local filesystem scan for kexts/kernels, fearing that people would ask for a way to disable it. No one has ever asked. I thought of making the setting a no-op and documenting it as obsoleted, but eventually it'll have to be removed and someone will get an error in their .lldbinit file if they're still using it. Might as well make that now.
- Change plugin.dynamic-loader.darwin-kernel.load-kexts so that it doesn't disable local kernel binary scanning. It was a nonobvious interaction, I see kernel developers trip over this occasionally.
- Split up PlatformDarwinKernel::GetSharedModule into GetSharedModuleKext and GetSharedModuleKernel. This method was unnecessarily large and the blocks of code had no interaction with each other; splitting it out makes it easier to read and modify.
- I keep track of possible kernel .dSYM.yaa (a file archive format) files that I come across during the scan, but I'm only reporting it in the statistics for now, I don't think I want to pay the cost of expanding these to see if they're a match.
Nit: You could assign the StringRef to a temporary so you don't have to repeat file_spec.GetFilename().GetStringRef() thrice.