[PATCH] D145618: [Debuginfod] Prune cache after fetch.

Daniel Thornburgh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 14:33:13 PST 2023


mysterymath created this revision.
mysterymath added a reviewer: gulfem.
Herald added a subscriber: hiraditya.
Herald added a project: All.
mysterymath requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Previously, the size of the debuginfod cache would grow without bound.
This change prunes the cache after a successful debuginfod lookup, as is
done in libdebuginfod.

The cache pruning behavior is configured by a new
DEBUGINFOD_CACHE_POLICY environment variable. The semantics of this are
the same as --thinlto_cache_policy.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145618

Files:
  llvm/lib/Debuginfod/Debuginfod.cpp


Index: llvm/lib/Debuginfod/Debuginfod.cpp
===================================================================
--- llvm/lib/Debuginfod/Debuginfod.cpp
+++ llvm/lib/Debuginfod/Debuginfod.cpp
@@ -263,6 +263,12 @@
     if (Code && Code != 200)
       continue;
 
+    Expected<CachePruningPolicy> PruningPolicyOrErr =
+        parseCachePruningPolicy(std::getenv("DEBUGINFOD_CACHE_POLICY"));
+    if (!PruningPolicyOrErr)
+      return PruningPolicyOrErr.takeError();
+    pruneCache(CacheDirectoryPath, *PruningPolicyOrErr);
+
     // Return the path to the artifact on disk.
     return std::string(AbsCachedArtifactPath);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145618.503526.patch
Type: text/x-patch
Size: 625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230308/b731ccd8/attachment.bin>


More information about the llvm-commits mailing list