15#ifndef LIEF_DWARF_LOCATION_H
16#define LIEF_DWARF_LOCATION_H
35 enum class Type : uint8_t {
72 if (T::classof(
this)) {
73 return static_cast<const T*
>(
this);
AddressLoc(uint64_t value)
Definition Location.hpp:110
static bool classof(const Location *loc)
Definition Location.hpp:114
uint64_t address
Memory address where the value is located.
Definition Location.hpp:121
CompositeLocation(const CompositeLocation &)=delete
static bool classof(const Location *loc)
Definition Location.hpp:239
CompositeLocation & operator=(const CompositeLocation &)=delete
CompositeLocation()
Definition Location.hpp:230
std::vector< Piece > pieces
The pieces of this location, ordered by their bit offset.
Definition Location.hpp:246
~CompositeLocation() override
CompositeLocation(CompositeLocation &&) noexcept=default
std::vector< uint8_t > expression
Raw bytes of the DWARF expression.
Definition Location.hpp:179
std::string description
Textual representation of the expression (e.g. DW_OP_lit0, DW_OP_stack_value).
Definition Location.hpp:183
~ExpressionLoc() override
ExpressionLoc(std::vector< uint8_t > bytes, std::string text)
Definition Location.hpp:167
static bool classof(const Location *loc)
Definition Location.hpp:172
FrameBaseLoc(int64_t value)
Definition Location.hpp:127
int64_t offset
Signed byte offset from the frame base.
Definition Location.hpp:138
static bool classof(const Location *loc)
Definition Location.hpp:131
Location(const Location &)=default
Location & operator=(const Location &)=default
std::string to_string() const
Human-readable description of this location.
Location(Type ty)
Definition Location.hpp:59
Type
Definition Location.hpp:35
@ UNAVAILABLE
The value is not available.
Definition Location.hpp:53
@ FRAME_BASE
The value is at an offset of the frame base.
Definition Location.hpp:44
@ ADDRESS
The value is at a fixed memory address.
Definition Location.hpp:41
@ UNKNOWN
Definition Location.hpp:36
@ COMPOSITE
The value is split in several pieces.
Definition Location.hpp:56
@ REGISTER_OFFSET
The value is at an offset of a register.
Definition Location.hpp:47
@ EXPRESSION
An unevaluated DWARF expression.
Definition Location.hpp:50
@ REG
The value is associated to a register.
Definition Location.hpp:38
Location(Location &&) noexcept=default
Type type
Definition Location.hpp:86
const T * as() const
Definition Location.hpp:71
friend std::ostream & operator<<(std::ostream &os, const Location &loc)
Definition Location.hpp:81
uint64_t id
DWARF id of the register that must be interpreted according to the target architecture.
Definition Location.hpp:104
RegisterLoc(uint64_t reg_id)
Definition Location.hpp:92
static bool classof(const Location *loc)
Definition Location.hpp:96
RegisterOffsetLoc(uint64_t reg_id, int64_t value)
Definition Location.hpp:145
int64_t offset
Signed byte offset added to the register's value.
Definition Location.hpp:160
uint64_t id
DWARF id of the register that contains the base address.
Definition Location.hpp:157
static bool classof(const Location *loc)
Definition Location.hpp:150
~RegisterOffsetLoc() override
~UnavailableLoc() override
UnavailableLoc()
Definition Location.hpp:189
static bool classof(const Location *loc)
Definition Location.hpp:192
#define LIEF_LIFETIMEBOUND
Definition compiler_attributes.hpp:72
Namespace for the DWARF debug format.
Definition DWARF/CompilationUnit.hpp:31
A piece of a composite location.
Definition Location.hpp:207
KIND kind
Whether this piece comes from DW_OP_piece or DW_OP_bit_piece.
Definition Location.hpp:214
std::optional< uint64_t > source_bit_offset
For a DW_OP_bit_piece, the offset (in bits) of this piece within its location (e.g....
Definition Location.hpp:224
KIND
Definition Location.hpp:208
@ BYTE
DW_OP_piece
Definition Location.hpp:209
uint64_t bit_size
Size of this piece in bits.
Definition Location.hpp:217
uint64_t bit_offset
Offset (in bits) of this piece within the whole value.
Definition Location.hpp:220
std::unique_ptr< Location > location
Location of this piece or a nullptr if it can't be decoded.
Definition Location.hpp:227
Location associated with the range of addresses where it is valid.
Definition Location.hpp:250
std::optional< uint64_t > section_index
Index of the object's section containing the range (if any).
Definition Location.hpp:255
friend std::ostream & operator<<(std::ostream &os, const LocationEntry &entry)
Definition Location.hpp:264
std::unique_ptr< Location > location
The location or a nullptr if the DWARF expression can't be decoded.
Definition Location.hpp:258
std::string to_string() const
Human-readable description of this entry (e.g. [0x1130, 0x1136): register 5).
std::optional< range_t > range
Range of addresses [low, high) where the location is valid.
Definition Location.hpp:252
#define LIEF_API
Definition visibility.h:45