Skip to content

Debuginfod cache use index cache settings and include real file name #120814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 11, 2025

Conversation

GeorgeHuyubo
Copy link
Contributor

This PR include two changes:

  1. Change debuginfod cache file name to include origin file name, the new file name would be something like:
    llvmcache-13267c5f5d2e3df472c133c8efa45fb3331ef1ea-liblzma.so.5.2.2.debuginfo.dwp
    So it will provide more information in image list instead of a plain llvmcache-123
  2. Switch debuginfod cache to use lldb index cache settings. Currently we don't have proper settings for setting the cache path or the cache expiration time for debuginfod cache. We want to use the lldb index cache settings, as they make sense to be in the same place and have the same TTL.

@llvmbot
Copy link
Member

llvmbot commented Dec 21, 2024

@llvm/pr-subscribers-lldb

@llvm/pr-subscribers-debuginfo

Author: None (GeorgeHuyubo)

Changes

This PR include two changes:

  1. Change debuginfod cache file name to include origin file name, the new file name would be something like:
    llvmcache-13267c5f5d2e3df472c133c8efa45fb3331ef1ea-liblzma.so.5.2.2.debuginfo.dwp
    So it will provide more information in image list instead of a plain llvmcache-123
  2. Switch debuginfod cache to use lldb index cache settings. Currently we don't have proper settings for setting the cache path or the cache expiration time for debuginfod cache. We want to use the lldb index cache settings, as they make sense to be in the same place and have the same TTL.

Full diff: https://github.com/llvm/llvm-project/pull/120814.diff

4 Files Affected:

  • (modified) lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp (+34-7)
  • (modified) llvm/include/llvm/Debuginfod/Debuginfod.h (+3-1)
  • (modified) llvm/lib/Debuginfod/Debuginfod.cpp (+20-9)
  • (modified) llvm/unittests/Debuginfod/DebuginfodTests.cpp (+2-1)
diff --git a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
index 2cd7bbbb244902..f459825a61a562 100644
--- a/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
+++ b/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp
@@ -8,6 +8,7 @@
 
 #include "SymbolLocatorDebuginfod.h"
 
+#include "lldb/Core/DataFileCache.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Utility/Args.h"
@@ -141,6 +142,25 @@ SymbolLocator *SymbolLocatorDebuginfod::CreateInstance() {
   return new SymbolLocatorDebuginfod();
 }
 
