16#ifndef LIEF_PE_RUNTIME_FUNCTION_X64_H
17#define LIEF_PE_RUNTIME_FUNCTION_X64_H
45 LIEF_LOCAL static std::unique_ptr<RuntimeFunctionX64>
55 EXCEPTION_HANDLER = 1,
58 TERMINATE_HANDLER = 2,
156 using opcodes_t = std::vector<std::unique_ptr<unwind_x64::Code>>;
198 return (
flags & (
int)flag) != 0;
209 os << info.to_string();
225 std::unique_ptr<ExceptionInfo>
clone()
const override {
248 return unwind_info_.has_value() ? &*unwind_info_ :
nullptr;
252 return unwind_info_.has_value() ? &*unwind_info_ :
nullptr;
256 unwind_info_ = std::move(info);
266 uint32_t rva_end_ = 0;
267 uint32_t unwind_rva_ = 0;
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
uint32_t rva_start() const
Function start address.
Definition ExceptionInfo.hpp:69
ARCH
Arch discriminator for the subclasses.
Definition ExceptionInfo.hpp:50
@ X86_64
Definition ExceptionInfo.hpp:53
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:52
std::string to_string() const override
UNWIND_REG
Definition RuntimeFunctionX64.hpp:133
void unwind_info(unwind_info_t info)
Definition RuntimeFunctionX64.hpp:255
const unwind_info_t * unwind_info() const
Detailed unwind information.
Definition RuntimeFunctionX64.hpp:247
UNWIND_OPCODES
Definition RuntimeFunctionX64.hpp:64
~RuntimeFunctionX64()=default
RuntimeFunctionX64(RuntimeFunctionX64 &&)=default
RuntimeFunctionX64(uint32_t rva_start, uint32_t rva_end, uint32_t unwind_rva)
Definition RuntimeFunctionX64.hpp:214
uint32_t unwind_rva() const
Unwind info address.
Definition RuntimeFunctionX64.hpp:237
RuntimeFunctionX64 & operator=(const RuntimeFunctionX64 &)=default
std::unique_ptr< ExceptionInfo > clone() const override
Definition RuntimeFunctionX64.hpp:225
uint32_t size() const
Size of the function (in bytes).
Definition RuntimeFunctionX64.hpp:242
RuntimeFunctionX64(const RuntimeFunctionX64 &)=default
static bool classof(const ExceptionInfo *info)
Definition RuntimeFunctionX64.hpp:259
UNWIND_FLAGS
Definition RuntimeFunctionX64.hpp:52
unwind_info_t * unwind_info()
Definition RuntimeFunctionX64.hpp:251
uint32_t rva_end() const
Function end address.
Definition RuntimeFunctionX64.hpp:232
RuntimeFunctionX64 & operator=(RuntimeFunctionX64 &&)=default
Base class for all unwind operations.
Definition UnwindCodeX64.hpp:31
Opaque structure that is used by LIEF to avoid writing result<void> f(...). Instead,...
Definition errors.hpp:114
Definition optional.hpp:23
#define ENABLE_BITMASK_OPERATORS(X)
Definition enums.hpp:24
This namespace wraps code related to PE-x64 unwinding code.
Definition RuntimeFunctionX64.hpp:34
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
const char * to_string(CODE_PAGES e)
LIEF namespace.
Definition Abstract/Binary.hpp:40
This structure represents the UNWIND_INFO which records the effects a function has on the stack point...
Definition RuntimeFunctionX64.hpp:155
uint8_t sizeof_prologue
Length of the function prolog in bytes.
Definition RuntimeFunctionX64.hpp:165
uint8_t frame_reg
If nonzero, then the function uses a frame pointer (FP), and this field is the number of the nonvolat...
Definition RuntimeFunctionX64.hpp:176
optional< uint32_t > handler
An image-relative pointer to either the function's language-specific exception or termination handler...
Definition RuntimeFunctionX64.hpp:190
bool has(UNWIND_FLAGS flag) const
Check if the given flag is used.
Definition RuntimeFunctionX64.hpp:197
opcodes_t opcodes() const
Enhanced representation of the unwind code.
uint8_t frame_reg_offset
If the frame register field is nonzero, this field is the scaled offset from RSP that is applied to t...
Definition RuntimeFunctionX64.hpp:180
std::string to_string() const
Pretty representation of this structure as a string.
uint8_t flags
See: UNWIND_FLAGS.
Definition RuntimeFunctionX64.hpp:162
std::vector< std::unique_ptr< unwind_x64::Code > > opcodes_t
Definition RuntimeFunctionX64.hpp:156
std::vector< uint8_t > raw_opcodes
An array of items that explains the effect of the prolog on the nonvolatile registers and RSP.
Definition RuntimeFunctionX64.hpp:184
friend std::ostream & operator<<(std::ostream &os, const unwind_info_t &info)
Definition RuntimeFunctionX64.hpp:207
uint8_t version
Version number of the unwind data, currently 1 or 2.
Definition RuntimeFunctionX64.hpp:159
uint8_t count_opcodes
The number of slots in the unwind codes array. Some unwind codes, for example, UNWIND_OPCODES::SAVE_N...
Definition RuntimeFunctionX64.hpp:170
RuntimeFunctionX64 * chained
If UNWIND_FLAGS::CHAIN_INFO is set, this attributes references the chained runtime function.
Definition RuntimeFunctionX64.hpp:194
#define LIEF_API
Definition visibility.h:43
#define LIEF_LOCAL
Definition visibility.h:44