16#ifndef LIEF_MACHO_SYMBOL_H
17#define LIEF_MACHO_SYMBOL_H
21#include "LIEF/visibility.h"
23#include "LIEF/Abstract/Symbol.hpp"
25#include "LIEF/MachO/LoadCommand.hpp"
75 Symbol(
const details::nlist_32& cmd);
76 Symbol(
const details::nlist_64& cmd);
80 void swap(
Symbol& other)
noexcept;
84 uint8_t type()
const {
91 return numberof_sections_;
102 return export_info() !=
nullptr;
117 return binding_info() !=
nullptr;
123 return binding_info_;
127 return binding_info_;
158 void type(uint8_t type) {
161 void numberof_sections(uint8_t nbsections) {
162 numberof_sections_ = nbsections;
164 void description(uint16_t desc) {
168 void accept(Visitor& visitor)
const override;
170 LIEF_API
friend std::ostream& operator<<(std::ostream& os,
const Symbol& symbol);
172 static const Symbol& indirect_abs();
173 static const Symbol& indirect_local();
176 Symbol(CATEGORY cat) :
179 void library(DylibCommand& library) {
180 this->library_ = &library;
184 uint8_t numberof_sections_ = 0;
185 uint16_t description_ = 0;
187 BindingInfo* binding_info_ =
nullptr;
188 ExportInfo* export_info_ =
nullptr;
190 DylibCommand* library_ =
nullptr;
192 ORIGIN origin_ = ORIGIN::UNKNOWN;
193 CATEGORY category_ = CATEGORY::NONE;
Class used to parse a single binary (i.e. non-FAT)
Definition BinaryParser.hpp:73
Class which represents a MachO binary.
Definition MachO/Binary.hpp:73
Class that provides an interface over a binding operation.
Definition BindingInfo.hpp:38
Class which represents a library dependency.
Definition DylibCommand.hpp:34
Class that provides an interface over the Dyld export info.
Definition ExportInfo.hpp:38
Class that represents a Symbol in a Mach-O file.
Definition MachO/Symbol.hpp:47
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 ...
Definition MachO/Symbol.hpp:90
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 ...
Definition MachO/Symbol.hpp:140
CATEGORY
Category of the symbol when the symbol comes from the LC_SYMTAB command. The category is defined acco...
Definition MachO/Symbol.hpp:56
std::string demangled_name() const
Try to demangle the symbol or return an empty string if it is not possible.
ORIGIN
Definition MachO/Symbol.hpp:66
uint16_t description() const
Return information about the symbol (SYMBOL_DESCRIPTIONS)
Definition MachO/Symbol.hpp:95
bool has_export_info() const
True if the symbol is associated with an ExportInfo This value is set when the symbol comes from the ...
Definition MachO/Symbol.hpp:101
ORIGIN origin() const
Return the origin of the symbol: from LC_SYMTAB command or from the Dyld information.
Definition MachO/Symbol.hpp:149
CATEGORY category() const
Category of the symbol according to the LC_DYSYMTAB command.
Definition MachO/Symbol.hpp:154
const ExportInfo * export_info() const
Return the ExportInfo associated with this symbol (or nullptr if not present)
Definition MachO/Symbol.hpp:107
const BindingInfo * binding_info() const
Return the BindingInfo associated with this symbol (or nullptr if not present)
Definition MachO/Symbol.hpp:122
bool has_binding_info() const
True if the symbol is associated with a BindingInfo This value is set when the symbol comes from the ...
Definition MachO/Symbol.hpp:116
This class represents a symbol in an executable format.
Definition Abstract/Symbol.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:32