retdec
Public Member Functions | Public Attributes | List of all members
retdec::llvmir_emul::GlobalExecutionContext Class Reference

#include <llvmir_emul.h>

Collaboration diagram for retdec::llvmir_emul::GlobalExecutionContext:
Collaboration graph
[legend]

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GlobalExecutionContext()

retdec::llvmir_emul::GlobalExecutionContext::GlobalExecutionContext ( llvm::Module *  m)

Member Function Documentation

◆ getGlobal()

llvm::GenericValue retdec::llvmir_emul::GlobalExecutionContext::getGlobal ( llvm::GlobalVariable *  g,
bool  log = true 
)

◆ getMemory()

llvm::GenericValue retdec::llvmir_emul::GlobalExecutionContext::getMemory ( uint64_t  addr,
bool  log = true 
)

◆ getModule()

llvm::Module * retdec::llvmir_emul::GlobalExecutionContext::getModule ( ) const

◆ getOperandValue()

llvm::GenericValue retdec::llvmir_emul::GlobalExecutionContext::getOperandValue ( llvm::Value *  val,
LocalExecutionContext ec 
)

◆ setGlobal()

void retdec::llvmir_emul::GlobalExecutionContext::setGlobal ( llvm::GlobalVariable *  g,
llvm::GenericValue  val,
bool  log = true 
)

◆ setMemory()

void retdec::llvmir_emul::GlobalExecutionContext::setMemory ( uint64_t  addr,
llvm::GenericValue  val,
bool  log = true 
)

◆ setValue()

void retdec::llvmir_emul::GlobalExecutionContext::setValue ( llvm::Value *  v,
llvm::GenericValue  val 
)

Member Data Documentation

◆ _module

llvm::Module* retdec::llvmir_emul::GlobalExecutionContext::_module = nullptr

◆ globals

std::map<llvm::GlobalVariable*, llvm::GenericValue> retdec::llvmir_emul::GlobalExecutionContext::globals

◆ globalsLoads

std::list<llvm::GlobalVariable*> retdec::llvmir_emul::GlobalExecutionContext::globalsLoads

◆ globalsStores

std::list<llvm::GlobalVariable*> retdec::llvmir_emul::GlobalExecutionContext::globalsStores

◆ memory

std::map<uint64_t, llvm::GenericValue> retdec::llvmir_emul::GlobalExecutionContext::memory

◆ memoryLoads

std::list<uint64_t> retdec::llvmir_emul::GlobalExecutionContext::memoryLoads

◆ memoryStores

std::list<uint64_t> retdec::llvmir_emul::GlobalExecutionContext::memoryStores

◆ values

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.


The documentation for this class was generated from the following files: