#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cstring>
#include <inttypes.h>
#include <iostream>
#include <optional>
#include <string>
#include <system_error>
#include <vector>
#include "llvm/DebugInfo/GSYM/DwarfTransformer.h"
#include "llvm/DebugInfo/GSYM/FunctionInfo.h"
#include "llvm/DebugInfo/GSYM/GsymCreator.h"
#include "llvm/DebugInfo/GSYM/GsymReader.h"
#include "llvm/DebugInfo/GSYM/InlineInfo.h"
#include "llvm/DebugInfo/GSYM/LookupResult.h"
#include "llvm/DebugInfo/GSYM/ObjectFileTransformer.h"
#include "llvm/DebugInfo/GSYM/OutputAggregator.h"
#include <optional>
usingnamespacellvm;
usingnamespacegsym;
usingnamespaceobject;
usingnamespacellvm::opt;
enum ID { … };
#define PREFIX …
#include "Opts.inc"
#undef PREFIX
const opt::OptTable::Info InfoTable[] = …;
class GSYMUtilOptTable : public llvm::opt::GenericOptTable { … };
static bool Verbose;
static std::vector<std::string> InputFilenames;
static std::string ConvertFilename;
static std::vector<std::string> ArchFilters;
static std::string OutputFilename;
static std::string JsonSummaryFile;
static bool Verify;
static unsigned NumThreads;
static uint64_t SegmentSize;
static bool Quiet;
static std::vector<uint64_t> LookupAddresses;
static bool LookupAddressesFromStdin;
static bool StoreMergedFunctionInfo = …;
static void parseArgs(int argc, char **argv) { … }
static void error(Error Err) { … }
static void error(StringRef Prefix, llvm::Error Err) { … }
static void error(StringRef Prefix, std::error_code EC) { … }
static uint32_t getCPUType(MachOObjectFile &MachO) { … }
static bool filterArch(MachOObjectFile &Obj) { … }
template <class ELFT>
static std::optional<uint64_t>
getImageBaseAddress(const object::ELFFile<ELFT> &ELFFile) { … }
static std::optional<uint64_t>
getImageBaseAddress(const object::MachOObjectFile *MachO) { … }
static std::optional<uint64_t> getImageBaseAddress(object::ObjectFile &Obj) { … }
static llvm::Error handleObjectFile(ObjectFile &Obj, const std::string &OutFile,
OutputAggregator &Out) { … }
static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
const std::string &OutFile,
OutputAggregator &Out) { … }
static llvm::Error handleFileConversionToGSYM(StringRef Filename,
const std::string &OutFile,
OutputAggregator &Out) { … }
static llvm::Error convertFileToGSYM(OutputAggregator &Out) { … }
static void doLookup(GsymReader &Gsym, uint64_t Addr, raw_ostream &OS) { … }
int llvm_gsymutil_main(int argc, char **argv, const llvm::ToolContext &) { … }