DIFetcher.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/DebugInfo/Symbolize/DIFetcher.h --------------------*- 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 declares a DIFetcher abstraction for obtaining debug info from an
  16. /// arbitrary outside source.
  17. ///
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_DEBUGINFO_SYMBOLIZE_DIFETCHER_H
  20. #define LLVM_DEBUGINFO_SYMBOLIZE_DIFETCHER_H
  21. #include <cstdint>
  22. #include <string>
  23. #include "llvm/ADT/ArrayRef.h"
  24. namespace llvm {
  25. namespace symbolize {
  26. /// The DIFetcher interface provides arbitrary mechanisms for obtaining debug
  27. /// info from an outside source.
  28. class DIFetcher {
  29. public:
  30. virtual ~DIFetcher() = default;
  31. virtual Optional<std::string>
  32. fetchBuildID(ArrayRef<uint8_t> BuildID) const = 0;
  33. };
  34. /// LocalDIFetcher searches local cache directories for debug info.
  35. class LocalDIFetcher : public DIFetcher {
  36. public:
  37. LocalDIFetcher(ArrayRef<std::string> DebugFileDirectory)
  38. : DebugFileDirectory(DebugFileDirectory){};
  39. virtual ~LocalDIFetcher() = default;
  40. Optional<std::string> fetchBuildID(ArrayRef<uint8_t> BuildID) const override;
  41. private:
  42. const ArrayRef<std::string> DebugFileDirectory;
  43. };
  44. } // end namespace symbolize
  45. } // end namespace llvm
  46. #endif // LLVM_DEBUGINFO_SYMBOLIZE_DIFETCHER_H
  47. #ifdef __GNUC__
  48. #pragma GCC diagnostic pop
  49. #endif