retdec
Public Member Functions | Private Attributes | List of all members
retdec::fileformat::MachOSection Class Reference

#include <macho_section.h>

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

Public Member Functions

 MachOSection ()
 
Getters
std::string getSegmentName () const
 
unsigned long long getAlignment () const
 
unsigned long long getRelocationOffset () const
 
unsigned long long getNumberOfRelocations () const
 
unsigned long long getMachOFlags () const
 
unsigned long long getReserved1 () const
 
unsigned long long getReserved2 () const
 
Setters
void setSegmentName (const std::string &segmentName)
 
void setAlignment (unsigned long long alignment)
 
void setRelocationOffset (unsigned long long offset)
 
void setNumberOfRelocations (unsigned long long number)
 
void setMachOFlags (unsigned long long flags)
 
void setReserved1 (unsigned long long reserved1)
 
void setReserved2 (unsigned long long reserved2)
 
- Public Member Functions inherited from retdec::fileformat::Section
 Section ()
 
- Public Member Functions inherited from retdec::fileformat::SecSeg
virtual ~SecSeg ()=default
 
bool isUndefined () const
 
bool isCode () const
 
bool isData () const
 
bool isCodeAndData () const
 
bool isConstData () const
 
bool isBss () const
 
bool isDebug () const
 
bool isInfo () const
 
bool isSomeData () const
 
bool isSomeCode () const
 
bool isDataOnly () const
 
bool isReadOnly () const
 
virtual bool isValid (const FileFormat *sOwner) const
 
std::string getCrc32 () const
 
std::string getMd5 () const
 
std::string getSha256 () const
 
std::string getName () const
 
const char * getNameAsCStr () const
 
const llvm::StringRef getBytes (unsigned long long sOffset=0, unsigned long long sSize=0) const
 
SecSeg::Type getType () const
 
unsigned long long getIndex () const
 
unsigned long long getOffset () const
 
unsigned long long getEndOffset () const
 
unsigned long long getSizeInFile () const
 
unsigned long long getLoadedSize () const
 
unsigned long long getAddress () const
 
unsigned long long getEndAddress () const
 
bool getSizeInMemory (unsigned long long &sMemorySize) const
 
bool getSizeOfOneEntry (unsigned long long &sEntrySize) const
 
bool getMemory () const
 
bool getEntropy (double &res) const
 
template<typename NumberType >
NumberType getBytesAtOffsetAsNumber (unsigned long long sOffset) const
 
bool getBits (std::string &sResult) const
 
bool getBytes (std::vector< unsigned char > &sResult, unsigned long long sOffset=0, unsigned long long sSize=0) const
 
bool getString (std::string &sResult, unsigned long long sOffset=0, unsigned long long sSize=0) const
 
bool getHexBytes (std::string &sResult) const
 
void setName (std::string sName)
 
void setType (SecSeg::Type sType)
 
void setIndex (unsigned long long sIndex)
 
void setOffset (unsigned long long sOffset)
 
void setSizeInFile (unsigned long long sFileSize)
 
void setAddress (unsigned long long sAddress)
 
void setSizeInMemory (unsigned long long sMemorySize)
 
void setSizeOfOneEntry (unsigned long long sEntrySize)
 
void setMemory (bool sMemory)
 
void computeEntropy ()
 
void invalidateMemorySize ()
 
void invalidateEntrySize ()
 
void load (const FileFormat *sOwner)
 
void dump (std::string &sDump) const
 
bool hasCrc32 () const
 
bool hasMd5 () const
 
bool hasSha256 () const
 
bool hasEmptyName () const
 
bool belong (unsigned long long sAddress) const
 
bool operator< (const SecSeg &sOther) const
 

Private Attributes

std::string segname
 Name of the segment this section is placed in. More...
 
unsigned long long align
 Byte alignment as power of two. More...
 
unsigned long long reloff
 File offset of first relocation entry. More...
 
unsigned long long nreloc
 Number of relocations. More...
 
