retdec
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
retdec::common::Function Class Reference

#include <function.h>

Inheritance diagram for retdec::common::Function:
Inheritance graph
[legend]
Collaboration diagram for retdec::common::Function:
Collaboration graph
[legend]

Public Types

enum  eLinkType {
  DECOMPILER_DEFINED = 0 , USER_DEFINED , STATICALLY_LINKED , DYNAMICALLY_LINKED ,
  SYSCALL , IDIOM
}
 
- Public Types inherited from retdec::common::Range< T >
using RangeType = T
 

Public Member Functions

 Function (const std::string &name=std::string())
 
 Function (retdec::common::Address start, retdec::common::Address end, const std::string &name=std::string())
 
bool operator< (const Function &o) const
 
bool operator== (const Function &o) const
 
bool operator!= (const Function &o) const
 
Function query methods.
bool isDecompilerDefined () const
 
bool isUserDefined () const
 
bool isStaticallyLinked () const
 
bool isDynamicallyLinked () const
 
bool isSyscall () const
 
bool isIdiom () const
 
bool isFromDebug () const
 
bool isWrapper () const
 
bool isConstructor () const
 
bool isDestructor () const
 
bool isVirtual () const
 
bool isExported () const
 
bool isVariadic () const
 
bool isThumb () const
 
Function set methods.
void setName (const std::string &n)
 
void setRealName (const std::string &n)
 
void setDemangledName (const std::string &n)
 
void setComment (const std::string &c)
 
void addComment (const std::string &c)
 
void setDeclarationString (const std::string &s)
 
void setSourceFileName (const std::string &n)
 
void setWrappedFunctionName (const std::string &n)
 
void setStartLine (const retdec::common::Address &l)
 
void setEndLine (const retdec::common::Address &l)
 
void setIsDecompilerDefined ()
 
void setIsUserDefined ()
 
void setIsStaticallyLinked () const
 
void setIsDynamicallyLinked () const
 
void setIsSyscall ()
 
void setIsIdiom ()
 
void setIsFromDebug (bool d)
 
void setIsConstructor (bool f)
 
void setIsDestructor (bool f)
 
void setIsVirtual (bool f)
 
void setIsExported (bool f)
 
void setIsVariadic (bool f)
 
void setIsThumb (bool f)
 
void setLinkType (eLinkType lt)
 
Function get methods.
const std::string & getId () const
 
const std::string & getName () const
 
const std::string & getRealName () const
 
std::string getDemangledName () const
 
std::string getComment () const
 
std::string getDeclarationString () const
 
std::string getSourceFileName () const
 
std::string getWrappedFunctionName () const
 
LineNumber getStartLine () const
 
LineNumber getEndLine () const
 
eLinkType getLinkType () const
 
- Public Member Functions inherited from retdec::common::Range< T >
 Range ()
 
 Range (const RangeType &start, const RangeType &end)
 
 Range (const Range< RangeType > &range)
 
 Range (Range< RangeType > &&range) noexcept(std::is_nothrow_move_constructible< RangeType >::value)
 
virtual ~Range ()=default
 
Rangeoperator= (const Range< RangeType > &rhs)=default
 
Rangeoperator= (Range< RangeType > &&rhs)=default
 
const RangeTypegetStart () const
 
const RangeTypegetEnd () const
 
void setStart (const RangeType &start)
 
void setEnd (const RangeType &end)
 
void setStartEnd (const RangeType &start, const RangeType &end)
 
RangeType getSize () const
 
bool contains (const RangeType &value) const
 
bool contains (const Range< RangeType > &o) const
 
bool overlaps (const Range< RangeType > &o) const
 
bool operator== (const Range< RangeType > &rhs) const
 
bool operator< (const Range< RangeType > &rhs) const
 
bool operator!= (const Range< RangeType > &rhs) const
 

Public Attributes

common::CallingConvention callingConvention
 
common::Storage returnStorage
 
common::Storage frameBaseStorage
 
common::Type returnType
 
common::ObjectSequentialContainer parameters
 
common::ObjectSetContainer locals
 
std::set< std::string > usedCryptoConstants
 
std::set< common::BasicBlockbasicBlocks
 
std::set< common::AddresscodeReferences
 Addresses of instructions which reference (use) this function. More...
 

Private Attributes

std::string _name
 This is objects unique ID. More...
 
std::string _realName
 
std::string _demangledName
 
std::string _comment
 
std::string _declarationString
 
