llvm/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp

//===-- llvm-symbolizer.cpp - Simple addr2line-like symbolizer ------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This utility works much like "addr2line". It is able of transforming
// tuples (module name, module offset) to code locations (function name,
// file, line number, column number). It is targeted for compiler-rt tools
// (especially AddressSanitizer and ThreadSanitizer) that can use it
// to symbolize stack traces in their error reports.
//
//===----------------------------------------------------------------------===//

#include "Opts.inc"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/Symbolize/DIPrinter.h"
#include "llvm/DebugInfo/Symbolize/Markup.h"
#include "llvm/DebugInfo/Symbolize/MarkupFilter.h"
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "llvm/Debuginfod/BuildIDFetcher.h"
#include "llvm/Debuginfod/Debuginfod.h"
#include "llvm/Debuginfod/HTTPClient.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/COM.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/StringSaver.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>

usingnamespacellvm;
usingnamespacesymbolize;

namespace {
enum ID {};

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

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

class SymbolizerOptTable : public opt::GenericOptTable {};
} // namespace

static std::string ToolName;

static void printError(const ErrorInfoBase &EI, StringRef AuxInfo) {}

template <typename T>
static void print(const Request &Request, Expected<T> &ResOrErr,
                  DIPrinter &Printer) {}

enum class OutputStyle {};

enum class Command {};

static void enableDebuginfod(LLVMSymbolizer &Symbolizer,
                             const opt::ArgList &Args) {}

static StringRef getSpaceDelimitedWord(StringRef &Source) {}

static Error makeStringError(StringRef Msg) {}

static Error parseCommand(StringRef BinaryName, bool IsAddr2Line,
                          StringRef InputString, Command &Cmd,
                          std::string &ModuleName, object::BuildID &BuildID,
                          StringRef &Symbol, uint64_t &Offset) {}

template <typename T>
void executeCommand(StringRef ModuleName, const T &ModuleSpec, Command Cmd,
                    StringRef Symbol, uint64_t Offset, uint64_t AdjustVMA,
                    bool ShouldInline, OutputStyle Style,
                    LLVMSymbolizer &Symbolizer, DIPrinter &Printer) {}

static void printUnknownLineInfo(std::string ModuleName, DIPrinter &Printer) {}

static void symbolizeInput(const opt::InputArgList &Args,
                           object::BuildIDRef IncomingBuildID,
                           uint64_t AdjustVMA, bool IsAddr2Line,
                           OutputStyle Style, StringRef InputString,
                           LLVMSymbolizer &Symbolizer, DIPrinter &Printer) {}

static void printHelp(StringRef ToolName, const SymbolizerOptTable &Tbl,
                      raw_ostream &OS) {}

static opt::InputArgList parseOptions(int Argc, char *Argv[], bool IsAddr2Line,
                                      StringSaver &Saver,
                                      SymbolizerOptTable &Tbl) {}

template <typename T>
static void parseIntArg(const opt::InputArgList &Args, int ID, T &Value) {}

static FunctionNameKind decideHowToPrintFunctions(const opt::InputArgList &Args,
                                                  bool IsAddr2Line) {}

static std::optional<bool> parseColorArg(const opt::InputArgList &Args) {}

static object::BuildID parseBuildIDArg(const opt::InputArgList &Args, int ID) {}

// Symbolize markup from stdin and write the result to stdout.
static void filterMarkup(const opt::InputArgList &Args, LLVMSymbolizer &Symbolizer) {}

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