llvm/llvm/tools/llvm-debuginfod-find/llvm-debuginfod-find.cpp

//===-- llvm-debuginfod-find.cpp - Simple CLI for libdebuginfod-client ----===//
//
// 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 contains the llvm-debuginfod-find tool. This tool
/// queries the debuginfod servers in the DEBUGINFOD_URLS environment
/// variable (delimited by space (" ")) for the executable,
/// debuginfo, or specified source file of the binary matching the
/// given build-id.
///
//===----------------------------------------------------------------------===//

#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Debuginfod/BuildIDFetcher.h"
#include "llvm/Debuginfod/Debuginfod.h"
#include "llvm/Debuginfod/HTTPClient.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/LLVMDriver.h"

usingnamespacellvm;

// Command-line option boilerplate.
namespace {
enum ID {};

#define PREFIX
#include "Opts.inc"
#undef PREFIX

usingnamespacellvm::opt;
static constexpr opt::OptTable::Info InfoTable[] =;

class DebuginfodFindOptTable : public opt::GenericOptTable {};

} // end anonymous namespace

static std::string InputBuildID;
static bool FetchExecutable;
static bool FetchDebuginfo;
static std::string FetchSource;
static bool DumpToStdout;
static std::vector<std::string> DebugFileDirectory;

static void parseArgs(int argc, char **argv) {}

[[noreturn]] static void helpExit() {}

ExitOnError ExitOnDebuginfodFindError;

static std::string fetchDebugInfo(object::BuildIDRef BuildID);

int llvm_debuginfod_find_main(int argc, char **argv,
                              const llvm::ToolContext &) {}

// Find a debug file in local build ID directories and via debuginfod.
std::string fetchDebugInfo(object::BuildIDRef BuildID) {}