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_UNWIND_CODE_X64_H
17#define LIEF_PE_UNWIND_CODE_X64_H
33 using OPCODE = RuntimeFunctionX64::UNWIND_OPCODES;
34 using REG = RuntimeFunctionX64::UNWIND_REG;
35 static std::unique_ptr<Code>
38 create_from(
const RuntimeFunctionX64::unwind_info_t& info, SpanStream& stream);
41 Code(
const Code&) =
default;
49 Code(OPCODE opcode, uint32_t pos) :
85 Alloc(OPCODE op,
size_t pos, uint32_t size) :
89 uint32_t
size()
const {
100 return code->
opcode() == OPCODE::ALLOC_LARGE ||
101 code->
opcode() == OPCODE::ALLOC_SMALL;
112 Code(OPCODE::PUSH_NONVOL, pos),
126 return code->
opcode() == OPCODE::PUSH_NONVOL;
138 Code(OPCODE::PUSH_MACHFRAME, pos),
141 uint8_t
value()
const {
152 return code->
opcode() == OPCODE::PUSH_MACHFRAME;
165 Code(OPCODE::SET_FPREG, pos),
179 return code->
opcode() == OPCODE::SET_FPREG;
210 return code->
opcode() == OPCODE::SAVE_NONVOL ||
211 code->
opcode() == OPCODE::SAVE_NONVOL_FAR;
216 uint32_t offset_ = 0;
222 SaveXMM128(OPCODE op, uint8_t num,
size_t pos, uint32_t offset) :
241 return code->
opcode() == OPCODE::SAVE_XMM128 ||
242 code->
opcode() == OPCODE::SAVE_XMM128_FAR;
247 uint32_t offset_ = 0;
256 Code(OPCODE::EPILOG, 0),
264 uint32_t
size()
const {
275 return code->
opcode() == OPCODE::EPILOG;
286 Code(OPCODE::SPARE, 0)
296 return code->
opcode() == OPCODE::SPARE;
This class represents a stack-allocation operation (UNWIND_OPCODES::ALLOC_SMALL or UNWIND_OPCODES::AL...
Definition UnwindCodeX64.hpp:83
std::string to_string() const override
Pretty representation.
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:99
Alloc(OPCODE op, size_t pos, uint32_t size)
Definition UnwindCodeX64.hpp:85
~Alloc() override=default
uint32_t size() const
The size allocated.
Definition UnwindCodeX64.hpp:91
Base class for all unwind operations.
Definition UnwindCodeX64.hpp:31
OPCODE opcode() const
The original opcode.
Definition UnwindCodeX64.hpp:59
Code & operator=(const Code &)=default
Code & operator=(Code &&)=default
friend std::ostream & operator<<(std::ostream &os, const Code &code)
Definition UnwindCodeX64.hpp:71
Code(OPCODE opcode, uint32_t pos)
Definition UnwindCodeX64.hpp:49
uint32_t position() const
Offset in the prolog.
Definition UnwindCodeX64.hpp:64
Code(OPCODE opcode)
Definition UnwindCodeX64.hpp:54
Code(const Code &)=default
virtual std::string to_string() const
Pretty representation.
Describes the function's epilog.
Definition UnwindCodeX64.hpp:251
uint32_t size() const
Size of the epilog.
Definition UnwindCodeX64.hpp:266
std::string to_string() const override
Pretty representation.
Epilog(uint8_t flags, uint8_t size)
Definition UnwindCodeX64.hpp:255
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:274
uint8_t flags() const
Definition UnwindCodeX64.hpp:261
~Epilog() override=default
Push a machine frame.
Definition UnwindCodeX64.hpp:134
std::string to_string() const override
Pretty representation.
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:151
~PushMachFrame() override=default
uint8_t value() const
0 or 1
Definition UnwindCodeX64.hpp:143
PushMachFrame(uint8_t value, size_t pos)
Definition UnwindCodeX64.hpp:137
Push a nonvolatile integer register, decrementing RSP by 8.
Definition UnwindCodeX64.hpp:108
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:125
std::string to_string() const override
Pretty representation.
PushNonVol(REG reg, size_t pos)
Definition UnwindCodeX64.hpp:111
~PushNonVol() override=default
REG reg() const
The register pushed.
Definition UnwindCodeX64.hpp:119
Save a nonvolatile integer register on the stack using a MOV instead of a PUSH.
Definition UnwindCodeX64.hpp:188
~SaveNonVolatile() override=default
REG reg() const
Definition UnwindCodeX64.hpp:197
uint32_t offset() const
Definition UnwindCodeX64.hpp:201
SaveNonVolatile(OPCODE op, REG value, size_t pos, uint32_t offset)
Definition UnwindCodeX64.hpp:191
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:209
std::string to_string() const override
Pretty representation.
Definition UnwindCodeX64.hpp:219
SaveXMM128(OPCODE op, uint8_t num, size_t pos, uint32_t offset)
Definition UnwindCodeX64.hpp:222
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:240
uint32_t offset() const
Definition UnwindCodeX64.hpp:232
uint8_t num() const
Definition UnwindCodeX64.hpp:228
~SaveXMM128() override=default
std::string to_string() const override
Pretty representation.
Establish the frame pointer register by setting the register to some offset of the current RSP.
Definition UnwindCodeX64.hpp:161
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:178
REG reg() const
Frame pointer register.
Definition UnwindCodeX64.hpp:170
SetFPReg(REG value, size_t pos)
Definition UnwindCodeX64.hpp:164
~SetFPReg() override=default
std::string to_string() const override
Pretty representation.
Definition UnwindCodeX64.hpp:283
static bool classof(const Code *code)
Definition UnwindCodeX64.hpp:295
Spare()
Definition UnwindCodeX64.hpp:285
~Spare() override=default
std::string to_string() const override
Pretty representation.
Definition UnwindCodeX64.hpp:289
Definition SpanStream.hpp:32
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
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41