retdec
Public Types | Private Attributes | List of all members
retdec::fileformat::Symbol Class Reference

#include <symbol.h>

Inheritance diagram for retdec::fileformat::Symbol:
Inheritance graph
[legend]
Collaboration diagram for retdec::fileformat::Symbol:
Collaboration graph
[legend]

Public Types

enum class  Type {
  UNDEFINED_SYM , PRIVATE , PUBLIC , WEAK ,
  EXTERN , ABSOLUTE_SYM , COMMON
}
 
enum class  UsageType { UNKNOWN , FUNCTION , OBJECT , FILE }
 

Public Member Functions

Type queries
bool isUndefined () const
 
bool isPrivate () const
 
bool isPublic () const
 
bool isWeak () const
 
bool isExtern () const
 
bool isAbsolute () const
 
bool isCommon () const
 
Usage type queries
bool isUnknown () const
 
bool isFunction () const
 
bool isObject () const
 
bool isFile () const
 
Other queries
bool isThumbSymbol () const
 
bool isEven () const
 
bool isOdd () const
 
bool hasEmptyName () const
 
Getters
const std::string & getName () const
 
std::string getNormalizedName () const
 
std::string getOriginalName () const
 
Symbol::Type getType () const
 
Symbol::UsageType getUsageType () const
 
unsigned long long getIndex () const
 
bool getAddress (unsigned long long &virtualAddress) const
 
bool getRealAddress (unsigned long long &virtualAddress) const
 
bool getSize (unsigned long long &symbolSize) const
 
bool getLinkToSection (unsigned long long &sectionIndex) const
 
Setters
void setName (const std::string &symbolName)
 
void setOriginalName (const std::string &symbolOriginalName)
 
void setType (Symbol::Type symbolType)
 
void setUsageType (Symbol::UsageType symbolUsageType)
 
void setIndex (unsigned long long symbolIndex)
 
void setAddress (unsigned long long symbolAddress)
 
void setSize (unsigned long long symbolSize)
 
void setLinkToSection (unsigned long long sectionIndex)
 
void setIsThumbSymbol (bool b)
 
Other methods
void invalidateAddress ()
 
void invalidateSize ()
 
void invalidateLinkToSection ()
 

Private Attributes

std::string name
 symbol name (normalized name) More...
 
std::string originalName
 original name of symbol More...
 
Type type = Type::UNDEFINED_SYM
 symbol type More...
 
UsageType usageType = UsageType::UNKNOWN
 usage of symbol More...
 
unsigned long long index = 0
 symbol index More...
 
unsigned long long address = 0
 virtual address of symbol More...
 
unsigned long long size = 0
 size of symbol More...
 
unsigned long long linkToSection = 0
 link to section More...
 
bool addressIsValid = false
 true if value of virtual address is valid More...
 
bool sizeIsValid = false
 true if size of symbol is valid More...
 
bool linkIsValid = false
 true if link to section is valid More...
 
bool thumbSymbol = false
 true if symbol is THUMB symbol More...
 

Detailed Description

Class for one symbol

Member Enumeration Documentation

◆ Type

Enumerator
UNDEFINED_SYM 

invalid type

PRIVATE 

local

PUBLIC 

public global symbol

WEAK 

weak, may be replaced with another symbol

EXTERN 

expected to be defined in another module

ABSOLUTE_SYM 

not linked to a section

COMMON 

common

◆ UsageType

Enumerator
UNKNOWN 
FUNCTION 
OBJECT 
FILE 

Member Function Documentation

◆ getAddress()

bool retdec::fileformat::Symbol::getAddress ( unsigned long long &  virtualAddress) const

Get symbol virtual address

Parameters
virtualAddressInto this parameter is stored symbol virtual address
Returns
true if symbol virtual address is valid, false otherwise

If method returns false, virtualAddress is left unchanged

◆ getIndex()

unsigned long long retdec::fileformat::Symbol::getIndex ( ) const

Get symbol index

Returns
Symbol index

◆ getLinkToSection()

bool retdec::fileformat::Symbol::getLinkToSection ( unsigned long long &  sectionIndex) const

Get link to associated section

Parameters
sectionIndexParameter for store the result
Returns
true if symbol is associated with one of the sections, false otherwise

If method returns false, sectionIndex is left unchanged

◆ getName()

const std::string & retdec::fileformat::Symbol::getName ( ) const

Get symbol name

Returns
Symbol name

◆ getNormalizedName()

std::string retdec::fileformat::Symbol::getNormalizedName ( ) const

Get normalized symbol name

Returns
Normalized symbol name

◆ getOriginalName()

std::string retdec::fileformat::Symbol::getOriginalName ( ) const

Get original name

Returns
Original name of symbol

◆ getRealAddress()

bool retdec::fileformat::Symbol::getRealAddress ( unsigned long long &  virtualAddress) const

Get real symbol virtual address – if symbol is not THUMB, return result of getAddress(). If symbol is THUMB, return result of getAddress() decremented by one.

Parameters
virtualAddressInto this parameter is stored symbol virtual address
Returns
true if symbol virtual address is valid, false otherwise

◆ getSize()

bool retdec::fileformat::Symbol::getSize ( unsigned long long &  symbolSize) const

Get size of symbol

Parameters
symbolSizeInto this parameter is stored size of symbol
Returns
true if symbol size is known and valid, false otherwise

If method returns false, symbolSize is left unchanged

◆ getType()

Symbol::Type retdec::fileformat::Symbol::getType ( ) const

Get symbol type

Returns
Symbol type

◆ getUsageType()

Symbol::UsageType retdec::fileformat::Symbol::getUsageType ( ) const

Get symbol usage type

Returns
Symbol usage type

◆ hasEmptyName()

