[Lldb-commits] [lldb] [lldb] Add caching and _NT_SYMBOL_PATH parsing in SymbolLocatorSymStore (PR #191782)
Stefan Gränitz via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 17 07:32:43 PDT 2026
================
@@ -223,16 +301,82 @@ std::optional<FileSpec> FindFileInLocalSymStore(llvm::StringRef root_dir,
return spec;
}
-std::optional<FileSpec> LocateSymStoreEntry(llvm::StringRef base_url,
+std::optional<FileSpec> MoveToLocalSymStore(llvm::StringRef cache,
llvm::StringRef key,
- llvm::StringRef pdb_name) {
- if (base_url.starts_with("http://") || base_url.starts_with("https://"))
- return RequestFileFromSymStoreServerHTTP(base_url, key, pdb_name);
+ llvm::StringRef pdb_name,
+ FileSpec tmp_file) {
+ // Caches have SymStore directory structure: cache/pdb_name/key/pdb_name
+ llvm::SmallString<256> dest_dir;
+ llvm::sys::path::append(dest_dir, cache, pdb_name, key);
+ if (std::error_code ec = llvm::sys::fs::create_directories(dest_dir)) {
+ Debugger::ReportWarning(
+ llvm::formatv("failed to create SymStore cache directory '{0}': {1}",
+ dest_dir, ec.message()));
+ return tmp_file;
+ }
+
+ llvm::SmallString<256> dest;
+ llvm::sys::path::append(dest, dest_dir, pdb_name);
+ std::error_code ec = llvm::sys::fs::rename(tmp_file.GetPath(), dest);
- if (base_url.starts_with("file://"))
- base_url = base_url.drop_front(7);
+ // Fall back to copy+delete if we move to a different volume.
+ if (ec == std::errc::cross_device_link) {
+ ec = llvm::sys::fs::copy_file(tmp_file.GetPath(), dest);
+ if (!ec)
+ llvm::sys::fs::remove(tmp_file.GetPath());
+ }
+ if (ec) {
+ Debugger::ReportWarning(
+ llvm::formatv("failed to move '{0}' to SymStore cache '{1}': {2}",
+ tmp_file.GetPath(), dest, ec.message()));
+ return tmp_file;
+ }
- return FindFileInLocalSymStore(base_url, key, pdb_name);
+ return FileSpec(dest.str());
+}
+
+std::optional<FileSpec>
+LocateSymStoreEntry(const SymbolLocatorSymStore::LookupEntry &entry,
+ llvm::StringRef key, llvm::StringRef pdb_name) {
+ Log *log = GetLog(LLDBLog::Symbols);
+ std::string default_cache = GetGlobalPluginProperties().GetCachePath();
----------------
weliveindetail wrote:
Thanks, done in a61203782cef
https://github.com/llvm/llvm-project/pull/191782
More information about the lldb-commits
mailing list