LLVM 24.0.0git
BuildIDFetcher.cpp
Go to the documentation of this file.
1//===- llvm/DebugInfod/BuildIDFetcher.cpp - Build ID fetcher --------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file defines a DIFetcher implementation for obtaining debug info
11/// from debuginfod.
12///
13//===----------------------------------------------------------------------===//
14
16
18#include "llvm/Support/Error.h"
19
20using namespace llvm;
21
24 Expected<std::string> Path = BuildIDFetcher::fetch(BuildID);
25 if (Path)
26 return Path;
27 // Not available locally, so try and download it now.
28 assert(errorToErrorCode(Path.takeError()) ==
29 std::errc::no_such_file_or_directory &&
30 "BuildIDFetcher::fetch() failed in an unexpected way");
31 consumeError(Path.takeError());
32 return getCachedOrDownloadDebuginfo(BuildID);
33}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a Build ID fetcher implementation for obtaining debug info from debuginfod.
This file contains several declarations for the debuginfod client and server.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Expected< std::string > fetch(object::BuildIDRef BuildID) const override
Fetches the given Build ID using debuginfod and returns a local path to the resulting file.
Tagged union holding either a T or a Error.
Definition Error.h:485
This is an optimization pass for GlobalISel generic memory operations.
Expected< std::string > getCachedOrDownloadDebuginfo(object::BuildIDRef ID)
Fetches a debug binary by searching the default local cache directory and server URLs.
LLVM_ABI std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
Definition Error.cpp:113
void consumeError(Error Err)
Consume a Error without doing anything.
Definition Error.h:1106