bool retdec::fileformat::Symbol::hasEmptyName ( ) const
Returns
true if symbol has empty name, false otherwise

◆ invalidateAddress()

void retdec::fileformat::Symbol::invalidateAddress ( )

Invalidate virtual address of symbol

Instance method getAddress() returns false after invocation of this method. Virtual address is possible to revalidate by invocation of method setAddress().

◆ invalidateLinkToSection()

void retdec::fileformat::Symbol::invalidateLinkToSection ( )

Invalidate link to section

Instance method getLinkToSection() returns false after invocation of this method. Link to section is possible to revalidate by invocation of method setLinkToSection().

◆ invalidateSize()

void retdec::fileformat::Symbol::invalidateSize ( )

Invalidate size of symbol

Instance method getSize() returns false after invocation of this method. Size of symbol is possible to revalidate by invocation of method setSize().

◆ isAbsolute()

bool retdec::fileformat::Symbol::isAbsolute ( ) const
Returns
true if symbol is absolute, false otherwise

◆ isCommon()

bool retdec::fileformat::Symbol::isCommon ( ) const
Returns
true if symbol is common, false otherwise

◆ isEven()

bool retdec::fileformat::Symbol::isEven ( ) const
Returns
true if symbol's address is valid and even, false otherwise

◆ isExtern()

bool retdec::fileformat::Symbol::isExtern ( ) const
Returns
true if symbol is extern, false otherwise

◆ isFile()

bool retdec::fileformat::Symbol::isFile ( ) const
Returns
true if symbol is file, false otherwise

◆ isFunction()

bool retdec::fileformat::Symbol::isFunction ( ) const
Returns
true if symbol is function, false otherwise

◆ isObject()

bool retdec::fileformat::Symbol::isObject ( ) const
Returns
true if symbol is object, false otherwise

◆ isOdd()

bool retdec::fileformat::Symbol::isOdd ( ) const
Returns
true if symbol's address is valid and odd, false otherwise

◆ isPrivate()

bool retdec::fileformat::Symbol::isPrivate ( ) const
Returns
true if symbol is private, false otherwise

◆ isPublic()

bool retdec::fileformat::Symbol::isPublic ( ) const
Returns
true if symbol is public, false otherwise

◆ isThumbSymbol()

bool retdec::fileformat::Symbol::isThumbSymbol ( ) const
Returns
true if symbol is THUMB symbol, false otherwise

◆ isUndefined()

bool retdec::fileformat::Symbol::isUndefined ( ) const
Returns
true if symbol is undefined, false otherwise

◆ isUnknown()

bool retdec::fileformat::Symbol::isUnknown ( ) const
Returns
true if symbol is unkown, false otherwise

◆ isWeak()

bool retdec::fileformat::Symbol::isWeak ( ) const
Returns
true if symbol is weak, false otherwise

◆ setAddress()

void retdec::fileformat::Symbol::setAddress ( unsigned long long  symbolAddress)

Set symbol virtual address

Parameters
symbolAddressSymbol virtual address

◆ setIndex()

void retdec::fileformat::Symbol::setIndex ( unsigned long long  symbolIndex)

Set symbol index

Parameters
symbolIndexIndex of symbol in symbol table

◆ setIsThumbSymbol()

void retdec::fileformat::Symbol::setIsThumbSymbol ( bool  b)

Set is THUMB symbol flag

Parameters
bValue of is THUMB symbol flag to set

◆ setLinkToSection()

void retdec::fileformat::Symbol::setLinkToSection ( unsigned long long  sectionIndex)

Set link to associated section

Parameters
sectionIndexLink to associated section

◆ setName()

void retdec::fileformat::Symbol::setName ( const std::string &  symbolName)

Set symbol name

Parameters
symbolNameSymbol name

◆ setOriginalName()

void retdec::fileformat::Symbol::setOriginalName ( const std::string &  symbolOriginalName)

Set original name of symbol

Parameters
symbolOriginalNameOriginal name of symbol

◆ setSize()

void retdec::fileformat::Symbol::setSize ( unsigned long long  symbolSize)

Set symbol size

Parameters
symbolSizeSize of symbol

◆ setType()

void retdec::fileformat::Symbol::setType ( Symbol::Type  symbolType)

Set symbol type

Parameters
symbolTypeSymbol type

◆ setUsageType()

void retdec::fileformat::Symbol::setUsageType ( Symbol::UsageType  symbolUsageType)

Set symbol usage type

Parameters
symbolUsageTypeSymbol usage type

Member Data Documentation

◆ address

unsigned long long retdec::fileformat::Symbol::address = 0
private

virtual address of symbol

◆ addressIsValid

bool retdec::fileformat::Symbol::addressIsValid = false
private

true if value of virtual address is valid

◆ index

unsigned long long retdec::fileformat::Symbol::index = 0
private

symbol index

◆ linkIsValid

bool retdec::fileformat::Symbol::linkIsValid = false
private

true if link to section is valid

◆ linkToSection

unsigned long long retdec::fileformat::Symbol::linkToSection = 0
private

link to section

◆ name

std::string retdec::fileformat::Symbol::name
private

symbol name (normalized name)

◆ originalName

std::string retdec::fileformat::Symbol::originalName
private

original name of symbol

◆ size

unsigned long long retdec::fileformat::Symbol::size = 0
private

size of symbol

◆ sizeIsValid

bool retdec::fileformat::Symbol::sizeIsValid = false
private

true if size of symbol is valid

◆ thumbSymbol

bool retdec::fileformat::Symbol::thumbSymbol = false
private

true if symbol is THUMB symbol

◆ type

Type retdec::fileformat::Symbol::type = Type::UNDEFINED_SYM
private

symbol type

◆ usageType

UsageType retdec::fileformat::Symbol::usageType = UsageType::UNKNOWN
private

usage of symbol


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