================
@@ -141,6 +145,24 @@ std::optional<FileSpec> 
SymbolLocatorDefault::LocateExecutableSymbolFile(
       FileSystem::Instance().Resolve(file_spec);
       debug_file_search_paths.AppendIfUnique(file_spec);
     }
+#if defined(__FreeBSD__)
+    // Add $LOCALBASE/lib/debug directory, where
+    // LOCALBASE is usually /usr/local, but may be adjusted by the end user
+    {
+      int mib[2];
+      char buf[PATH_MAX];
+      size_t len = PATH_MAX;
+
+      mib[0] = CTL_USER;
+      mib[1] = USER_LOCALBASE;
+      if (::sysctl(mib, 2, buf, &len, NULL, 0) == 0) {
+        std::string localbase(buf);
+        FileSpec file_spec(localbase + "/lib/debug");
----------------
JDevlieghere wrote:

The string concatenation is fine, though you could achieve the same with 
`PrependPathComponent` and save the allocation in `std::string`. 

```
FileSpec file_spec("/lib/debug");
file_spec.PrependPathComponent(StringRef(buf));
```

https://github.com/llvm/llvm-project/pull/81355
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to