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

This class represents an editable DWARF function (DW_TAG_subprogram) More...

#include <Function.hpp>

Classes

class  Label
 This class mirrors the DW_TAG_label DWARF tag. More...
 
class  LexicalBlock
 This class mirrors the DW_TAG_lexical_block DWARF tag. More...
 
class  Parameter
 This class represents a parameter of the current function (DW_TAG_formal_parameter) More...
 
struct  range_t
 

Public Member Functions

 Function ()=delete
 
 Function (std::unique_ptr< details::Function > impl)
 
Functionset_address (uint64_t addr)
 Set the address of this function by defining DW_AT_entry_pc
 
Functionset_low_high (uint64_t low, uint64_t high)
 Set the upper and lower bound addresses for this function. This assumes that the function is contiguous between low and high.
 
Functionset_ranges (const std::vector< range_t > &ranges)
 Set the ranges of addresses owned by the implementation of this function by setting the DW_AT_ranges attribute.
 
Functionset_external ()
 Set the function as external by defining DW_AT_external to true. This means that the function is imported by the current compilation unit.
 
Functionset_return_type (const Type &type)
 Set the return type of this function.
 
std::unique_ptr< Parameteradd_parameter (const std::string &name, const Type &type)
 Add a parameter to the current function.
 
std::unique_ptr< Variablecreate_stack_variable (const std::string &name)
 Create a stack-based variable owned by the current function.
 
std::unique_ptr< LexicalBlockadd_lexical_block (uint64_t start, uint64_t end)
 Add a lexical block with the given range.
 
std::unique_ptr< Labeladd_label (uint64_t addr, const std::string &label)
 Add a label at the given address.
 
 ~Function ()
 

Detailed Description

This class represents an editable DWARF function (DW_TAG_subprogram)

Constructor & Destructor Documentation

◆ Function() [1/2]

LIEF::dwarf::editor::Function::Function ( )
delete

◆ Function() [2/2]

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

◆ ~Function()

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

Member Function Documentation

◆ add_label()

std::unique_ptr< Label > LIEF::dwarf::editor::Function::add_label ( uint64_t addr,
const std::string & label )

Add a label at the given address.

◆ add_lexical_block()

std::unique_ptr< LexicalBlock > LIEF::dwarf::editor::Function::add_lexical_block ( uint64_t start,
uint64_t end )

Add a lexical block with the given range.

◆ add_parameter()

std::unique_ptr< Parameter > LIEF::dwarf::editor::Function::add_parameter ( const std::string & name,
const Type & type )

Add a parameter to the current function.

◆ create_stack_variable()

std::unique_ptr< Variable > LIEF::dwarf::editor::Function::create_stack_variable ( const std::string & name)

Create a stack-based variable owned by the current function.

◆ set_address()

Function & LIEF::dwarf::editor::Function::set_address ( uint64_t addr)

Set the address of this function by defining DW_AT_entry_pc

◆ set_external()

Function & LIEF::dwarf::editor::Function::set_external ( )

Set the function as external by defining DW_AT_external to true. This means that the function is imported by the current compilation unit.

◆ set_low_high()

Function & LIEF::dwarf::editor::Function::set_low_high ( uint64_t low,
uint64_t high )

Set the upper and lower bound addresses for this function. This assumes that the function is contiguous between low and high.

Underneath, the function defines DW_AT_low_pc and DW_AT_high_pc

◆ set_ranges()

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

Set the ranges of addresses owned by the implementation of this function by setting the DW_AT_ranges attribute.

This setter should be used for non-contiguous function.

◆ set_return_type()

Function & LIEF::dwarf::editor::Function::set_return_type ( const Type & type)

Set the return type of this function.


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