unsigned long long flags
 Mach-O section flags. More...
 
unsigned long long reserved1
 Various interpretations (depends on flags) More...
 
unsigned long long reserved2
 Various interpretations (depends on flags) More...
 

Additional Inherited Members

- Public Types inherited from retdec::fileformat::SecSeg
enum class  Type {
  UNDEFINED_SEC_SEG , CODE , DATA , CODE_DATA ,
  CONST_DATA , BSS , DEBUG , INFO
}
 

Detailed Description

Section in Mach-O file

Constructor & Destructor Documentation

◆ MachOSection()

retdec::fileformat::MachOSection::MachOSection ( )

Member Function Documentation

◆ getAlignment()

unsigned long long retdec::fileformat::MachOSection::getAlignment ( ) const

Get section's byte alignment

Returns
Byte alignment as power of 2

◆ getMachOFlags()

unsigned long long retdec::fileformat::MachOSection::getMachOFlags ( ) const

Get Mach-O flags

Returns
Mach-O flags

◆ getNumberOfRelocations()

unsigned long long retdec::fileformat::MachOSection::getNumberOfRelocations ( ) const

Get number of relocations

Returns
Number of relocations

◆ getRelocationOffset()

unsigned long long retdec::fileformat::MachOSection::getRelocationOffset ( ) const

Get offset of first relocation

Returns
Offset of first relocation

◆ getReserved1()

unsigned long long retdec::fileformat::MachOSection::getReserved1 ( ) const

Get field reserved1

Returns
Field reserved1

◆ getReserved2()

unsigned long long retdec::fileformat::MachOSection::getReserved2 ( ) const

Get field reserved2

Returns
Field reserved2

◆ getSegmentName()

std::string retdec::fileformat::MachOSection::getSegmentName ( ) const

Get name of segment this section is placed in.

Returns
Segment name.

◆ setAlignment()

void retdec::fileformat::MachOSection::setAlignment ( unsigned long long  alignment)

Set section's byte alignment

Parameters
alignmentByte alignment as power of 2

◆ setMachOFlags()

void retdec::fileformat::MachOSection::setMachOFlags ( unsigned long long  flags)

Set Mach-O flags

Parameters
flagsMach-O flags

◆ setNumberOfRelocations()

void retdec::fileformat::MachOSection::setNumberOfRelocations ( unsigned long long  number)

Set number of relocations

Parameters
numberNumber of relocations

◆ setRelocationOffset()

void retdec::fileformat::MachOSection::setRelocationOffset ( unsigned long long  offset)

Set offset of first relocation

Parameters
offsetOffset of first relocation

◆ setReserved1()

void retdec::fileformat::MachOSection::setReserved1 ( unsigned long long  reserved1)

Set reserved1 field

Parameters
reserved1Reserved1 field

◆ setReserved2()

void retdec::fileformat::MachOSection::setReserved2 ( unsigned long long  reserved2)

Set reserved2 field

Parameters
reserved2Reserved2 field

◆ setSegmentName()

void retdec::fileformat::MachOSection::setSegmentName ( const std::string &  segmentName)

Set segment name this section is placed in.

Parameters
segmentNameSegment name.

Member Data Documentation

◆ align

unsigned long long retdec::fileformat::MachOSection::align
private

Byte alignment as power of two.

◆ flags

unsigned long long retdec::fileformat::MachOSection::flags
private

Mach-O section flags.

◆ nreloc

unsigned long long retdec::fileformat::MachOSection::nreloc
private

Number of relocations.

◆ reloff

unsigned long long retdec::fileformat::MachOSection::reloff
private

File offset of first relocation entry.

◆ reserved1

unsigned long long retdec::fileformat::MachOSection::reserved1
private

Various interpretations (depends on flags)

◆ reserved2

unsigned long long retdec::fileformat::MachOSection::reserved2
private

Various interpretations (depends on flags)

◆ segname

std::string retdec::fileformat::MachOSection::segname
private

Name of the segment this section is placed in.


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