aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize')
-rw-r--r--contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIFetcher.h51
-rw-r--r--contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h13
2 files changed, 64 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIFetcher.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIFetcher.h
new file mode 100644
index 000000000000..c5340b5f0460
--- /dev/null
+++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/DIFetcher.h
@@ -0,0 +1,51 @@
+//===-- llvm/DebugInfo/Symbolize/DIFetcher.h --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file declares a DIFetcher abstraction for obtaining debug info from an
+/// arbitrary outside source.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_SYMBOLIZE_DIFETCHER_H
+#define LLVM_DEBUGINFO_SYMBOLIZE_DIFETCHER_H
+
+#include <cstdint>
+#include <string>
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace llvm {
+namespace symbolize {
+
+/// The DIFetcher interface provides arbitrary mechanisms for obtaining debug
+/// info from an outside source.
+class DIFetcher {
+public:
+ virtual ~DIFetcher() = default;
+ virtual Optional<std::string>
+ fetchBuildID(ArrayRef<uint8_t> BuildID) const = 0;
+};
+
+/// LocalDIFetcher searches local cache directories for debug info.
+class LocalDIFetcher : public DIFetcher {
+public:
+ LocalDIFetcher(ArrayRef<std::string> DebugFileDirectory)
+ : DebugFileDirectory(DebugFileDirectory){};
+ virtual ~LocalDIFetcher() = default;
+
+ Optional<std::string> fetchBuildID(ArrayRef<uint8_t> BuildID) const override;
+
+private:
+ const ArrayRef<std::string> DebugFileDirectory;
+};
+
+} // end namespace symbolize
+} // end namespace llvm
+
+#endif // LLVM_DEBUGINFO_SYMBOLIZE_DIFETCHER_H
diff --git a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
index 4ec333422c4b..30e55c5d410a 100644
--- a/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
+++ b/contrib/llvm-project/llvm/include/llvm/DebugInfo/Symbolize/Symbolize.h
@@ -13,6 +13,7 @@
#ifndef LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
#define LLVM_DEBUGINFO_SYMBOLIZE_SYMBOLIZE_H
+#include "llvm/DebugInfo/Symbolize/DIFetcher.h"
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/ELFObjectFile.h"
@@ -83,6 +84,10 @@ public:
DemangleName(const std::string &Name,
const SymbolizableModule *DbiModuleDescriptor);
+ void addDIFetcher(std::unique_ptr<DIFetcher> Fetcher) {
+ DIFetchers.push_back(std::move(Fetcher));
+ }
+
private:
// Bundles together object file with code/data and object file with
// corresponding debug info. These objects can be the same.
@@ -126,6 +131,12 @@ private:
const ELFObjectFileBase *Obj,
const std::string &ArchName);
+ bool findDebugBinary(const std::string &OrigPath,
+ const std::string &DebuglinkName, uint32_t CRCHash,
+ std::string &Result);
+
+ bool findDebugBinary(const ArrayRef<uint8_t> BuildID, std::string &Result);
+
/// Returns pair of pointers to object and debug object.
Expected<ObjectPair> getOrCreateObjectPair(const std::string &Path,
const std::string &ArchName);
@@ -152,6 +163,8 @@ private:
ObjectForUBPathAndArch;
Options Opts;
+
+ SmallVector<std::unique_ptr<DIFetcher>> DIFetchers;
};
} // end namespace symbolize