Debuginfod.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/Debuginfod/Debuginfod.h - Debuginfod client --------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. ///
  14. /// \file
  15. /// This file contains the declarations of getCachedOrDownloadArtifact and
  16. /// several convenience functions for specific artifact types:
  17. /// getCachedOrDownloadSource, getCachedOrDownloadExecutable, and
  18. /// getCachedOrDownloadDebuginfo. This file also declares
  19. /// getDefaultDebuginfodUrls and getDefaultDebuginfodCacheDirectory.
  20. ///
  21. ///
  22. //===----------------------------------------------------------------------===//
  23. #ifndef LLVM_DEBUGINFOD_DEBUGINFOD_H
  24. #define LLVM_DEBUGINFOD_DEBUGINFOD_H
  25. #include "llvm/ADT/StringRef.h"
  26. #include "llvm/Support/Error.h"
  27. #include "llvm/Support/MemoryBuffer.h"
  28. #include <chrono>
  29. namespace llvm {
  30. typedef ArrayRef<uint8_t> BuildIDRef;
  31. typedef SmallVector<uint8_t, 10> BuildID;
  32. /// Finds default array of Debuginfod server URLs by checking DEBUGINFOD_URLS
  33. /// environment variable.
  34. Expected<SmallVector<StringRef>> getDefaultDebuginfodUrls();
  35. /// Finds a default local file caching directory for the debuginfod client,
  36. /// first checking DEBUGINFOD_CACHE_PATH.
  37. Expected<std::string> getDefaultDebuginfodCacheDirectory();
  38. /// Finds a default timeout for debuginfod HTTP requests. Checks
  39. /// DEBUGINFOD_TIMEOUT environment variable, default is 90 seconds (90000 ms).
  40. std::chrono::milliseconds getDefaultDebuginfodTimeout();
  41. /// Fetches a specified source file by searching the default local cache
  42. /// directory and server URLs.
  43. Expected<std::string> getCachedOrDownloadSource(BuildIDRef ID,
  44. StringRef SourceFilePath);
  45. /// Fetches an executable by searching the default local cache directory and
  46. /// server URLs.
  47. Expected<std::string> getCachedOrDownloadExecutable(BuildIDRef ID);
  48. /// Fetches a debug binary by searching the default local cache directory and
  49. /// server URLs.
  50. Expected<std::string> getCachedOrDownloadDebuginfo(BuildIDRef ID);
  51. /// Fetches any debuginfod artifact using the default local cache directory and
  52. /// server URLs.
  53. Expected<std::string> getCachedOrDownloadArtifact(StringRef UniqueKey,
  54. StringRef UrlPath);
  55. /// Fetches any debuginfod artifact using the specified local cache directory,
  56. /// server URLs, and request timeout (in milliseconds). If the artifact is
  57. /// found, uses the UniqueKey for the local cache file.
  58. Expected<std::string> getCachedOrDownloadArtifact(
  59. StringRef UniqueKey, StringRef UrlPath, StringRef CacheDirectoryPath,
  60. ArrayRef<StringRef> DebuginfodUrls, std::chrono::milliseconds Timeout);
  61. } // end namespace llvm
  62. #endif
  63. #ifdef __GNUC__
  64. #pragma GCC diagnostic pop
  65. #endif