LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_PE_SYMBOLS_H
17#define LIEF_PE_SYMBOLS_H
52 using auxiliary_symbols_t = std::vector<std::unique_ptr<AuxiliarySymbol>>;
53 using it_auxiliary_symbols_t = ref_iterator<auxiliary_symbols_t&, AuxiliarySymbol*>;
54 using it_const_auxiliary_symbols_t = const_ref_iterator<const auxiliary_symbols_t&, AuxiliarySymbol*>;
56 static std::unique_ptr<Symbol>
parse(Parser& ctx, BinaryStream& stream,
size_t* idx);
64 static constexpr auto SYM_SEC_IDX_DEBUG = -2;
static constexpr auto SYM_SEC_IDX_ABS = -1;
static constexpr auto SYM_SEC_IDX_UNDEF = 0;
76 static constexpr auto SYM_COMPLEX_TYPE_SHIFT = 4;
77 enum class STORAGE_CLASS : int32_t {
97 UNDEFINED_STATIC = 14,
111 enum class BASE_TYPE : uint32_t {
130 enum class COMPLEX_TYPE : uint32_t {
141 uint16_t
type()
const {
152 return (STORAGE_CLASS)storage_class_;
157 return (BASE_TYPE)(type_ & 0x0F);
162 return (COMPLEX_TYPE)((type_ & 0xF0) >> SYM_COMPLEX_TYPE_SHIFT);
182 return storage_class() == STORAGE_CLASS::EXTERNAL;
186 return storage_class() == STORAGE_CLASS::WEAK_EXTERNAL;
190 return is_external() && section_idx() == SYM_SEC_IDX_UNDEF &&
195 return storage_class() == STORAGE_CLASS::FUNCTION;
199 return storage_class() == STORAGE_CLASS::FILE;
204 return auxiliary_symbols_;
208 return auxiliary_symbols_;
210 const std::string&
name()
const override;
232 storage_class_ = value;
240 AuxiliarySymbol&
add_aux(std::unique_ptr<AuxiliarySymbol> sym);
244 void accept(Visitor& visitor)
const override;
247 std::ostream&
operator<<(std::ostream& os,
const Symbol& entry);
252 COFFString* coff_name_ =
nullptr;
254 uint8_t storage_class_ = 0;
255 int16_t section_idx_ = 0;
256 auxiliary_symbols_t auxiliary_symbols_;
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
This class represents a string located in the COFF string table.
Definition COFFString.hpp:33
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
Class that represents a PE-COFF symbol.
Definition PE/Symbol.hpp:50
Symbol & storage_class(uint8_t value)
Definition PE/Symbol.hpp:231
it_auxiliary_symbols_t auxiliary_symbols()
Auxiliary symbols associated with this symbol.
Definition PE/Symbol.hpp:203
Symbol & operator=(const Symbol &)
STORAGE_CLASS
Reference: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#storage-class.
Definition PE/Symbol.hpp:79
bool is_undefined() const
Definition PE/Symbol.hpp:189
static constexpr bool is_reversed_sec_idx(int16_t idx)
Check if the given section index is a reserved value.
Definition PE/Symbol.hpp:138
COMPLEX_TYPE
Definition PE/Symbol.hpp:130
Symbol & type(uint16_t ty)
Definition PE/Symbol.hpp:226
static std::unique_ptr< Symbol > parse(Parser &ctx, BinaryStream &stream, size_t *idx)
COMPLEX_TYPE complex_type() const
The complex type (if any)
Definition PE/Symbol.hpp:161
bool is_weak_external() const
Definition PE/Symbol.hpp:185
int16_t section_idx() const
The signed integer that identifies the section, using a one-based index into the section table....
Definition PE/Symbol.hpp:177
bool is_external() const
Definition PE/Symbol.hpp:181
AuxiliarySymbol & add_aux(std::unique_ptr< AuxiliarySymbol > sym)
Add a new auxiliary record.
uint16_t type() const
The symbol type. The first byte represents the base type (see: base_type()) while the upper byte repr...
Definition PE/Symbol.hpp:145
COFFString * coff_name()
Definition PE/Symbol.hpp:222
bool is_function_line_info() const
Definition PE/Symbol.hpp:194
bool is_file_record() const
Definition PE/Symbol.hpp:198
Symbol & section_idx(int16_t idx)
Definition PE/Symbol.hpp:236
BASE_TYPE base_type() const
The simple (base) data type.
Definition PE/Symbol.hpp:156
STORAGE_CLASS storage_class() const
Storage class of the symbol which indicates what kind of definition a symbol represents.
Definition PE/Symbol.hpp:151
std::string & name() override
Symbol & operator=(Symbol &&)
void accept(Visitor &visitor) const override
BASE_TYPE
Definition PE/Symbol.hpp:111
it_const_auxiliary_symbols_t auxiliary_symbols() const
Definition PE/Symbol.hpp:207
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...
friend std::ostream & operator<<(std::ostream &os, const Symbol &entry)
const COFFString * coff_name() const
COFF string used to represents the (long) symbol name.
Definition PE/Symbol.hpp:218
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
const char * to_string(AuxiliaryWeakExternal::CHARACTERISTICS e)
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41