retdec
|
#include <config.h>
Public Types | |
using | IntrinsicFunctionCreatorPtr = llvm::Function *(*)(llvm::Module *) |
Public Member Functions | |
void | doFinalization () |
void | tagFunctionsWithUsedCryptoGlobals () |
retdec::config::Config & | getConfig () |
const retdec::config::Config & | getConfig () const |
retdec::common::Function * | getConfigFunction (const llvm::Function *fnc) |
retdec::common::Function * | getConfigFunction (retdec::common::Address startAddr) |
llvm::Function * | getLlvmFunction (retdec::common::Address startAddr) |
retdec::common::Address | getFunctionAddress (const llvm::Function *fnc) |
llvm::Function * | getIntrinsicFunction (IntrinsicFunctionCreatorPtr f) |
const retdec::common::Object * | getConfigRegister (const llvm::Value *val) |
std::optional< unsigned > | getConfigRegisterNumber (const llvm::Value *val) |
const retdec::common::Object * | getConfigGlobalVariable (const llvm::GlobalVariable *gv) |
const retdec::common::Object * | getConfigGlobalVariable (retdec::common::Address address) |
llvm::GlobalVariable * | getLlvmGlobalVariable (retdec::common::Address address) |
llvm::GlobalVariable * | getLlvmGlobalVariable (const std::string &name, retdec::common::Address address) |
retdec::common::Address | getGlobalAddress (const llvm::GlobalVariable *gv) |
bool | isGlobalVariable (const llvm::Value *val) |
const retdec::common::Object * | getConfigLocalVariable (const llvm::Value *val) |
retdec::common::Object * | getConfigStackVariable (const llvm::Value *val) |
llvm::AllocaInst * | getLlvmStackVariable (llvm::Function *fnc, int offset) |
llvm::AllocaInst * | getLlvmStackVariable (llvm::Function *fnc, const std::string &realName) |
bool | isStackVariable (const llvm::Value *val) |
std::optional< int > | getStackVariableOffset (const llvm::Value *val) |
const retdec::common::Object * | insertGlobalVariable (const llvm::GlobalVariable *gv, retdec::common::Address address, bool fromDebug=false, const std::string &realName="", const std::string &cryptoDesc="") |
const retdec::common::Object * | insertStackVariable (const llvm::AllocaInst *sv, int offset, bool fromDebug=false, const std::string &realName=std::string()) |
const retdec::common::Function * | insertFunction (const llvm::Function *fnc, retdec::common::Address start=retdec::common::Address::Undefined, retdec::common::Address end=retdec::common::Address::Undefined, bool fromDebug=false) |
retdec::common::Function * | renameFunction (retdec::common::Function *fnc, const std::string &name) |
void | setLlvmCallPseudoFunction (llvm::Function *f) |
llvm::Function * | getLlvmCallPseudoFunction () const |
bool | isLlvmCallPseudoFunction (llvm::Value *f) |
llvm::CallInst * | isLlvmCallPseudoFunctionCall (llvm::Value *c) |
void | setLlvmReturnPseudoFunction (llvm::Function *f) |
llvm::Function * | getLlvmReturnPseudoFunction () const |
bool | isLlvmReturnPseudoFunction (llvm::Value *f) |
llvm::CallInst * | isLlvmReturnPseudoFunctionCall (llvm::Value *c) |
void | setLlvmBranchPseudoFunction (llvm::Function *f) |
llvm::Function * | getLlvmBranchPseudoFunction () const |
bool | isLlvmBranchPseudoFunction (llvm::Value *f) |
llvm::CallInst * | isLlvmBranchPseudoFunctionCall (llvm::Value *c) |
void | setLlvmCondBranchPseudoFunction (llvm::Function *f) |
llvm::Function * | getLlvmCondBranchPseudoFunction () const |
bool | isLlvmCondBranchPseudoFunction (llvm::Value *f) |
llvm::CallInst * | isLlvmCondBranchPseudoFunctionCall (llvm::Value *c) |
llvm::CallInst * | isLlvmAnyBranchPseudoFunctionCall (llvm::Value *c) |
llvm::CallInst * | isLlvmAnyUncondBranchPseudoFunctionCall (llvm::Value *c) |
void | setLlvmX87DataStorePseudoFunction (llvm::Function *f) |
llvm::Function * | getLlvmX87DataStorePseudoFunction () const |
bool | isLlvmX87DataStorePseudoFunction (llvm::Value *f) |
llvm::CallInst * | isLlvmX87DataStorePseudoFunctionCall (llvm::Value *c) |
void | setLlvmX87DataLoadPseudoFunction (llvm::Function *f) |
llvm::Function * | getLlvmX87DataLoadPseudoFunction () const |
bool | isLlvmX87DataLoadPseudoFunction (llvm::Value *f) |
llvm::CallInst * | isLlvmX87DataLoadPseudoFunctionCall (llvm::Value *c) |
llvm::CallInst * | isLlvmX87StorePseudoFunctionCall (llvm::Value *c) |
llvm::CallInst * | isLlvmX87LoadPseudoFunctionCall (llvm::Value *c) |
void | addPseudoAsmFunction (llvm::Function *f) |
bool | isPseudoAsmFunction (llvm::Function *f) |
llvm::CallInst * | isPseudoAsmFunctionCall (llvm::Value *c) |
llvm::GlobalVariable * | getGlobalDummy () |
fs::path | getOutputDirectory () |
bool | getCryptoPattern (retdec::common::Address addr, std::string &name, std::string &description, llvm::Type *&type) const |
Static Public Member Functions | |
static Config | empty (llvm::Module *m) |
static Config | fromConfig (llvm::Module *m, retdec::config::Config &c) |
Public Attributes | |
llvm::Module * | _module = nullptr |
Private Member Functions | |
Config (retdec::config::Config &c) | |
Private Attributes | |
retdec::config::Config & | _configDB |
llvm::GlobalVariable * | _globalDummy = nullptr |
llvm::Function * | _callFunction = nullptr |
llvm::Function * | _returnFunction = nullptr |
llvm::Function * | _branchFunction = nullptr |
llvm::Function * | _condBranchFunction = nullptr |
llvm::Function * | _x87DataStoreFunction = nullptr |
llvm::Function * | _x87DataLoadFunction = nullptr |
std::map< IntrinsicFunctionCreatorPtr, llvm::Function * > | _intrinsicFunctions |
std::set< llvm::Function * > | _pseudoAsmFunctions |
using retdec::bin2llvmir::Config::IntrinsicFunctionCreatorPtr = llvm::Function* (*)(llvm::Module*) |
|
private |
void retdec::bin2llvmir::Config::addPseudoAsmFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::doFinalization | ( | ) |
Save the config to reflect changes that have been done to it in the bin2llvmirl.
|
static |
|
static |
retdec::config::Config & retdec::bin2llvmir::Config::getConfig | ( | ) |
const retdec::config::Config & retdec::bin2llvmir::Config::getConfig | ( | ) | const |
retdec::common::Function * retdec::bin2llvmir::Config::getConfigFunction | ( | const llvm::Function * | fnc | ) |
retdec::common::Function * retdec::bin2llvmir::Config::getConfigFunction | ( | retdec::common::Address | startAddr | ) |
const retdec::common::Object * retdec::bin2llvmir::Config::getConfigGlobalVariable | ( | const llvm::GlobalVariable * | gv | ) |
const retdec::common::Object * retdec::bin2llvmir::Config::getConfigGlobalVariable | ( | retdec::common::Address | address | ) |
const retdec::common::Object * retdec::bin2llvmir::Config::getConfigLocalVariable | ( | const llvm::Value * | val | ) |
const retdec::common::Object * retdec::bin2llvmir::Config::getConfigRegister | ( | const llvm::Value * | val | ) |
std::optional< unsigned > retdec::bin2llvmir::Config::getConfigRegisterNumber | ( | const llvm::Value * | val | ) |
retdec::common::Object * retdec::bin2llvmir::Config::getConfigStackVariable | ( | const llvm::Value * | val | ) |
bool retdec::bin2llvmir::Config::getCryptoPattern | ( | retdec::common::Address | addr, |
std::string & | name, | ||
std::string & | description, | ||
llvm::Type *& | type | ||
) | const |
Get crypto pattern information for address addr
- fill name
, description
, and type
, if there is a pattern on address.
True
if pattern was found, false
otherwise. retdec::common::Address retdec::bin2llvmir::Config::getFunctionAddress | ( | const llvm::Function * | fnc | ) |
retdec::common::Address retdec::bin2llvmir::Config::getGlobalAddress | ( | const llvm::GlobalVariable * | gv | ) |
llvm::GlobalVariable * retdec::bin2llvmir::Config::getGlobalDummy | ( | ) |
llvm::Function * retdec::bin2llvmir::Config::getIntrinsicFunction | ( | IntrinsicFunctionCreatorPtr | f | ) |
llvm::Function * retdec::bin2llvmir::Config::getLlvmBranchPseudoFunction | ( | ) | const |
llvm::Function * retdec::bin2llvmir::Config::getLlvmCallPseudoFunction | ( | ) | const |
llvm::Function * retdec::bin2llvmir::Config::getLlvmCondBranchPseudoFunction | ( | ) | const |
llvm::Function * retdec::bin2llvmir::Config::getLlvmFunction | ( | retdec::common::Address | startAddr | ) |
llvm::GlobalVariable * retdec::bin2llvmir::Config::getLlvmGlobalVariable | ( | const std::string & | name, |
retdec::common::Address | address | ||
) |
Global variables have two unique IDs – name and address. This method returns LLVM global with either name (string search in module's globals) or address (config used to get global by address).
llvm::GlobalVariable * retdec::bin2llvmir::Config::getLlvmGlobalVariable | ( | retdec::common::Address | address | ) |
llvm::Function * retdec::bin2llvmir::Config::getLlvmReturnPseudoFunction | ( | ) | const |
llvm::AllocaInst * retdec::bin2llvmir::Config::getLlvmStackVariable | ( | llvm::Function * | fnc, |
const std::string & | realName | ||
) |
llvm::AllocaInst * retdec::bin2llvmir::Config::getLlvmStackVariable | ( | llvm::Function * | fnc, |
int | offset | ||
) |
nullptr
if such variable does not exist. llvm::Function * retdec::bin2llvmir::Config::getLlvmX87DataLoadPseudoFunction | ( | ) | const |
llvm::Function * retdec::bin2llvmir::Config::getLlvmX87DataStorePseudoFunction | ( | ) | const |
fs::path retdec::bin2llvmir::Config::getOutputDirectory | ( | ) |
std::optional< int > retdec::bin2llvmir::Config::getStackVariableOffset | ( | const llvm::Value * | val | ) |
const retdec::common::Function * retdec::bin2llvmir::Config::insertFunction | ( | const llvm::Function * | fnc, |
retdec::common::Address | start = retdec::common::Address::Undefined , |
||
retdec::common::Address | end = retdec::common::Address::Undefined , |
||
bool | fromDebug = false |
||
) |
const retdec::common::Object * retdec::bin2llvmir::Config::insertGlobalVariable | ( | const llvm::GlobalVariable * | gv, |
retdec::common::Address | address, | ||
bool | fromDebug = false , |
||
const std::string & | realName = "" , |
||
const std::string & | cryptoDesc = "" |
||
) |
const retdec::common::Object * retdec::bin2llvmir::Config::insertStackVariable | ( | const llvm::AllocaInst * | sv, |
int | offset, | ||
bool | fromDebug = false , |
||
const std::string & | realName = std::string() |
||
) |
bool retdec::bin2llvmir::Config::isGlobalVariable | ( | const llvm::Value * | val | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmAnyBranchPseudoFunctionCall | ( | llvm::Value * | c | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmAnyUncondBranchPseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isLlvmBranchPseudoFunction | ( | llvm::Value * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmBranchPseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isLlvmCallPseudoFunction | ( | llvm::Value * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmCallPseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isLlvmCondBranchPseudoFunction | ( | llvm::Value * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmCondBranchPseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isLlvmReturnPseudoFunction | ( | llvm::Value * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmReturnPseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isLlvmX87DataLoadPseudoFunction | ( | llvm::Value * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmX87DataLoadPseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isLlvmX87DataStorePseudoFunction | ( | llvm::Value * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmX87DataStorePseudoFunctionCall | ( | llvm::Value * | c | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmX87LoadPseudoFunctionCall | ( | llvm::Value * | c | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isLlvmX87StorePseudoFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isPseudoAsmFunction | ( | llvm::Function * | f | ) |
llvm::CallInst * retdec::bin2llvmir::Config::isPseudoAsmFunctionCall | ( | llvm::Value * | c | ) |
bool retdec::bin2llvmir::Config::isStackVariable | ( | const llvm::Value * | val | ) |
True
if the the provided LLVM value val is a stack variable. False
otherwise. retdec::common::Function * retdec::bin2llvmir::Config::renameFunction | ( | retdec::common::Function * | fnc, |
const std::string & | name | ||
) |
void retdec::bin2llvmir::Config::setLlvmBranchPseudoFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::setLlvmCallPseudoFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::setLlvmCondBranchPseudoFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::setLlvmReturnPseudoFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::setLlvmX87DataLoadPseudoFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::setLlvmX87DataStorePseudoFunction | ( | llvm::Function * | f | ) |
void retdec::bin2llvmir::Config::tagFunctionsWithUsedCryptoGlobals | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
llvm::Module* retdec::bin2llvmir::Config::_module = nullptr |
|
private |
|
private |
|
private |
|
private |