Daniel Thornburgh 4a6553f4c2 [Debuginfod] [Symbolizer] Break debuginfod out of libLLVM.
Debuginfod can pull in libcurl as a dependency, which isn't appropriate
for libLLVM. (See
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5732).

This change breaks out debuginfod into a separate non-component library
that can be used directly in llvm-symbolizer. The tool can inject
debuginfod into the Symbolizer library via an abstract DebugInfoFetcher
interface, breaking the dependency of Symbolizer on debuinfod.

See https://github.com/llvm/llvm-project/issues/52731

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D118413
2022-02-08 19:14:18 +00:00

29 lines
930 B
C++

//===- llvm/DebugInfod/DIFetcher.cpp - Debug info fetcher -----------------===//
//
// 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 defines a DIFetcher implementation for obtaining debug info
/// from debuginfod.
///
//===----------------------------------------------------------------------===//
#include "llvm/Debuginfod/DIFetcher.h"
#include "llvm/Debuginfod/Debuginfod.h"
using namespace llvm;
Optional<std::string>
DebuginfodDIFetcher::fetchBuildID(ArrayRef<uint8_t> BuildID) const {
Expected<std::string> PathOrErr = getCachedOrDownloadDebuginfo(BuildID);
if (PathOrErr)
return *PathOrErr;
consumeError(PathOrErr.takeError());
return None;
}