LIEF: Library to Instrument Executable Formats Version 0.17.0
|
This class represents a DWARF function which can be associated with either: DW_TAG_subprogram
or DW_TAG_inlined_subroutine
.
More...
#include <Function.hpp>
Classes | |
class | Iterator |
Public Types | |
using | vars_it = iterator_range<Variable::Iterator> |
Iterator over the variables defined in the scope of this function. | |
using | parameters_t = std::vector<std::unique_ptr<Parameter>> |
using | thrown_types_t = std::vector<std::unique_ptr<Type>> |
using | instructions_it = iterator_range<assembly::Instruction::Iterator> |
Public Member Functions | |
Function (std::unique_ptr< details::Function > impl) | |
std::string | name () const |
The name of the function (DW_AT_name ) | |
std::string | linkage_name () const |
The name of the function which is used for linking (DW_AT_linkage_name ). | |
result< uint64_t > | address () const |
Return the address of the function (DW_AT_entry_pc or DW_AT_low_pc ). | |
vars_it | variables () const |
Return an iterator of variables (DW_TAG_variable ) defined within the scope of this function. This includes regular stack-based variables as well as static ones. | |
bool | is_artificial () const |
Whether this function is created by the compiler and not present in the original source code. | |
bool | is_external () const |
Whether the function is defined outside the current compilation unit (DW_AT_external ). | |
uint64_t | size () const |
Return the size taken by this function in the binary. | |
std::vector< range_t > | ranges () const |
Ranges of virtual addresses owned by this function. | |
debug_location_t | debug_location () const |
Original source code location. | |
std::unique_ptr< Type > | type () const |
Return the dwarf::Type associated with the return type of this function. | |
parameters_t | parameters () const |
Return the function's parameters (including any template parameter) | |
thrown_types_t | thrown_types () const |
List of exceptions (types) that can be thrown by the function. | |
std::unique_ptr< Scope > | scope () const |
Return the scope in which this function is defined. | |
instructions_it | instructions () const |
Disassemble the current function by returning an iterator over the assembly::Instruction. | |
~Function () | |
This class represents a DWARF function which can be associated with either: DW_TAG_subprogram
or DW_TAG_inlined_subroutine
.
using LIEF::dwarf::Function::parameters_t = std::vector<std::unique_ptr<Parameter>> |
using LIEF::dwarf::Function::thrown_types_t = std::vector<std::unique_ptr<Type>> |
Iterator over the variables defined in the scope of this function.
LIEF::dwarf::Function::Function | ( | std::unique_ptr< details::Function > | impl | ) |
LIEF::dwarf::Function::~Function | ( | ) |
result< uint64_t > LIEF::dwarf::Function::address | ( | ) | const |
Return the address of the function (DW_AT_entry_pc
or DW_AT_low_pc
).
debug_location_t LIEF::dwarf::Function::debug_location | ( | ) | const |
Original source code location.
instructions_it LIEF::dwarf::Function::instructions | ( | ) | const |
Disassemble the current function by returning an iterator over the assembly::Instruction.
bool LIEF::dwarf::Function::is_artificial | ( | ) | const |
Whether this function is created by the compiler and not present in the original source code.
bool LIEF::dwarf::Function::is_external | ( | ) | const |
Whether the function is defined outside the current compilation unit (DW_AT_external
).
std::string LIEF::dwarf::Function::linkage_name | ( | ) | const |
The name of the function which is used for linking (DW_AT_linkage_name
).
This name differs from name() as it is usually mangled. The function return an empty string if the linkage name is not available.
std::string LIEF::dwarf::Function::name | ( | ) | const |
The name of the function (DW_AT_name
)
parameters_t LIEF::dwarf::Function::parameters | ( | ) | const |
Return the function's parameters (including any template parameter)
std::vector< range_t > LIEF::dwarf::Function::ranges | ( | ) | const |
Ranges of virtual addresses owned by this function.
std::unique_ptr< Scope > LIEF::dwarf::Function::scope | ( | ) | const |
Return the scope in which this function is defined.
uint64_t LIEF::dwarf::Function::size | ( | ) | const |
Return the size taken by this function in the binary.
thrown_types_t LIEF::dwarf::Function::thrown_types | ( | ) | const |
List of exceptions (types) that can be thrown by the function.
For instance, given this Swift code:
thrown_types() returns one element associated with the Type: StatisticsError
.
std::unique_ptr< Type > LIEF::dwarf::Function::type | ( | ) | const |
Return the dwarf::Type associated with the return type of this function.
vars_it LIEF::dwarf::Function::variables | ( | ) | const |
Return an iterator of variables (DW_TAG_variable
) defined within the scope of this function. This includes regular stack-based variables as well as static ones.