#include "llvm/ExecutionEngine/RuntimeDyldChecker.h"
#include "RuntimeDyldCheckerImpl.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MSVCErrorWorkarounds.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include <cctype>
#include <memory>
#include <utility>
#define DEBUG_TYPE …
usingnamespacellvm;
namespace {
struct TargetInfo { … };
}
namespace llvm {
class RuntimeDyldCheckerExprEval { … };
}
RuntimeDyldCheckerImpl::RuntimeDyldCheckerImpl(
IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo,
GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo,
GetGOTInfoFunction GetGOTInfo, llvm::endianness Endianness, Triple TT,
StringRef CPU, SubtargetFeatures TF, raw_ostream &ErrStream)
: … { … }
bool RuntimeDyldCheckerImpl::check(StringRef CheckExpr) const { … }
bool RuntimeDyldCheckerImpl::checkAllRulesInBuffer(StringRef RulePrefix,
MemoryBuffer *MemBuf) const { … }
bool RuntimeDyldCheckerImpl::isSymbolValid(StringRef Symbol) const { … }
uint64_t RuntimeDyldCheckerImpl::getSymbolLocalAddr(StringRef Symbol) const { … }
uint64_t RuntimeDyldCheckerImpl::getSymbolRemoteAddr(StringRef Symbol) const { … }
uint64_t RuntimeDyldCheckerImpl::readMemoryAtAddr(uint64_t SrcAddr,
unsigned Size) const { … }
StringRef RuntimeDyldCheckerImpl::getSymbolContent(StringRef Symbol) const { … }
TargetFlagsType RuntimeDyldCheckerImpl::getTargetFlag(StringRef Symbol) const { … }
Triple
RuntimeDyldCheckerImpl::getTripleForSymbol(TargetFlagsType Flag) const { … }
std::pair<uint64_t, std::string> RuntimeDyldCheckerImpl::getSectionAddr(
StringRef FileName, StringRef SectionName, bool IsInsideLoad) const { … }
std::pair<uint64_t, std::string> RuntimeDyldCheckerImpl::getStubOrGOTAddrFor(
StringRef StubContainerName, StringRef SymbolName, StringRef StubKindFilter,
bool IsInsideLoad, bool IsStubAddr) const { … }
RuntimeDyldChecker::RuntimeDyldChecker(
IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo,
GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo,
GetGOTInfoFunction GetGOTInfo, llvm::endianness Endianness, Triple TT,
StringRef CPU, SubtargetFeatures TF, raw_ostream &ErrStream)
: … { … }
RuntimeDyldChecker::~RuntimeDyldChecker() = default;
bool RuntimeDyldChecker::check(StringRef CheckExpr) const { … }
bool RuntimeDyldChecker::checkAllRulesInBuffer(StringRef RulePrefix,
MemoryBuffer *MemBuf) const { … }
std::pair<uint64_t, std::string>
RuntimeDyldChecker::getSectionAddr(StringRef FileName, StringRef SectionName,
bool LocalAddress) { … }