retdec
Public Member Functions | Private Attributes | List of all members
retdec::bin2llvmir::FileImage Class Reference

#include <fileimage.h>

Collaboration diagram for retdec::bin2llvmir::FileImage:
Collaboration graph
[legend]

Public Member Functions

 FileImage (llvm::Module *m, const std::string &path, Config *config)
 
 FileImage (llvm::Module *m, const std::shared_ptr< retdec::fileformat::FileFormat > &ff, Config *config)
 
 FileImage (llvm::Module *m, std::unique_ptr< retdec::loader::Image > img, Config *config)
 
void initRtti (Config *config)
 
llvm::ConstantInt * getConstantInt (llvm::IntegerType *t, retdec::common::Address addr)
 
llvm::ConstantInt * getConstantDefault (retdec::common::Address addr)
 
llvm::Constant * getConstantHalf (retdec::common::Address addr)
 
llvm::Constant * getConstantFloat (retdec::common::Address addr)
 
llvm::Constant * getConstantDouble (retdec::common::Address addr)
 
llvm::Constant * getConstantLongDouble (retdec::common::Address addr)
 
llvm::Constant * getConstantCharPointer (retdec::common::Address addr)
 
llvm::Constant * getConstantCharArrayNice (retdec::common::Address addr)
 
llvm::Constant * getConstantPointer (llvm::PointerType *type, retdec::common::Address addr)
 
llvm::Constant * getConstantStruct (llvm::StructType *type, retdec::common::Address addr)
 
llvm::Constant * getConstantArray (llvm::ArrayType *type, retdec::common::Address addr)
 
llvm::Constant * getConstant (llvm::Type *type, retdec::common::Address addr=retdec::common::Address::Undefined, bool wideString=false)
 
llvm::Constant * getConstant (Config *config, DebugFormat *dbgf=nullptr, retdec::common::Address addr=retdec::common::Address::Undefined)
 
bool isImportTerminating (const fileformat::ImportTable *impTbl, const fileformat::Import *imp) const
 
retdec::loader::ImagegetImage () const
 
auto & getSegments () const
 
retdec::fileformat::FileFormatgetFileFormat () const
 
const retdec::rtti_finder::RttiFindergetRtti () const
 

Private Attributes

llvm::Module * _module = nullptr
 
std::unique_ptr< retdec::loader::Image_image
 
retdec::rtti_finder::RttiFinder _rtti
 

Constructor & Destructor Documentation

◆ FileImage() [1/3]

retdec::bin2llvmir::FileImage::FileImage ( llvm::Module *  m,
const std::string &  path,
Config config 
)

◆ FileImage() [2/3]

retdec::bin2llvmir::FileImage::FileImage ( llvm::Module *  m,
const std::shared_ptr< retdec::fileformat::FileFormat > &  ff,
Config config 
)

◆ FileImage() [3/3]

retdec::bin2llvmir::FileImage::FileImage ( llvm::Module *  m,
std::unique_ptr< retdec::loader::Image img,
Config config 
)

Member Function Documentation

◆ getConstant() [1/2]

llvm::Constant * retdec::bin2llvmir::FileImage::getConstant ( Config config,
DebugFormat dbgf = nullptr,
retdec::common::Address  addr = retdec::common::Address::Undefined 
)

Get constant from the given address addr. The type is unknown. If there is a constant of recognizable type on the address, then constant of this type is created. Otherwise, default integer constant is created. The recognizable types are:

  • ASCII string.
  • ASCII string encoded as wide string.
  • Pointer to global variable.
  • Array of pointers to global variables.
    Parameters
    configConfig associated with module.
    dbgfDebug file.
    addrAddress of the constant in the objf.
    Returns
    Constant on the given address, or nullptr.

◆ getConstant() [2/2]

llvm::Constant * retdec::bin2llvmir::FileImage::getConstant ( llvm::Type *  type,
retdec::common::Address  addr = retdec::common::Address::Undefined,
bool  wideString = false 
)

Get constant of the given type. If objf and addr are specified, constant is initialized with an actual value on the provided address in object file. Otherwise nullptr is returned – it can still be used to construct global variable with undefined value.

Parameters
typeType of the constant.
addrAddress of the constant in the objf.
wideStringIs type a wide string?
Returns
Constant of the given type and data, or nullptr.
Note
Right now, this can create only constants of simple or array types. If unhandled type (e.g. structure, function pointer) is provided, nullptr is returned.

◆ getConstantArray()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantArray ( llvm::ArrayType *  type,
retdec::common::Address  addr 
)

◆ getConstantCharArrayNice()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantCharArrayNice ( retdec::common::Address  addr)

◆ getConstantCharPointer()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantCharPointer ( retdec::common::Address  addr)

◆ getConstantDefault()

llvm::ConstantInt * retdec::bin2llvmir::FileImage::getConstantDefault ( retdec::common::Address  addr)

◆ getConstantDouble()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantDouble ( retdec::common::Address  addr)

◆ getConstantFloat()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantFloat ( retdec::common::Address  addr)

◆ getConstantHalf()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantHalf ( retdec::common::Address  addr)

◆ getConstantInt()

ConstantInt * retdec::bin2llvmir::FileImage::getConstantInt ( llvm::IntegerType *  t,
retdec::common::Address  addr 
)

◆ getConstantLongDouble()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantLongDouble ( retdec::common::Address  addr)

◆ getConstantPointer()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantPointer ( llvm::PointerType *  type,
retdec::common::Address  addr 
)

◆ getConstantStruct()

llvm::Constant * retdec::bin2llvmir::FileImage::getConstantStruct ( llvm::StructType *  type,
retdec::common::Address  addr 
)

◆ getFileFormat()

retdec::fileformat::FileFormat * retdec::bin2llvmir::FileImage::getFileFormat ( ) const

◆ getImage()

retdec::loader::Image * retdec::bin2llvmir::FileImage::getImage ( ) const

◆ getRtti()

const retdec::rtti_finder::RttiFinder & retdec::bin2llvmir::FileImage::getRtti ( ) const

◆ getSegments()

auto& retdec::bin2llvmir::FileImage::getSegments ( ) const
inline

◆ initRtti()

void retdec::bin2llvmir::FileImage::initRtti ( Config config)

◆ isImportTerminating()

bool retdec::bin2llvmir::FileImage::isImportTerminating ( const fileformat::ImportTable impTbl,
const fileformat::Import imp 
) const

Member Data Documentation

◆ _image

std::unique_ptr<retdec::loader::Image> retdec::bin2llvmir::FileImage::_image
private

◆ _module

llvm::Module* retdec::bin2llvmir::FileImage::_module = nullptr
private

◆ _rtti

retdec::rtti_finder::RttiFinder retdec::bin2llvmir::FileImage::_rtti
private

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