#include "llvm/Debuginfod/Debuginfod.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "llvm/Debuginfod/HTTPClient.h"
#include "llvm/Object/BuildID.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Support/CachePruning.h"
#include "llvm/Support/Caching.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/xxhash.h"
#include <atomic>
#include <optional>
#include <thread>
namespace llvm {
BuildIDRef;
namespace {
std::optional<SmallVector<StringRef>> DebuginfodUrls;
llvm::sys::RWMutex UrlsMutex;
}
std::string getDebuginfodCacheKey(llvm::StringRef S) { … }
static std::string buildIDToString(BuildIDRef ID) { … }
bool canUseDebuginfod() { … }
SmallVector<StringRef> getDefaultDebuginfodUrls() { … }
void setDefaultDebuginfodUrls(const SmallVector<StringRef> &URLs) { … }
Expected<std::string> getDefaultDebuginfodCacheDirectory() { … }
std::chrono::milliseconds getDefaultDebuginfodTimeout() { … }
std::string getDebuginfodSourceUrlPath(BuildIDRef ID,
StringRef SourceFilePath) { … }
Expected<std::string> getCachedOrDownloadSource(BuildIDRef ID,
StringRef SourceFilePath) { … }
std::string getDebuginfodExecutableUrlPath(BuildIDRef ID) { … }
Expected<std::string> getCachedOrDownloadExecutable(BuildIDRef ID) { … }
std::string getDebuginfodDebuginfoUrlPath(BuildIDRef ID) { … }
Expected<std::string> getCachedOrDownloadDebuginfo(BuildIDRef ID) { … }
Expected<std::string> getCachedOrDownloadArtifact(StringRef UniqueKey,
StringRef UrlPath) { … }
namespace {
class StreamedHTTPResponseHandler : public HTTPResponseHandler { … };
}
Error StreamedHTTPResponseHandler::handleBodyChunk(StringRef BodyChunk) { … }
static bool isHeader(StringRef S) { … }
static SmallVector<std::string, 0> getHeaders() { … }
Expected<std::string> getCachedOrDownloadArtifact(
StringRef UniqueKey, StringRef UrlPath, StringRef CacheDirectoryPath,
ArrayRef<StringRef> DebuginfodUrls, std::chrono::milliseconds Timeout) { … }
DebuginfodLogEntry::DebuginfodLogEntry(const Twine &Message)
: … { … }
void DebuginfodLog::push(const Twine &Message) { … }
void DebuginfodLog::push(DebuginfodLogEntry Entry) { … }
DebuginfodLogEntry DebuginfodLog::pop() { … }
DebuginfodCollection::DebuginfodCollection(ArrayRef<StringRef> PathsRef,
DebuginfodLog &Log,
ThreadPoolInterface &Pool,
double MinInterval)
: … { … }
Error DebuginfodCollection::update() { … }
Expected<bool> DebuginfodCollection::updateIfStale() { … }
Error DebuginfodCollection::updateForever(std::chrono::milliseconds Interval) { … }
static bool hasELFMagic(StringRef FilePath) { … }
Error DebuginfodCollection::findBinaries(StringRef Path) { … }
Expected<std::optional<std::string>>
DebuginfodCollection::getBinaryPath(BuildIDRef ID) { … }
Expected<std::optional<std::string>>
DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) { … }
Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) { … }
Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) { … }
DebuginfodServer::DebuginfodServer(DebuginfodLog &Log,
DebuginfodCollection &Collection)
: … { … }
}