16#ifndef LIEF_COFF_PARSER_H
17#define LIEF_COFF_PARSER_H
43 static LIEF_API std::unique_ptr<Binary>
44 parse(std::unique_ptr<BinaryStream> stream,
48 static LIEF_API std::unique_ptr<Binary>
54 template<
class PathT, enable_if_path_t<PathT> = 0>
55 static std::unique_ptr<Binary>
58 return parse(file.string(), config);
66 friend bool operator<(SymSec lhs, SymSec rhs) {
67 return lhs.sec_idx < rhs.sec_idx;
70 friend bool operator==(SymSec lhs, SymSec rhs) {
71 return lhs.sec_idx == rhs.sec_idx && lhs.symbol == rhs.symbol;
74 friend bool operator!=(SymSec lhs, SymSec rhs) {
91 Parser(std::unique_ptr<BinaryStream> stream,
const ParserConfig& config,
102 std::unique_ptr<BinaryStream> stream_;
103 std::unique_ptr<Binary> bin_;
106 std::map<uint32_t, size_t> memoize_coff_str_;
107 std::map<size_t, Symbol*> symbol_idx_;
Class that represents a COFF Binary.
Definition COFF/Binary.hpp:46
Class used to configure the COFF parser.
Definition COFF/ParserConfig.hpp:24
static const ParserConfig & default_conf()
Definition COFF/ParserConfig.hpp:26
static std::unique_ptr< Binary > parse(std::unique_ptr< BinaryStream > stream, const ParserConfig &config=ParserConfig::default_conf())
Parse the COFF binary referenced by the stream argument with the given config.
std::vector< SymSec > SymSecMap
<=> std::unordered_multimap<section index, Symbol*>
Definition COFF/Parser.hpp:80
static std::unique_ptr< Binary > parse(const PathT &file, const ParserConfig &config=ParserConfig::default_conf())
Same as parse(std::string_view, const ParserConfig&) but the file is given as a std::filesystem::path...
Definition COFF/Parser.hpp:56
static constexpr size_t MAX_NB_SECTIONS
Definition COFF/Parser.hpp:39
static std::unique_ptr< Binary > parse(std::string_view file, const ParserConfig &config=ParserConfig::default_conf())
Parse the COFF binary pointed by the file argument with the given config.
This class represents a COFF section.
Definition COFF/Section.hpp:41
This class represents a string located in the COFF string table.
Definition String.hpp:35
This class represents a COFF symbol.
Definition COFF/Symbol.hpp:37
Opaque structure that is used by LIEF to avoid writing result<void> f(...). Instead,...
Definition errors.hpp:119
#define LIEF_MAYBE_UNUSED
Definition compiler_attributes.hpp:62
Definition AuxiliarySymbol.hpp:30
#define LIEF_API
Definition visibility.h:45
#define LIEF_LOCAL
Definition visibility.h:46