std::string _sourceFileName
 
std::string _wrapperdFunctionName
 
eLinkType _linkType = DECOMPILER_DEFINED
 
LineNumber _startLine
 
LineNumber _endLine
 
bool _fromDebug = false
 
bool _constructor = false
 
bool _destructor = false
 
bool _virtualFunction = false
 
bool _exported = false
 
bool _variadic = false
 
bool _thumb = false
 

Additional Inherited Members

- Protected Attributes inherited from retdec::common::Range< T >
RangeType _start
 
RangeType _end
 

Detailed Description

Represents function.

Function's name is its unique ID. Function names in config must be the same as in LLVM IR. Function names in IR must be unique, therefore it is safe to demand unique names in config without loss of generality.

Function address is not suitable unique ID. LLVM IR do not know about functions' addresses. Some functions (syscalls) do not have meaningful addresses.

Member Enumeration Documentation

◆ eLinkType

Recognized types of a function that will determine how the decompiler will treat the specified function.

When the type is DECOMPILER_DEFINED the decompiler is allowed to prefer info recieved from some heuristics, instead of info specified in the config.

When the type is USER_DEFINED the info about the function (params, type) specified in a config file will be projected on the decompiler output and the decompiler should not do any heuristcs.

Enumerator
DECOMPILER_DEFINED 
USER_DEFINED 
STATICALLY_LINKED 
DYNAMICALLY_LINKED 
SYSCALL 
IDIOM 

Constructor & Destructor Documentation

◆ Function() [1/2]

retdec::common::Function::Function ( const std::string &  name = std::string())

◆ Function() [2/2]

retdec::common::Function::Function ( retdec::common::Address  start,
retdec::common::Address  end,
const std::string &  name = std::string() 
)

Member Function Documentation

◆ addComment()

void retdec::common::Function::addComment ( const std::string &  c)

◆ getComment()

std::string retdec::common::Function::getComment ( ) const

◆ getDeclarationString()

std::string retdec::common::Function::getDeclarationString ( ) const

◆ getDemangledName()

std::string retdec::common::Function::getDemangledName ( ) const

◆ getEndLine()

LineNumber retdec::common::Function::getEndLine ( ) const

◆ getId()

const std::string & retdec::common::Function::getId ( ) const

◆ getLinkType()

Function::eLinkType retdec::common::Function::getLinkType ( ) const

◆ getName()

const std::string & retdec::common::Function::getName ( ) const

◆ getRealName()

const std::string & retdec::common::Function::getRealName ( ) const

◆ getSourceFileName()

std::string retdec::common::Function::getSourceFileName ( ) const

◆ getStartLine()

LineNumber retdec::common::Function::getStartLine ( ) const

◆ getWrappedFunctionName()

std::string retdec::common::Function::getWrappedFunctionName ( ) const

◆ isConstructor()

bool retdec::common::Function::isConstructor ( ) const

◆ isDecompilerDefined()

bool retdec::common::Function::isDecompilerDefined ( ) const

◆ isDestructor()

bool retdec::common::Function::isDestructor ( ) const

◆ isDynamicallyLinked()

bool retdec::common::Function::isDynamicallyLinked ( ) const

◆ isExported()

bool retdec::common::Function::isExported ( ) const

◆ isFromDebug()

bool retdec::common::Function::isFromDebug ( ) const

◆ isIdiom()

bool retdec::common::Function::isIdiom ( ) const

◆ isStaticallyLinked()

bool retdec::common::Function::isStaticallyLinked ( ) const

◆ isSyscall()

bool retdec::common::Function::isSyscall ( ) const

◆ isThumb()

bool retdec::common::Function::isThumb ( ) const

◆ isUserDefined()

bool retdec::common::Function::isUserDefined ( ) const

◆ isVariadic()

bool retdec::common::Function::isVariadic ( ) const

◆ isVirtual()

bool retdec::common::Function::isVirtual ( ) const

◆ isWrapper()

bool retdec::common::Function::isWrapper ( ) const

Some functions are just wrappers/adapters for other functions. i.e. they just call other function in their body. This member holds name of such called (wrapped) function. If it is empty, then this Function is not wrapper.

◆ operator!=()

bool retdec::common::Function::operator!= ( const Function o) const
Parameters
oOther function.
Returns

◆ operator<()

bool retdec::common::Function::operator< ( const Function o) const
Parameters
oOther function.
Returns

◆ operator==()

