retdec
|
#include <llvmir_emul.h>
Public Member Functions | |
GlobalExecutionContext (llvm::Module *m) | |
llvm::Module * | getModule () const |
llvm::GenericValue | getMemory (uint64_t addr, bool log=true) |
void | setMemory (uint64_t addr, llvm::GenericValue val, bool log=true) |
llvm::GenericValue | getGlobal (llvm::GlobalVariable *g, bool log=true) |
void | setGlobal (llvm::GlobalVariable *g, llvm::GenericValue val, bool log=true) |
void | setValue (llvm::Value *v, llvm::GenericValue val) |
llvm::GenericValue | getOperandValue (llvm::Value *val, LocalExecutionContext &ec) |
Public Attributes | |
llvm::Module * | _module = nullptr |
std::map< uint64_t, llvm::GenericValue > | memory |
std::list< uint64_t > | memoryLoads |
std::list< uint64_t > | memoryStores |
std::map< llvm::GlobalVariable *, llvm::GenericValue > | globals |
std::list< llvm::GlobalVariable * > | globalsLoads |
std::list< llvm::GlobalVariable * > | globalsStores |
std::map< llvm::Value *, llvm::GenericValue > | values |
This is not ideal. 1) Memory accesses are separated into global variable accesses and memory accesses using integer values. This is ok. 2) Memory is not modeled byte-by-byte. Generic values of any size are mapped to every memory address. I.e. if 4 byte integer value is stored to 0x1000 and 2 byte integer value is stored to 0x1002, right now these two values are both separate entries in the memory map and do not affect each other, even though they should.
retdec::llvmir_emul::GlobalExecutionContext::GlobalExecutionContext | ( | llvm::Module * | m | ) |
llvm::GenericValue retdec::llvmir_emul::GlobalExecutionContext::getGlobal | ( | llvm::GlobalVariable * | g, |
bool | log = true |
||
) |
llvm::GenericValue retdec::llvmir_emul::GlobalExecutionContext::getMemory | ( | uint64_t | addr, |
bool | log = true |
||
) |
llvm::Module * retdec::llvmir_emul::GlobalExecutionContext::getModule | ( | ) | const |
llvm::GenericValue retdec::llvmir_emul::GlobalExecutionContext::getOperandValue | ( | llvm::Value * | val, |
LocalExecutionContext & | ec | ||
) |
void retdec::llvmir_emul::GlobalExecutionContext::setGlobal | ( | llvm::GlobalVariable * | g, |
llvm::GenericValue | val, | ||
bool | log = true |
||
) |
void retdec::llvmir_emul::GlobalExecutionContext::setMemory | ( | uint64_t | addr, |
llvm::GenericValue | val, | ||
bool | log = true |
||
) |
void retdec::llvmir_emul::GlobalExecutionContext::setValue | ( | llvm::Value * | v, |
llvm::GenericValue | val | ||
) |
llvm::Module* retdec::llvmir_emul::GlobalExecutionContext::_module = nullptr |
std::map<llvm::GlobalVariable*, llvm::GenericValue> retdec::llvmir_emul::GlobalExecutionContext::globals |
std::list<llvm::GlobalVariable*> retdec::llvmir_emul::GlobalExecutionContext::globalsLoads |
std::list<llvm::GlobalVariable*> retdec::llvmir_emul::GlobalExecutionContext::globalsStores |
std::map<uint64_t, llvm::GenericValue> retdec::llvmir_emul::GlobalExecutionContext::memory |
std::list<uint64_t> retdec::llvmir_emul::GlobalExecutionContext::memoryLoads |
std::list<uint64_t> retdec::llvmir_emul::GlobalExecutionContext::memoryStores |
std::map<llvm::Value*, llvm::GenericValue> retdec::llvmir_emul::GlobalExecutionContext::values |
LLVM values of all emulated objects. In the original LLVM's interpret implementation, this was in local context. However, we want to provide this information to the user of this library after emulation is done, so we need to preserve it for all emulated objects and not to thorw it away after local frame is left.