LIEF: Library to Instrument Executable Formats Version 0.17.0
|
This class represents a COFF section. More...
#include <Section.hpp>
Classes | |
struct | ComdatInfo |
This structure wraps comdat information which is composed of the symbol associated with the comdat section and its selection flag. More... | |
Public Types | |
using | COMDAT_SELECTION = AuxiliarySectionDefinition::COMDAT_SELECTION |
using | CHARACTERISTICS = LIEF::PE::Section::CHARACTERISTICS |
Mirror Characteristics from PE. | |
using | relocations_t = std::vector<Relocation*> |
Container for the relocations in this section (owned by the Binary object) | |
using | it_relocations = ref_iterator<relocations_t&, Relocation*> |
Iterator that outputs Relocation&. | |
using | it_const_relocations = const_ref_iterator<const relocations_t&, const Relocation*> |
Iterator that outputs const Relocation&. | |
using | symbols_t = std::vector<Symbol*> |
Container for the symbols associated with this section (owned by the Binary object) | |
using | it_symbols = ref_iterator<symbols_t&, Symbol*> |
Iterator that outputs Symbol&. | |
using | it_const_symbols = const_ref_iterator<const symbols_t&, const Symbol*> |
Iterator that outputs const Symbol&. | |
![]() | |
template<class T > | |
using | output_t = add_pointer_t<decay_t<T>> |
template<class T > | |
using | output_const_t = add_pointer_t<add_const_t<decay_t<T>>> |
Public Member Functions | |
uint32_t | sizeof_raw_data () const |
Return the size of the data in the section. | |
uint32_t | virtual_size () const |
Virtual size of the section (should be 0) | |
span< const uint8_t > | content () const override |
Content wrapped by this section. | |
uint32_t | pointerto_raw_data () const |
Offset to the section's content. | |
uint32_t | pointerto_relocation () const |
Offset to the relocation table. | |
uint32_t | pointerto_line_numbers () const |
The file pointer to the beginning of line-number entries for the section. | |
uint16_t | numberof_relocations () const |
Number of relocations. | |
uint16_t | numberof_line_numbers () const |
Number of line number entries (if any). | |
uint32_t | characteristics () const |
Characteristics of the section: it provides information about the permissions of the section when mapped. It can also provide information about the purpose of the section (contain code, BSS-like, ...) | |
bool | has_characteristic (CHARACTERISTICS c) const |
Check if the section has the given CHARACTERISTICS. | |
std::vector< CHARACTERISTICS > | characteristics_list () const |
List of the section characteristics. | |
bool | is_discardable () const |
True if the section can be discarded as needed. | |
void | clear (uint8_t c) |
it_relocations | relocations () |
Iterator over the relocations associated with this section. | |
it_const_relocations | relocations () const |
it_symbols | symbols () |
Iterator over the symbols associated with this section. | |
it_const_symbols | symbols () const |
optional< ComdatInfo > | comdat_info () const |
Return comdat infomration (only if the section has the CHARACTERISTICS::LNK_COMDAT characteristic) | |
bool | has_extended_relocations () const |
Whether there is a large number of relocations whose number need to be stored in the virtual address attribute. | |
void | content (const std::vector< uint8_t > &data) override |
Change section content. | |
void | name (std::string name) override |
Change the section's name. | |
void | virtual_size (uint32_t virtual_sz) |
void | pointerto_raw_data (uint32_t ptr) |
void | pointerto_relocation (uint32_t ptr) |
void | pointerto_line_numbers (uint32_t ptr) |
void | numberof_relocations (uint16_t nb) |
void | numberof_line_numbers (uint16_t nb) |
void | sizeof_raw_data (uint32_t size) |
void | characteristics (uint32_t characteristics) |
std::string | to_string () const |
~Section () override=default | |
virtual std::string | name () const |
section's name | |
![]() | |
Section ()=default | |
Section (std::string name) | |
~Section () override=default | |
Section & | operator= (const Section &)=default |
Section (const Section &)=default | |
virtual const std::string & | fullname () const |
Return the complete section's name which might trailing (0 ) bytes. | |
virtual void | size (uint64_t size) |
Change the section size. | |
virtual uint64_t | size () const |
section's size (size in the binary, not the virtual size) | |
virtual uint64_t | offset () const |
Offset in the binary. | |
virtual uint64_t | virtual_address () const |
Address where the section should be mapped. | |
virtual void | virtual_address (uint64_t virtual_address) |
virtual void | offset (uint64_t offset) |
double | entropy () const |
Section's entropy. | |
size_t | search (uint64_t integer, size_t pos, size_t size) const |
size_t | search (const std::vector< uint8_t > &pattern, size_t pos=0) const |
size_t | search (const std::string &pattern, size_t pos=0) const |
size_t | search (uint64_t integer, size_t pos=0) const |
std::vector< size_t > | search_all (uint64_t v, size_t size) const |
std::vector< size_t > | search_all (uint64_t v) const |
std::vector< size_t > | search_all (const std::string &v) const |
void | accept (Visitor &visitor) const override |
Method so that the visitor can visit us. | |
![]() | |
Object () | |
Object (const Object &other) | |
Object & | operator= (const Object &other) |
template<class T > | |
output_t< T > | as () |
template<class T > | |
output_const_t< T > | as () const |
virtual bool | operator== (const Object &other) const |
virtual bool | operator!= (const Object &other) const |
virtual | ~Object () |
Static Public Member Functions | |
static std::unique_ptr< Section > | parse (BinaryStream &stream) |
Parse a section from the given stream. | |
Additional Inherited Members | |
![]() | |
static constexpr size_t | npos = -1 |
This class represents a COFF section.
Mirror Characteristics from PE.
using LIEF::COFF::Section::it_const_relocations = const_ref_iterator<const relocations_t&, const Relocation*> |
Iterator that outputs const Relocation&.
using LIEF::COFF::Section::it_const_symbols = const_ref_iterator<const symbols_t&, const Symbol*> |
Iterator that outputs const Symbol&.
Iterator that outputs Relocation&.
using LIEF::COFF::Section::it_symbols = ref_iterator<symbols_t&, Symbol*> |
Iterator that outputs Symbol&.
using LIEF::COFF::Section::relocations_t = std::vector<Relocation*> |
Container for the relocations in this section (owned by the Binary object)
using LIEF::COFF::Section::symbols_t = std::vector<Symbol*> |
Container for the symbols associated with this section (owned by the Binary object)
|
overridedefault |
|
inline |
Characteristics of the section: it provides information about the permissions of the section when mapped. It can also provide information about the purpose of the section (contain code, BSS-like, ...)
|
inline |
|
inline |
List of the section characteristics.
References LIEF::PE::Section::characteristics_to_list().
|
inline |
optional< ComdatInfo > LIEF::COFF::Section::comdat_info | ( | ) | const |
Return comdat infomration (only if the section has the CHARACTERISTICS::LNK_COMDAT characteristic)
|
inlineoverridevirtual |
Content wrapped by this section.
Reimplemented from LIEF::Section.
|
inlineoverridevirtual |
Change section content.
Reimplemented from LIEF::Section.
|
inline |
Check if the section has the given CHARACTERISTICS.
|
inline |
Whether there is a large number of relocations whose number need to be stored in the virtual address attribute.
|
inline |
True if the section can be discarded as needed.
This is typically the case for debug-related sections
|
inlinevirtual |
section's name
Reimplemented from LIEF::Section.
|
overridevirtual |
Change the section's name.
Reimplemented from LIEF::Section.
|
inline |
Number of line number entries (if any).
|
inline |
|
inline |
Number of relocations.
|
inline |
|
static |
Parse a section from the given stream.
|
inline |
|
inline |
|
inline |
Offset to the section's content.
|
inline |
|
inline |
Offset to the relocation table.
|
inline |
|
inline |
Iterator over the relocations associated with this section.
|
inline |
|
inline |
Return the size of the data in the section.
|
inline |
|
inline |
Iterator over the symbols associated with this section.
|
inline |
std::string LIEF::COFF::Section::to_string | ( | ) | const |
Referenced by operator<<.
|
inline |
Virtual size of the section (should be 0)
|
inline |