LIEF: Library to Instrument Executable Formats Version 0.16.0
|
Class that represents a Symbol in a Mach-O file. More...
#include <Symbol.hpp>
Public Types | |
enum class | CATEGORY : uint32_t { NONE = 0 , LOCAL , EXTERNAL , UNDEFINED , INDIRECT_ABS , INDIRECT_LOCAL , INDIRECT_ABS_LOCAL } |
Category of the symbol when the symbol comes from the LC_SYMTAB command. The category is defined according to the LC_DYSYMTAB (DynamicSymbolCommand) command. More... | |
enum class | ORIGIN : uint32_t { UNKNOWN = 0 , DYLD_EXPORT = 1 , DYLD_BIND = 2 , LC_SYMTAB = 3 } |
enum class | TYPE : uint32_t { UNDEFINED = 0x0u , ABSOLUTE_SYM = 0x2u , SECTION = 0xeu , PREBOUND = 0xcu , INDIRECT = 0xau } |
Public Types inherited from LIEF::Object | |
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 | |
Symbol ()=default | |
Symbol (const details::nlist_32 &cmd) | |
Symbol (const details::nlist_64 &cmd) | |
Symbol (uint8_t n_type, uint8_t n_sect, uint8_t n_desc, uint64_t value) | |
Symbol & | operator= (Symbol other) |
Symbol (const Symbol &other) | |
void | swap (Symbol &other) noexcept |
~Symbol () override=default | |
int | library_ordinal () const |
uint8_t | raw_type () const |
Raw value of nlist_xx.n_type | |
TYPE | type () const |
Type as defined by nlist_xx.n_type & N_TYPE | |
uint8_t | numberof_sections () const |
It returns the number of sections in which this symbol can be found. If the symbol can't be found in any section, it returns 0 (NO_SECT) | |
uint16_t | description () const |
Return information about the symbol (SYMBOL_DESCRIPTIONS) | |
bool | has_export_info () const |
True if the symbol is associated with an ExportInfo This value is set when the symbol comes from the Dyld Export trie. | |
const ExportInfo * | export_info () const |
Return the ExportInfo associated with this symbol (or nullptr if not present) | |
ExportInfo * | export_info () |
bool | has_binding_info () const |
True if the symbol is associated with a BindingInfo This value is set when the symbol comes from the Dyld symbol bindings. | |
const BindingInfo * | binding_info () const |
Return the BindingInfo associated with this symbol (or nullptr if not present) | |
BindingInfo * | binding_info () |
std::string | demangled_name () const |
Try to demangle the symbol or return an empty string if it is not possible. | |
bool | is_external () const |
True if the symbol is defined as an external symbol. | |
const DylibCommand * | library () const |
Return the library in which the symbol is defined. It returns a null pointer if the library can't be resolved. | |
DylibCommand * | library () |
ORIGIN | origin () const |
Return the origin of the symbol: from LC_SYMTAB command or from the Dyld information. | |
CATEGORY | category () const |
Category of the symbol according to the LC_DYSYMTAB command. | |
void | raw_type (uint8_t type) |
void | numberof_sections (uint8_t nbsections) |
void | description (uint16_t desc) |
void | accept (Visitor &visitor) const override |
Public Member Functions inherited from LIEF::Symbol | |
Symbol ()=default | |
Symbol (std::string name) | |
Symbol (std::string name, uint64_t value) | |
Symbol (std::string name, uint64_t value, uint64_t size) | |
Symbol (const Symbol &)=default | |
Symbol & | operator= (const Symbol &)=default |
~Symbol () override=default | |
void | swap (Symbol &other) noexcept |
virtual const std::string & | name () const |
Return the symbol's name. | |
virtual std::string & | name () |
virtual void | name (std::string name) |
Set symbol name. | |
virtual uint64_t | value () const |
virtual void | value (uint64_t value) |
virtual uint64_t | size () const |
This size of the symbol (when applicable) | |
virtual void | size (uint64_t value) |
void | accept (Visitor &visitor) const override |
Method so that the visitor can visit us. | |
Public Member Functions inherited from LIEF::Object | |
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 bool | is_valid_index_ordinal (int idx) |
static const Symbol & | indirect_abs () |
static const Symbol & | indirect_local () |
static const Symbol & | indirect_abs_local () |
Static Public Attributes | |
static constexpr int | SELF_LIBRARY_ORD = 0x0 |
static constexpr int | MAIN_EXECUTABLE_ORD = 0xff |
static constexpr int | DYNAMIC_LOOKUP_ORD = 0xfe |
static constexpr uint32_t | TYPE_MASK = 0x0e |
Same as N_TYPE. | |
Class that represents a Symbol in a Mach-O file.
A Mach-O symbol can come from:
|
strong |
Category of the symbol when the symbol comes from the LC_SYMTAB
command. The category is defined according to the LC_DYSYMTAB
(DynamicSymbolCommand) command.
Enumerator | |
---|---|
NONE | |
LOCAL | |
EXTERNAL | |
UNDEFINED | |
INDIRECT_ABS | |
INDIRECT_LOCAL | |
INDIRECT_ABS_LOCAL |
|
strong |
|
strong |
|
default |
LIEF::MachO::Symbol::Symbol | ( | const details::nlist_32 & | cmd | ) |
LIEF::MachO::Symbol::Symbol | ( | const details::nlist_64 & | cmd | ) |
|
inline |
LIEF::MachO::Symbol::Symbol | ( | const Symbol & | other | ) |
|
overridedefault |
|
overridevirtual |
Implements LIEF::Object.
|
inline |
|
inline |
Return the BindingInfo associated with this symbol (or nullptr if not present)
|
inline |
Category of the symbol according to the LC_DYSYMTAB
command.
std::string LIEF::MachO::Symbol::demangled_name | ( | ) | const |
Try to demangle the symbol or return an empty string if it is not possible.
|
inline |
Return information about the symbol (SYMBOL_DESCRIPTIONS)
|
inline |
|
inline |
|
inline |
Return the ExportInfo associated with this symbol (or nullptr if not present)
|
inline |
True if the symbol is associated with a BindingInfo This value is set when the symbol comes from the Dyld symbol bindings.
|
inline |
True if the symbol is associated with an ExportInfo This value is set when the symbol comes from the Dyld Export trie.
|
static |
|
static |
|
static |
|
inline |
True if the symbol is defined as an external symbol.
|
inlinestatic |
|
inline |
|
inline |
Return the library in which the symbol is defined. It returns a null pointer if the library can't be resolved.
|
inline |
|
inline |
It returns the number of sections in which this symbol can be found. If the symbol can't be found in any section, it returns 0 (NO_SECT)
|
inline |
|
inline |
Return the origin of the symbol: from LC_SYMTAB command or from the Dyld information.
|
inline |
Raw value of nlist_xx.n_type
|
inline |
|
noexcept |
|
inline |
Type as defined by nlist_xx.n_type & N_TYPE
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Same as N_TYPE.