16#ifndef LIEF_COFF_SYMBOL_H
17#define LIEF_COFF_SYMBOL_H
47 static std::unique_ptr<Symbol>
parse(
213 return auxiliary_symbols_;
217 return auxiliary_symbols_;
222 const std::string&
name()
const override;
245 storage_class_ =
value;
270 static std::unique_ptr<Symbol> parse_impl(
272 String* coff_name_ =
nullptr;
274 uint8_t storage_class_ = 0;
275 int16_t section_idx_ = 0;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
Class that represents an auxiliary symbol.
Definition AuxiliarySymbol.hpp:36
Definition COFF/Parser.hpp:34
This class represents a COFF section.
Definition COFF/Section.hpp:39
This class represents a string located in the COFF string table.
Definition String.hpp:33
uint16_t type() const
The symbol type. The first byte represents the base type (see: base_type()) while the upper byte repr...
Definition COFF/Symbol.hpp:137
bool is_absolute() const
Definition COFF/Symbol.hpp:190
const std::string & name() const override
Name of the symbol. If the symbol does not use a short name, it returns the string pointed by the COF...
COMPLEX_TYPE
Definition COFF/Symbol.hpp:122
@ TY_ARRAY
An array of base type.
Definition COFF/Symbol.hpp:126
@ TY_POINTER
A pointer to base type.
Definition COFF/Symbol.hpp:124
@ TY_FUNCTION
A function that returns a base type.
Definition COFF/Symbol.hpp:125
Symbol & storage_class(uint8_t value)
Definition COFF/Symbol.hpp:244
const Section * section() const
Definition COFF/Symbol.hpp:178
COMPLEX_TYPE complex_type() const
The complex type (if any).
Definition COFF/Symbol.hpp:153
bool is_function_line_info() const
Definition COFF/Symbol.hpp:199
Symbol & section_idx(int16_t idx)
Definition COFF/Symbol.hpp:249
bool is_file_record() const
Definition COFF/Symbol.hpp:207
Section * section()
Section associated with this symbol (if any).
Definition COFF/Symbol.hpp:174
bool is_function() const
Definition COFF/Symbol.hpp:203
BASE_TYPE base_type() const
The simple (base) data type.
Definition COFF/Symbol.hpp:148
std::vector< std::unique_ptr< AuxiliarySymbol > > auxiliary_symbols_t
Definition COFF/Symbol.hpp:39
bool is_external() const
Definition COFF/Symbol.hpp:182
const_ref_iterator< const auxiliary_symbols_t &, AuxiliarySymbol * > it_const_auxiliary_symbols_t
Definition COFF/Symbol.hpp:41
BASE_TYPE
Definition COFF/Symbol.hpp:103
@ TY_NULL
No type information or unknown base type.
Definition COFF/Symbol.hpp:104
@ TY_UINT
An unsigned integer of natural size.
Definition COFF/Symbol.hpp:118
@ TY_MOE
A member of enumeration (a specific value).
Definition COFF/Symbol.hpp:115
@ TY_ENUM
An enumerated type.
Definition COFF/Symbol.hpp:114
@ TY_WORD
A word; unsigned 2-byte integer.
Definition COFF/Symbol.hpp:117
@ TY_LONG
A 4-byte signed integer.
Definition COFF/Symbol.hpp:109
@ TY_VOID
Used with void pointers and functions.
Definition COFF/Symbol.hpp:105
@ TY_UNION
An union.
Definition COFF/Symbol.hpp:113
@ TY_DWORD
An unsigned 4-byte integer.
Definition COFF/Symbol.hpp:119
@ TY_INT
A natural integer type on the target.
Definition COFF/Symbol.hpp:108
@ TY_STRUCT
A structure.
Definition COFF/Symbol.hpp:112
@ TY_BYTE
A byte; unsigned 1-byte integer.
Definition COFF/Symbol.hpp:116
@ TY_CHAR
A character (signed byte).
Definition COFF/Symbol.hpp:106
@ TY_SHORT
A 2-byte signed integer.
Definition COFF/Symbol.hpp:107
@ TY_FLOAT
A 4-byte floating-point number.
Definition COFF/Symbol.hpp:110
@ TY_DOUBLE
An 8-byte floating-point number.
Definition COFF/Symbol.hpp:111
STORAGE_CLASS
Reference: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#storage-class.
Definition COFF/Symbol.hpp:71
@ AUTOMATIC
Stack variable.
Definition COFF/Symbol.hpp:76
@ EXTERNAL_DEF
External definition.
Definition COFF/Symbol.hpp:80
@ TYPE_DEFINITION
Type definition.
Definition COFF/Symbol.hpp:88
@ EXTERNAL
External symbol.
Definition COFF/Symbol.hpp:77
@ ENUM_TAG
Enumeration tag.
Definition COFF/Symbol.hpp:90
@ SECTION
Definition COFF/Symbol.hpp:98
@ BLOCK
Definition COFF/Symbol.hpp:94
@ END_OF_STRUCT
End of structure.
Definition COFF/Symbol.hpp:96
@ FUNCTION
Definition COFF/Symbol.hpp:95
@ LABEL
Label.
Definition COFF/Symbol.hpp:81
@ MEMBER_OF_UNION
Member of union.
Definition COFF/Symbol.hpp:86
@ UNDEFINED_LABEL
Undefined label.
Definition COFF/Symbol.hpp:82
@ ARGUMENT
Function argument.
Definition COFF/Symbol.hpp:84
@ WEAK_EXTERNAL
Duplicate tag.
Definition COFF/Symbol.hpp:99
@ UNDEFINED_STATIC
Undefined static.
Definition COFF/Symbol.hpp:89
@ FILE
File name.
Definition COFF/Symbol.hpp:97
@ MEMBER_OF_ENUM
Member of enumeration.
Definition COFF/Symbol.hpp:91
@ REGISTER_PARAM
Register parameter.
Definition COFF/Symbol.hpp:92
@ END_OF_FUNCTION
Physical end of function.
Definition COFF/Symbol.hpp:74
@ STRUCT_TAG
Structure tag.
Definition COFF/Symbol.hpp:85
@ NONE
No symbol.
Definition COFF/Symbol.hpp:75
@ BIT_FIELD
Bit field.
Definition COFF/Symbol.hpp:93
@ UNION_TAG
Union tag.
Definition COFF/Symbol.hpp:87
@ INVALID
Definition COFF/Symbol.hpp:72
@ REGISTER
Register variable.
Definition COFF/Symbol.hpp:79
@ CLR_TOKEN
Definition COFF/Symbol.hpp:100
@ MEMBER_OF_STRUCT
Member of structure.
Definition COFF/Symbol.hpp:83
@ STATIC
Static.
Definition COFF/Symbol.hpp:78
Symbol & type(uint16_t ty)
Definition COFF/Symbol.hpp:239
static constexpr auto SYM_SEC_IDX_ABS
The symbol has an absolute (non-relocatable) value and is not an address.
Definition COFF/Symbol.hpp:62
static constexpr auto SYM_SEC_IDX_DEBUG
The symbol provides general type or debugging information but does not correspond to a section....
Definition COFF/Symbol.hpp:60
const String * coff_name() const
COFF string used to represents the (long) symbol name.
Definition COFF/Symbol.hpp:227
it_auxiliary_symbols_t auxiliary_symbols()
Auxiliary symbols associated with this symbol.
Definition COFF/Symbol.hpp:212
static constexpr auto SYM_SEC_IDX_UNDEF
The symbol record is not yet assigned a section. A value of zero indicates that a reference to an ext...
Definition COFF/Symbol.hpp:66
std::string to_string() const
String * coff_name()
Definition COFF/Symbol.hpp:231
static std::unique_ptr< Symbol > parse(parsing_context_t &ctx, BinaryStream &stream, size_t *idx)
int16_t section_idx() const
The signed integer that identifies the section, using a one-based index into the section table....
Definition COFF/Symbol.hpp:169
std::string & name() override
friend class Parser
Definition COFF/Symbol.hpp:37
static constexpr bool is_reversed_sec_idx(int16_t idx)
Check if the given section index is a reserved value.
Definition COFF/Symbol.hpp:130
bool is_undefined() const
Definition COFF/Symbol.hpp:194
ref_iterator< auxiliary_symbols_t &, AuxiliarySymbol * > it_auxiliary_symbols_t
Definition COFF/Symbol.hpp:40
AuxiliarySymbol & add_aux(std::unique_ptr< AuxiliarySymbol > sym)
Add a new auxiliary record.
bool is_weak_external() const
Definition COFF/Symbol.hpp:186
Symbol & operator=(Symbol &&)
it_const_auxiliary_symbols_t auxiliary_symbols() const
Definition COFF/Symbol.hpp:216
Symbol & operator=(const Symbol &)
std::string demangled_name() const
Demangled representation of the symbol or an empty string if it can't be demangled.
static constexpr auto SYM_COMPLEX_TYPE_SHIFT
Definition COFF/Symbol.hpp:68
STORAGE_CLASS storage_class() const
Storage class of the symbol which indicates what kind of definition a symbol represents.
Definition COFF/Symbol.hpp:143
friend std::ostream & operator<<(std::ostream &os, const Symbol &entry)
Definition COFF/Symbol.hpp:260
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:28
virtual uint64_t value() const
Definition Abstract/Symbol.hpp:68
Iterator which returns reference on container's values.
Definition iterators.hpp:46
Definition AuxiliarySymbol.hpp:29
const char * to_string(AuxiliarySectionDefinition::COMDAT_SELECTION e)
LIEF namespace.
Definition Abstract/Binary.hpp:40
ref_iterator< CT, U, typename decay_t< CT >::const_iterator > const_ref_iterator
Iterator which return const ref on container's values.
Definition iterators.hpp:257
Definition COFF/Symbol.hpp:43
bool is_bigobj
Definition COFF/Symbol.hpp:45
std::function< String *(uint32_t)> find_string
Definition COFF/Symbol.hpp:44
#define LIEF_API
Definition visibility.h:41