[DebugInfod] Prefix debuginfod cache directory
authorPetr Hosek <phosek@google.com>
Wed, 19 Jan 2022 18:08:17 +0000 (10:08 -0800)
committerPetr Hosek <phosek@google.com>
Wed, 19 Jan 2022 18:09:00 +0000 (10:09 -0800)
This prevents the debuginfod client from dumping files directly into the
default cache directory (e.g., ~/.cache). Instead, these files are
placed in a subdirectory (e.g., ~/.cache/llvm-debuginfod/client).
Behavior is unaffected if the cache directory is provided by the
DEBUGINFO_CACHE_PATH environment variable.

Patch By: mysterymath

Differential Revision: https://reviews.llvm.org/D117619

llvm/lib/Debuginfod/Debuginfod.cpp

index 48d0e4d..debee6e 100644 (file)
@@ -52,6 +52,7 @@ Expected<std::string> getDefaultDebuginfodCacheDirectory() {
   if (!sys::path::cache_directory(CacheDirectory))
     return createStringError(
         errc::io_error, "Unable to determine appropriate cache directory.");
+  sys::path::append(CacheDirectory, "llvm-debuginfod", "client");
   return std::string(CacheDirectory);
 }