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

This class represents an editable DWARF compilation unit. More...

#include <CompilationUnit.hpp>

Public Member Functions

 CompilationUnit ()=delete
 CompilationUnit (std::unique_ptr< details::CompilationUnit > impl)
CompilationUnitset_producer (const std::string &producer)
 Set the DW_AT_producer producer attribute.
std::unique_ptr< Functioncreate_function (const std::string &name)
 Create a new function owned by this compilation unit.
std::unique_ptr< Variablecreate_variable (const std::string &name)
 Create a new global variable owned by this compilation unit.
std::unique_ptr< Typecreate_generic_type (const std::string &name)
 Create a DW_TAG_unspecified_type type with the given name.
std::unique_ptr< EnumTypecreate_enum (const std::string &name)
 Create an enum type (DW_TAG_enumeration_type).
std::unique_ptr< TypeDefcreate_typedef (const std::string &name, const Type &type)
 Create a typdef with the name provided in the first parameter which aliases the type provided in the second parameter.
std::unique_ptr< StructTypecreate_structure (const std::string &name, StructType::TYPE kind=StructType::TYPE::STRUCT)
 Create a struct-like type (struct, class, union) with the given name.
std::unique_ptr< BaseTypecreate_base_type (const std::string &name, size_t size, BaseType::ENCODING encoding=BaseType::ENCODING::NONE)
 Create a primitive type with the given name and size.
std::unique_ptr< FunctionTypecreate_function_type (const std::string &name)
 Create a function type with the given name.
std::unique_ptr< PointerTypecreate_pointer_type (const Type &ty)
 Create a pointer on the provided type.
std::unique_ptr< Typecreate_void_type ()
 Create a void type.
std::unique_ptr< ArrayTypecreate_array (const std::string &name, const Type &type, size_t count)
 Create an array type with the given name, type and size.
 ~CompilationUnit ()

Detailed Description

This class represents an editable DWARF compilation unit.

Constructor & Destructor Documentation

◆ CompilationUnit() [1/2]

LIEF::dwarf::editor::CompilationUnit::CompilationUnit ( )
delete

Referenced by set_producer().

◆ CompilationUnit() [2/2]

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

◆ ~CompilationUnit()

LIEF::dwarf::editor::CompilationUnit::~CompilationUnit ( )

Member Function Documentation

◆ create_array()

std::unique_ptr< ArrayType > LIEF::dwarf::editor::CompilationUnit::create_array ( const std::string & name,
const Type & type,
size_t count )

Create an array type with the given name, type and size.

◆ create_base_type()

std::unique_ptr< BaseType > LIEF::dwarf::editor::CompilationUnit::create_base_type ( const std::string & name,
size_t size,
BaseType::ENCODING encoding = BaseType::ENCODING::NONE )

Create a primitive type with the given name and size.

References LIEF::dwarf::editor::BaseType::NONE.

◆ create_enum()

std::unique_ptr< EnumType > LIEF::dwarf::editor::CompilationUnit::create_enum ( const std::string & name)

Create an enum type (DW_TAG_enumeration_type).

◆ create_function()

std::unique_ptr< Function > LIEF::dwarf::editor::CompilationUnit::create_function ( const std::string & name)

Create a new function owned by this compilation unit.

◆ create_function_type()

std::unique_ptr< FunctionType > LIEF::dwarf::editor::CompilationUnit::create_function_type ( const std::string & name)

Create a function type with the given name.

◆ create_generic_type()

std::unique_ptr< Type > LIEF::dwarf::editor::CompilationUnit::create_generic_type ( const std::string & name)

Create a DW_TAG_unspecified_type type with the given name.

◆ create_pointer_type()

std::unique_ptr< PointerType > LIEF::dwarf::editor::CompilationUnit::create_pointer_type ( const Type & ty)
inline

Create a pointer on the provided type.

References LIEF::dwarf::editor::Type::pointer_to().

◆ create_structure()

std::unique_ptr< StructType > LIEF::dwarf::editor::CompilationUnit::create_structure ( const std::string & name,
StructType::TYPE kind = StructType::TYPE::STRUCT )

Create a struct-like type (struct, class, union) with the given name.

References LIEF::dwarf::editor::StructType::STRUCT.

◆ create_typedef()

std::unique_ptr< TypeDef > LIEF::dwarf::editor::CompilationUnit::create_typedef ( const std::string & name,
const Type & type )

Create a typdef with the name provided in the first parameter which aliases the type provided in the second parameter.

◆ create_variable()

std::unique_ptr< Variable > LIEF::dwarf::editor::CompilationUnit::create_variable ( const std::string & name)

Create a new global variable owned by this compilation unit.

◆ create_void_type()

std::unique_ptr< Type > LIEF::dwarf::editor::CompilationUnit::create_void_type ( )

Create a void type.

◆ set_producer()

CompilationUnit & LIEF::dwarf::editor::CompilationUnit::set_producer ( const std::string & producer)

Set the DW_AT_producer producer attribute.

This attribute aims to inform about the program that generated this compilation unit (e.g. LIEF Extended)

References CompilationUnit().


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