[Lldb-commits] [PATCH] D65171: [LLDB] Find debugserver in Command Line Tools as well

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 23 16:08:22 PDT 2019


aadsm created this revision.
aadsm added reviewers: clayborg, JDevlieghere.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This might be an edge case in regular use but if you're shipping an lldb version with no debugserver lldb will try to use the System one.
However, lldb only knows how to find the Xcode one and not the Command Line Tools one. This diff fixes that.

We try to find debugserver with `PlatformDarwin::LocateExecutable("debugserver")`, we call `xcode-select -p` to get the path and then assume this path is of Xcode.

The changes I did are:

- Change `PlatformDarwin::LocateExecutable` to also add the Command Line Tools directory to the list of paths to search for debugserver.
- Created a new function to find the Command Line Tools directory named `GetCommandLineToolsLibraryPath`.
- Refactored the code that calls `xcode-select -p` into its own function `GetXcodeSelectPath()`. There were 2 identical pieces of code for this so I reduced it to one and used this function everywhere instead.
- I also changed `PlatformDarwin::GetSDKDirectoryForModules` to use the `SDKs` directory that exists in the Command Line Tools installation.

I'm not sure how to create tests for this. PlatformDarwinTest is really limited and I couldn't find how to mock Filesystem::Instance() so I could create a virtual file system.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65171

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65171.211372.patch
Type: text/x-patch
Size: 6735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190723/4291d531/attachment.bin>


More information about the lldb-commits mailing list