This is an archive of the discontinued LLVM Phabricator instance.

[lldb/PlatformMacOSX] Re-implement GetDeveloperDirectory
ClosedPublic

Authored by JDevlieghere on Mar 27 2020, 10:09 AM.

Details

Summary

GetDeveloperDirectory returns a const char* which is NULL when we cannot find the developer directory. This crashes in PlatformDarwinKernel::CollectKextAndKernelDirectories because we're unconditionally assigning it to a std::string. Coincidentally I just refactored a bunch of code in PlatformMacOSX so instead of a ad-hoc fix I've reimplemented the method based on GetXcodeContentsDirectory.

The change is mostly NFC. Obviously it fixes the crash, but it also removes support for finding the Xcode directory through he legacy $XCODE_SELECT_PREFIX_DIR/usr/share/xcode-select/xcode_dir_path.

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 27 2020, 10:09 AM
jasonmolenda accepted this revision.Mar 27 2020, 12:22 PM

Yea, this looks good, I don't think any of those other search methods were valid any longer.

This revision is now accepted and ready to land.Mar 27 2020, 12:22 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2020, 12:37 PM