#include "BinaryHolder.h"
#include "DebugMap.h"
#include "MachOUtils.h"
#include "RelocationMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/Chrono.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
#include <vector>
namespace {
usingnamespacellvm;
usingnamespacellvm::dsymutil;
usingnamespacellvm::object;
class MachODebugMapParser { … };
}
void MachODebugMapParser::resetParserState() { … }
void MachODebugMapParser::addCommonSymbols() { … }
void MachODebugMapParser::switchToNewDebugMapObject(
StringRef Filename, sys::TimePoint<std::chrono::seconds> Timestamp) { … }
void MachODebugMapParser::switchToNewLibDebugMapObject(
StringRef Filename, sys::TimePoint<std::chrono::seconds> Timestamp) { … }
static std::string getArchName(const object::MachOObjectFile &Obj) { … }
void MachODebugMapParser::handleStabDebugMap(
const MachOObjectFile &MainBinary,
std::function<void(uint32_t, uint8_t, uint8_t, uint16_t, uint64_t)> F) { … }
std::unique_ptr<DebugMap>
MachODebugMapParser::parseOneBinary(const MachOObjectFile &MainBinary,
StringRef BinaryPath) { … }
struct DarwinStabName { … };
const struct DarwinStabName DarwinStabNames[] = …;
static const char *getDarwinStabString(uint8_t NType) { … }
void MachODebugMapParser::dumpSymTabHeader(raw_ostream &OS, StringRef Arch) { … }
void MachODebugMapParser::dumpSymTabEntry(raw_ostream &OS, uint64_t Index,
uint32_t StringIndex, uint8_t Type,
uint8_t SectionIndex, uint16_t Flags,
uint64_t Value) { … }
void MachODebugMapParser::dumpOneBinaryStab(const MachOObjectFile &MainBinary,
StringRef BinaryPath) { … }
static bool shouldLinkArch(SmallVectorImpl<StringRef> &Archs, StringRef Arch) { … }
bool MachODebugMapParser::dumpStab() { … }
ErrorOr<std::vector<std::unique_ptr<DebugMap>>> MachODebugMapParser::parse() { … }
void MachODebugMapParser::handleStabOSOEntry(
uint32_t StringIndex, uint8_t Type, uint8_t SectionIndex, uint16_t Flags,
uint64_t Value, llvm::DenseSet<OSO> &OSOs,
llvm::SmallSet<OSO, 4> &Duplicates) { … }
void MachODebugMapParser::handleStabSymbolTableEntry(
uint32_t StringIndex, uint8_t Type, uint8_t SectionIndex, uint16_t Flags,
uint64_t Value, const llvm::SmallSet<OSO, 4> &Duplicates) { … }
void MachODebugMapParser::loadCurrentObjectFileSymbols(
const object::MachOObjectFile &Obj) { … }
uint64_t MachODebugMapParser::getMainBinarySymbolAddress(StringRef Name) { … }
std::vector<StringRef>
MachODebugMapParser::getMainBinarySymbolNames(uint64_t Value) { … }
void MachODebugMapParser::loadMainBinarySymbols(
const MachOObjectFile &MainBinary) { … }
namespace llvm {
namespace dsymutil {
llvm::ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
parseDebugMap(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
StringRef InputFile, ArrayRef<std::string> Archs,
ArrayRef<std::string> DSYMSearchPaths, StringRef PrependPath,
StringRef VariantSuffix, bool Verbose, bool InputIsYAML) { … }
bool dumpStab(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
StringRef InputFile, ArrayRef<std::string> Archs,
ArrayRef<std::string> DSYMSearchPaths, StringRef PrependPath,
StringRef VariantSuffix) { … }
}
}