LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
LIEF::dwarf::Function Class Reference

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_tranges () const
 Ranges of virtual addresses owned by this function.
 
debug_location_t debug_location () const
 Original source code location.
 
std::unique_ptr< Typetype () 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< Scopescope () 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 ()
 

Detailed Description

This class represents a DWARF function which can be associated with either: DW_TAG_subprogram or DW_TAG_inlined_subroutine.

Member Typedef Documentation

◆ instructions_it

◆ parameters_t

using LIEF::dwarf::Function::parameters_t = std::vector<std::unique_ptr<Parameter>>

◆ thrown_types_t

using LIEF::dwarf::Function::thrown_types_t = std::vector<std::unique_ptr<Type>>

◆ vars_it

Iterator over the variables defined in the scope of this function.

Constructor & Destructor Documentation

◆ Function()

LIEF::dwarf::Function::Function ( std::unique_ptr< details::Function > impl)

◆ ~Function()

LIEF::dwarf::Function::~Function ( )

Member Function Documentation

◆ address()

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()

debug_location_t LIEF::dwarf::Function::debug_location ( ) const

Original source code location.

◆ instructions()

instructions_it LIEF::dwarf::Function::instructions ( ) const

Disassemble the current function by returning an iterator over the assembly::Instruction.

◆ is_artificial()

bool LIEF::dwarf::Function::is_artificial ( ) const

Whether this function is created by the compiler and not present in the original source code.

◆ is_external()

bool LIEF::dwarf::Function::is_external ( ) const

Whether the function is defined outside the current compilation unit (DW_AT_external).

◆ linkage_name()

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.

◆ name()

std::string LIEF::dwarf::Function::name ( ) const

The name of the function (DW_AT_name)

◆ parameters()

parameters_t LIEF::dwarf::Function::parameters ( ) const

Return the function's parameters (including any template parameter)

◆ ranges()

std::vector< range_t > LIEF::dwarf::Function::ranges ( ) const

Ranges of virtual addresses owned by this function.

◆ scope()

std::unique_ptr< Scope > LIEF::dwarf::Function::scope ( ) const

Return the scope in which this function is defined.

◆ size()

uint64_t LIEF::dwarf::Function::size ( ) const

Return the size taken by this function in the binary.

◆ thrown_types()

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:

func summarize(_ ratings: [Int]) throws(StatisticsError) {
// ...
}

thrown_types() returns one element associated with the Type: StatisticsError.

◆ type()

std::unique_ptr< Type > LIEF::dwarf::Function::type ( ) const

Return the dwarf::Type associated with the return type of this function.

◆ variables()

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.


The documentation for this class was generated from the following file: