[Lldb-commits] [lldb] [LLDB][OSX] Add a fallback support exe directory (PR #103458)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 13 14:49:55 PDT 2024


================
@@ -144,16 +150,22 @@ static void ParseOSVersion(llvm::VersionTuple &version, NSString *Key) {
 #endif
   } else {
     // Find the bin path relative to the lib path where the cmake-based
-    // OS X .dylib lives.  This is not going to work if the bin and lib
-    // dir are not both in the same dir.
+    // OS X .dylib lives. We try looking first at a possible sibling `bin`
+    // directory, and then at the `lib` directory itself.
     //
-    // It is not going to work to do it by the executable path either,
+    // It is not going to work to do it by the executable path,
     // as in the case of a python script, the executable is python, not
     // the lldb driver.
+    FileSpec support_dir_spec_lib(raw_path);
     raw_path.append("/../bin");
-    FileSpec support_dir_spec(raw_path);
-    FileSystem::Instance().Resolve(support_dir_spec);
-    if (!FileSystem::Instance().IsDirectory(support_dir_spec)) {
+    FileSpec support_dir_spec_bin(raw_path);
+    FileSpec support_dir_spec;
----------------
JDevlieghere wrote:

You can simplify this slightly without modifying `raw_path`:
```
FileSpec support_dir_spec_lib(raw_path);
FileSpec support_dir_spec_bin = support_dir_spec_lib.CopyByAppendingPathComponent("/../bin");
FileSpec support_dir_spec;
```

https://github.com/llvm/llvm-project/pull/103458


More information about the lldb-commits mailing list