bool retdec::common::Function::operator== ( const Function o) const
Parameters
oOther function to compare this instance with.
Returns

◆ setComment()

void retdec::common::Function::setComment ( const std::string &  c)

◆ setDeclarationString()

void retdec::common::Function::setDeclarationString ( const std::string &  s)

◆ setDemangledName()

void retdec::common::Function::setDemangledName ( const std::string &  n)

◆ setEndLine()

void retdec::common::Function::setEndLine ( const retdec::common::Address l)

◆ setIsConstructor()

void retdec::common::Function::setIsConstructor ( bool  f)

◆ setIsDecompilerDefined()

void retdec::common::Function::setIsDecompilerDefined ( )

◆ setIsDestructor()

void retdec::common::Function::setIsDestructor ( bool  f)

◆ setIsDynamicallyLinked()

void retdec::common::Function::setIsDynamicallyLinked ( ) const

◆ setIsExported()

void retdec::common::Function::setIsExported ( bool  f)

◆ setIsFromDebug()

void retdec::common::Function::setIsFromDebug ( bool  d)

◆ setIsIdiom()

void retdec::common::Function::setIsIdiom ( )

◆ setIsStaticallyLinked()

void retdec::common::Function::setIsStaticallyLinked ( ) const

◆ setIsSyscall()

void retdec::common::Function::setIsSyscall ( )

◆ setIsThumb()

void retdec::common::Function::setIsThumb ( bool  f)

◆ setIsUserDefined()

void retdec::common::Function::setIsUserDefined ( )

◆ setIsVariadic()

void retdec::common::Function::setIsVariadic ( bool  f)

◆ setIsVirtual()

void retdec::common::Function::setIsVirtual ( bool  f)

◆ setLinkType()

void retdec::common::Function::setLinkType ( Function::eLinkType  lt)

◆ setName()

void retdec::common::Function::setName ( const std::string &  n)

◆ setRealName()

void retdec::common::Function::setRealName ( const std::string &  n)

◆ setSourceFileName()

void retdec::common::Function::setSourceFileName ( const std::string &  n)

◆ setStartLine()

void retdec::common::Function::setStartLine ( const retdec::common::Address l)

◆ setWrappedFunctionName()

void retdec::common::Function::setWrappedFunctionName ( const std::string &  n)

Member Data Documentation

◆ _comment

std::string retdec::common::Function::_comment
private

◆ _constructor

bool retdec::common::Function::_constructor = false
private

◆ _declarationString

std::string retdec::common::Function::_declarationString
private

◆ _demangledName

std::string retdec::common::Function::_demangledName
private

◆ _destructor

bool retdec::common::Function::_destructor = false
private

◆ _endLine

LineNumber retdec::common::Function::_endLine
private

◆ _exported

bool retdec::common::Function::_exported = false
private

◆ _fromDebug

bool retdec::common::Function::_fromDebug = false
private

◆ _linkType

eLinkType retdec::common::Function::_linkType = DECOMPILER_DEFINED
mutableprivate

◆ _name

std::string retdec::common::Function::_name
private

This is objects unique ID.

◆ _realName

std::string retdec::common::Function::_realName
private

◆ _sourceFileName

std::string retdec::common::Function::_sourceFileName
private

◆ _startLine

LineNumber retdec::common::Function::_startLine
private

◆ _thumb

bool retdec::common::Function::_thumb = false
private

◆ _variadic

bool retdec::common::Function::_variadic = false
private

◆ _virtualFunction

bool retdec::common::Function::_virtualFunction = false
private

◆ _wrapperdFunctionName

std::string retdec::common::Function::_wrapperdFunctionName
private

◆ basicBlocks

std::set<common::BasicBlock> retdec::common::Function::basicBlocks

◆ callingConvention

common::CallingConvention retdec::common::Function::callingConvention

◆ codeReferences

std::set<common::Address> retdec::common::Function::codeReferences

Addresses of instructions which reference (use) this function.

◆ frameBaseStorage

common::Storage retdec::common::Function::frameBaseStorage

◆ locals

common::ObjectSetContainer retdec::common::Function::locals

◆ parameters

common::ObjectSequentialContainer retdec::common::Function::parameters

◆ returnStorage

common::Storage retdec::common::Function::returnStorage

◆ returnType

common::Type retdec::common::Function::returnType

◆ usedCryptoConstants

std::set<std::string> retdec::common::Function::usedCryptoConstants

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