+static llvm::StringRef getFileName(const ModuleSpec &module_spec,
+                                   std::string url_path) {
+  // Check if the URL path requests an executable file or a symbol file
+  bool is_executable = url_path.find("debuginfo") == std::string::npos;
+  if (is_executable) {
+    return module_spec.GetFileSpec().GetFilename().GetStringRef();
+  }
+  llvm::StringRef symbol_file =
+      module_spec.GetSymbolFileSpec().GetFilename().GetStringRef();
+  // Remove llvmcache- prefix and hash, keep origin file name
+  if (symbol_file.starts_with("llvmcache-")) {
+    size_t pos = symbol_file.rfind('-');
+    if (pos != llvm::StringRef::npos) {
+      symbol_file = symbol_file.substr(pos + 1);
+    }
+  }
+  return symbol_file;
+}
+
 static std::optional<FileSpec>
 GetFileForModule(const ModuleSpec &module_spec,
                  std::function<std::string(llvm::object::BuildID)> UrlBuilder) {
@@ -154,11 +174,14 @@ GetFileForModule(const ModuleSpec &module_spec,
   // Grab LLDB's Debuginfod overrides from the
   // plugin.symbol-locator.debuginfod.* settings.
   PluginProperties &plugin_props = GetGlobalPluginProperties();
-  llvm::Expected<std::string> cache_path_or_err = plugin_props.GetCachePath();
-  // A cache location is *required*.
-  if (!cache_path_or_err)
-    return {};
-  std::string cache_path = *cache_path_or_err;
+  // Grab the lldb index cache settings from the global module list properties.
+  ModuleListProperties &properties =
+      ModuleList::GetGlobalModuleListProperties();
+  std::string cache_path = properties.GetLLDBIndexCachePath().GetPath();
+
+  llvm::CachePruningPolicy pruning_policy =
+      DataFileCache::GetLLDBIndexCachePolicy();
+
   llvm::SmallVector<llvm::StringRef> debuginfod_urls =
       llvm::getDefaultDebuginfodUrls();
   std::chrono::milliseconds timeout = plugin_props.GetTimeout();
@@ -166,9 +189,13 @@ GetFileForModule(const ModuleSpec &module_spec,
   // We're ready to ask the Debuginfod library to find our file.
   llvm::object::BuildID build_id(module_uuid.GetBytes());
   std::string url_path = UrlBuilder(build_id);
-  std::string cache_key = llvm::getDebuginfodCacheKey(url_path);
+  llvm::StringRef file_name = getFileName(module_spec, url_path);
+  std::string cache_file_name = llvm::toHex(build_id, true);
+  if (!file_name.empty()) {
+    cache_file_name += "-" + file_name.str();
+  }
   llvm::Expected<std::string> result = llvm::getCachedOrDownloadArtifact(
-      cache_key, url_path, cache_path, debuginfod_urls, timeout);
+      cache_file_name, url_path, cache_path, debuginfod_urls, timeout, pruning_policy);
   if (result)
     return FileSpec(*result);
 
diff --git a/llvm/include/llvm/Debuginfod/Debuginfod.h b/llvm/include/llvm/Debuginfod/Debuginfod.h
index 99fe15ad859794..aebcf31cd48227 100644
--- a/llvm/include/llvm/Debuginfod/Debuginfod.h
+++ b/llvm/include/llvm/Debuginfod/Debuginfod.h
@@ -25,6 +25,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Object/BuildID.h"
+#include "llvm/Support/CachePruning.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Mutex.h"
@@ -95,7 +96,8 @@ Expected<std::string> getCachedOrDownloadArtifact(StringRef UniqueKey,
 /// found, uses the UniqueKey for the local cache file.
 Expected<std::string> getCachedOrDownloadArtifact(
     StringRef UniqueKey, StringRef UrlPath, StringRef CacheDirectoryPath,
-    ArrayRef<StringRef> DebuginfodUrls, std::chrono::milliseconds Timeout);
+    ArrayRef<StringRef> DebuginfodUrls, std::chrono::milliseconds Timeout,
+    llvm::CachePruningPolicy policy);
 
 class ThreadPoolInterface;
 
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 4c785117ae8ef7..17efaea892c669 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -106,6 +106,14 @@ Expected<std::string> getDefaultDebuginfodCacheDirectory() {
   return std::string(CacheDirectory);
 }
 
+Expected<llvm::CachePruningPolicy> getDefaultDebuginfodCachePruningPolicy() {
+  Expected<CachePruningPolicy> PruningPolicyOrErr =
+      parseCachePruningPolicy(std::getenv("DEBUGINFOD_CACHE_POLICY"));
+  if (!PruningPolicyOrErr)
+    return PruningPolicyOrErr.takeError();
+  return *PruningPolicyOrErr;
+}
+
 std::chrono::milliseconds getDefaultDebuginfodTimeout() {
   long Timeout;
   const char *DebuginfodTimeoutEnv = std::getenv("DEBUGINFOD_TIMEOUT");
@@ -169,9 +177,15 @@ Expected<std::string> getCachedOrDownloadArtifact(StringRef UniqueKey,
     return CacheDirOrErr.takeError();
   CacheDir = *CacheDirOrErr;
 
-  return getCachedOrDownloadArtifact(UniqueKey, UrlPath, CacheDir,
-                                     getDefaultDebuginfodUrls(),
-                                     getDefaultDebuginfodTimeout());
+  Expected<llvm::CachePruningPolicy> PruningPolicyOrErr =
+      getDefaultDebuginfodCachePruningPolicy();
+  if (!PruningPolicyOrErr)
+    return PruningPolicyOrErr.takeError();
+  llvm::CachePruningPolicy PruningPolicy = *PruningPolicyOrErr;
+
+  return getCachedOrDownloadArtifact(
+      UniqueKey, UrlPath, CacheDir, getDefaultDebuginfodUrls(),
+      getDefaultDebuginfodTimeout(), PruningPolicy);
 }
 
 namespace {
@@ -250,7 +264,8 @@ static SmallVector<std::string, 0> getHeaders() {
 
 Expected<std::string> getCachedOrDownloadArtifact(
     StringRef UniqueKey, StringRef UrlPath, StringRef CacheDirectoryPath,
-    ArrayRef<StringRef> DebuginfodUrls, std::chrono::milliseconds Timeout) {
+    ArrayRef<StringRef> DebuginfodUrls, std::chrono::milliseconds Timeout,
+    llvm::CachePruningPolicy policy) {
   SmallString<64> AbsCachedArtifactPath;
   sys::path::append(AbsCachedArtifactPath, CacheDirectoryPath,
                     "llvmcache-" + UniqueKey);
@@ -304,11 +319,7 @@ Expected<std::string> getCachedOrDownloadArtifact(
         continue;
     }
 
-    Expected<CachePruningPolicy> PruningPolicyOrErr =
-        parseCachePruningPolicy(std::getenv("DEBUGINFOD_CACHE_POLICY"));
-    if (!PruningPolicyOrErr)
-      return PruningPolicyOrErr.takeError();
-    pruneCache(CacheDirectoryPath, *PruningPolicyOrErr);
+    pruneCache(CacheDirectoryPath, policy);
 
     // Return the path to the artifact on disk.
     return std::string(AbsCachedArtifactPath);
diff --git a/llvm/unittests/Debuginfod/DebuginfodTests.cpp b/llvm/unittests/Debuginfod/DebuginfodTests.cpp
index 5312912599e933..8dacf2ae5b3f8a 100644
--- a/llvm/unittests/Debuginfod/DebuginfodTests.cpp
+++ b/llvm/unittests/Debuginfod/DebuginfodTests.cpp
@@ -37,6 +37,7 @@ TEST(DebuginfodClient, CacheHit) {
   sys::fs::createTemporaryFile("llvmcache-key", "temp", FD, CachedFilePath);
   StringRef CacheDir = sys::path::parent_path(CachedFilePath);
   StringRef UniqueKey = sys::path::filename(CachedFilePath);
+  llvm::CachePruningPolicy policy;
   EXPECT_TRUE(UniqueKey.consume_front("llvmcache-"));
   raw_fd_ostream OF(FD, true, /*unbuffered=*/true);
   OF << "contents\n";
@@ -44,7 +45,7 @@ TEST(DebuginfodClient, CacheHit) {
   OF.close();
   Expected<std::string> PathOrErr = getCachedOrDownloadArtifact(
       UniqueKey, /*UrlPath=*/"/null", CacheDir,
-      /*DebuginfodUrls=*/{}, /*Timeout=*/std::chrono::milliseconds(1));
+      /*DebuginfodUrls=*/{}, /*Timeout=*/std::chrono::milliseconds(1), policy);
   EXPECT_THAT_EXPECTED(PathOrErr, HasValue(CachedFilePath));
 }
 

@GeorgeHuyubo GeorgeHuyubo marked this pull request as draft December 21, 2024 01:54
Copy link

github-actions bot commented Dec 21, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@GeorgeHuyubo GeorgeHuyubo marked this pull request as ready for review December 21, 2024 07:02
@GeorgeHuyubo GeorgeHuyubo changed the title Debuginfod cache use index cache settings and include real file name. Debuginfod cache use index cache settings and include real file name Jan 10, 2025
Copy link
Collaborator

@clayborg clayborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fix removing {} from single line if statements.

@GeorgeHuyubo GeorgeHuyubo merged commit 9b528ed into llvm:main Jan 11, 2025
5 of 7 checks passed
@mgorny
Copy link
Member

mgorny commented Jan 11, 2025

This is causing test failures for me:

FAIL: LLVM :: tools/llvm-debuginfod-find/cache.test (51115 of 57035)
******************** TEST 'LLVM :: tools/llvm-debuginfod-find/cache.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 4: rm -rf /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/*
+ rm -rf '/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/*'
RUN: at line 5: mkdir -p /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/012345678901234{5,6}
+ mkdir -p /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/0123456789012345 /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/0123456789012346
RUN: at line 6: echo 'f' > /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/0123456789012345/debuginfo
+ echo f
RUN: at line 7: cp /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/012345678901234{5,6}/debuginfo
+ cp /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/0123456789012345/debuginfo /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/buildid/0123456789012346/debuginfo
RUN: at line 8: mkdir /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache
+ mkdir /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache
RUN: at line 9: env DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp    /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012345 > /dev/null
+ env DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012345
RUN: at line 11: ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache | /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/FileCheck --check-prefix=FIRST --match-full-lines --implicit-check-not {{.}} /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm/test/tools/llvm-debuginfod-find/cache.test
+ ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache
+ /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/FileCheck --check-prefix=FIRST --match-full-lines --implicit-check-not '{{.}}' /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm/test/tools/llvm-debuginfod-find/cache.test
RUN: at line 14: env DEBUGINFOD_CACHE_POLICY=prune_interval=0s:cache_size_files=1      DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp      /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012346 > /dev/null
+ env DEBUGINFOD_CACHE_POLICY=prune_interval=0s:cache_size_files=1 DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012346
RUN: at line 17: ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache | /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/FileCheck --check-prefix=SECOND --match-full-lines --implicit-check-not {{.}} /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm/test/tools/llvm-debuginfod-find/cache.test
+ ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache
+ /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/FileCheck --check-prefix=SECOND --match-full-lines --implicit-check-not '{{.}}' /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm/test/tools/llvm-debuginfod-find/cache.test
RUN: at line 20: env DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp      /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012345 > /dev/null
+ env DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012345
RUN: at line 22: ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache | /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/FileCheck --check-prefix=BOTH --match-full-lines --implicit-check-not {{.}} /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm/test/tools/llvm-debuginfod-find/cache.test
+ ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache
+ /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/FileCheck --check-prefix=BOTH --match-full-lines --implicit-check-not '{{.}}' /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm/test/tools/llvm-debuginfod-find/cache.test
RUN: at line 25: env DEBUGINFOD_CACHE_POLICY=invalid:prune_interval=0s:cache_size_files=1      DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp      /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012346 > /dev/null
+ env DEBUGINFOD_CACHE_POLICY=invalid:prune_interval=0s:cache_size_files=1 DEBUGINFOD_CACHE_PATH=/var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache DEBUGINFOD_URLS=file:///var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/bin/llvm-debuginfod-find --debuginfo 0123456789012346
Build ID 0123456789012346 could not be found.

--

********************

@mgorny
Copy link
Member

mgorny commented Jan 11, 2025

$ ls /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache
llvmcache-10192351353398627645  llvmcache-10846399329613630737  llvmcache.timestamp
$ head /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/*
==> /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/llvmcache-10192351353398627645 <==
f

==> /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/llvmcache-10846399329613630737 <==
f

==> /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/llvmcache.timestamp <==
$ stat /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/*
  File: /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/llvmcache-10192351353398627645
  Size: 2               Blocks: 8          IO Block: 4096   regular file
Device: 252,16  Inode: 3431460     Links: 1
Access: (0600/-rw-------)  Uid: (  250/ portage)   Gid: (  250/ portage)
Access: 2025-01-11 13:29:27.579719000 +0000
Modify: 2025-01-11 13:29:27.579719000 +0000
Change: 2025-01-11 13:29:27.579719000 +0000
 Birth: 2025-01-11 13:29:27.579719000 +0000
  File: /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/llvmcache-10846399329613630737
  Size: 2               Blocks: 8          IO Block: 4096   regular file
Device: 252,16  Inode: 3431507     Links: 1
Access: (0600/-rw-------)  Uid: (  250/ portage)   Gid: (  250/ portage)
Access: 2025-01-11 13:29:27.619719290 +0000
Modify: 2025-01-11 13:29:27.619719290 +0000
Change: 2025-01-11 13:29:27.619719290 +0000
 Birth: 2025-01-11 13:29:27.619719290 +0000
  File: /var/tmp/portage/llvm-core/llvm-20.0.0.9999/work/llvm_build-abi_x86_64.amd64/test/tools/llvm-debuginfod-find/Output/cache.test.tmp/cache/llvmcache.timestamp
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: 252,16  Inode: 3431423     Links: 1
Access: (0644/-rw-r--r--)  Uid: (  250/ portage)   Gid: (  250/ portage)
Access: 2025-01-11 13:29:27.539718711 +0000
Modify: 2025-01-11 13:29:27.579719000 +0000
Change: 2025-01-11 13:29:27.579719000 +0000
 Birth: 2025-01-11 13:29:27.539718711 +0000

BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
…lvm#120814)

This PR include two changes:
1. Change debuginfod cache file name to include origin file name, the
new file name would be something like:

llvmcache-13267c5f5d2e3df472c133c8efa45fb3331ef1ea-liblzma.so.5.2.2.debuginfo.dwp
So it will provide more information in image list instead of a plain
llvmcache-123
2. Switch debuginfod cache to use lldb index cache settings. Currently
we don't have proper settings for setting the cache path or the cache
expiration time for debuginfod cache. We want to use the lldb index
cache settings, as they make sense to be in the same place and have the
same TTL.

---------

Co-authored-by: George Hu <[email protected]>
@labath
Copy link
Collaborator

labath commented Jan 13, 2025

Same here, and the lldb debuginfod test is failing as well:

======================================================================
FAIL: test_debuginfod_executable (TestDebuginfod.DebugInfodTests.test_debuginfod_executable)
   Test behavior with the full binary available from Debuginfod as
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/debuginfod/Normal/TestDebuginfod.py", line 61, in test_debuginfod_executable
    self.try_breakpoint(True)
  File "lldb/test/API/debuginfod/Normal/TestDebuginfod.py", line 92, in try_breakpoint
    self.assertEqual(
AssertionError: True != False : Loc line entry is valid
======================================================================
FAIL: test_debuginfod_okd_symbols (TestDebuginfod.DebugInfodTests.test_debuginfod_okd_symbols)
   Test behavior with the 'only-keep-debug' symbols available from Debuginfod.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/debuginfod/Normal/TestDebuginfod.py", line 70, in test_debuginfod_okd_symbols
    self.try_breakpoint(True)
  File "lldb/test/API/debuginfod/Normal/TestDebuginfod.py", line 92, in try_breakpoint
    self.assertEqual(
AssertionError: True != False : Loc line entry is valid
======================================================================
FAIL: test_debuginfod_symbols (TestDebuginfod.DebugInfodTests.test_debuginfod_symbols)
   Test behavior with the full binary available from Debuginfod as
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/debuginfod/Normal/TestDebuginfod.py", line 51, in test_debuginfod_symbols
    self.try_breakpoint(True)
  File "lldb/test/API/debuginfod/Normal/TestDebuginfod.py", line 92, in try_breakpoint
    self.assertEqual(
AssertionError: True != False : Loc line entry is valid

@GeorgeHuyubo
Copy link
Contributor Author

Working on fixing the tests broke by this diff.

@Prabhuk
Copy link
Contributor

Prabhuk commented Jan 13, 2025

@GeorgeHuyubo I am part of the Fuchsia toolchain team and we are seeing the same tools/llvm-debuginfod-find/cache.test test failure in our toolchain builders as well. Logs: https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8726076614943013857/+/u/clang/tests/stdout

@GeorgeHuyubo
Copy link
Contributor Author

PR to revert the problematic commit: #122816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants