#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 { … };
}
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) { … }
static void filterMarkup(const opt::InputArgList &Args, LLVMSymbolizer &Symbolizer) { … }
int llvm_symbolizer_main(int argc, char **argv, const llvm::ToolContext &) { … }