LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
LIEF::DeclOpt Class Reference

Configuration options for generated code from debug info. More...

#include <DebugDeclOpt.hpp>

Public Types

using type_aliases_t = std::unordered_map<std::string, std::string>
 Mapping between a type name and a user-friendly aliases. (e.g. std::basic_string<char,std::char_traits<char>,std::allocator<char>> -> std::string).

Public Member Functions

 DeclOpt ()
 DeclOpt (const DeclOpt &other)
DeclOpt & operator= (const DeclOpt &other)
 DeclOpt (DeclOpt &&other) noexcept
DeclOpt & operator= (DeclOpt &&other) noexcept
 ~DeclOpt ()
uint32_t indentation () const
 The number of spaces for indentation.
DeclOpt & indentation (uint32_t value)
bool is_cpp () const
 Prefer C++ syntax over C syntax.
DeclOpt & is_cpp (bool value)
bool show_extended_annotations () const
 Enable extended comments and annotations.
DeclOpt & show_extended_annotations (bool value)
bool include_types () const
 Include full type definitions.
DeclOpt & include_types (bool value)
bool include_locals () const
 Emit a function body listing its local / stack variables.
DeclOpt & include_locals (bool value)
bool desugar () const
 Resolve type aliases (sugar).
DeclOpt & desugar (bool value)
bool show_field_offsets () const
 Show the relative offset of each field/attribute in structures.
DeclOpt & show_field_offsets (bool value)
const type_aliases_t & type_aliases () const
 Mapping of type names to user-friendly aliases.
DeclOpt & type_aliases (type_aliases_t aliases)
DeclOpt & add_type_alias (std::string name, std::string alias)
 Register a single type alias.
std::string_view target_triple () const
 The LLVM target (e.g. aarch64-unknown-linux-gnu) used to build the AST from which the definitions are generated.
DeclOpt & target_triple (std::string triple)

Detailed Description

Configuration options for generated code from debug info.

This structure configures how the debug information (DWARF/PDB) translated into an AST is generated. You can use it to configure the indentation, and the information to generate when translating DWARF/PDB into C++-like definitions

Member Typedef Documentation

◆ type_aliases_t

using LIEF::DeclOpt::type_aliases_t = std::unordered_map<std::string, std::string>

Mapping between a type name and a user-friendly aliases. (e.g. std::basic_string<char,std::char_traits<char>,std::allocator<char>> -> std::string).

Constructor & Destructor Documentation

◆ DeclOpt() [1/3]

◆ DeclOpt() [2/3]

LIEF::DeclOpt::DeclOpt ( const DeclOpt & other)

References DeclOpt().

◆ DeclOpt() [3/3]

LIEF::DeclOpt::DeclOpt ( DeclOpt && other)
noexcept

References DeclOpt().

◆ ~DeclOpt()

LIEF::DeclOpt::~DeclOpt ( )

Member Function Documentation

◆ add_type_alias()

DeclOpt & LIEF::DeclOpt::add_type_alias ( std::string name,
std::string alias )

Register a single type alias.

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ desugar() [1/2]

bool LIEF::DeclOpt::desugar ( ) const

Resolve type aliases (sugar).

If true, typedef and type aliases are replaced by their underlying canonical types (e.g., uint32_t might become unsigned int).

◆ desugar() [2/2]

DeclOpt & LIEF::DeclOpt::desugar ( bool value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ include_locals() [1/2]

bool LIEF::DeclOpt::include_locals ( ) const

Emit a function body listing its local / stack variables.

◆ include_locals() [2/2]

DeclOpt & LIEF::DeclOpt::include_locals ( bool value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ include_types() [1/2]

bool LIEF::DeclOpt::include_types ( ) const

Include full type definitions.

If true, the output will contain the full definition of types (structs, enums, unions).

◆ include_types() [2/2]

DeclOpt & LIEF::DeclOpt::include_types ( bool value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ indentation() [1/2]

uint32_t LIEF::DeclOpt::indentation ( ) const

The number of spaces for indentation.

◆ indentation() [2/2]

DeclOpt & LIEF::DeclOpt::indentation ( uint32_t value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ is_cpp() [1/2]

bool LIEF::DeclOpt::is_cpp ( ) const

Prefer C++ syntax over C syntax.

If true, the output will use C++ features (e.g. bool keyword)

◆ is_cpp() [2/2]

DeclOpt & LIEF::DeclOpt::is_cpp ( bool value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ operator=() [1/2]

DeclOpt & LIEF::DeclOpt::operator= ( const DeclOpt & other)

References DeclOpt().

◆ operator=() [2/2]

DeclOpt & LIEF::DeclOpt::operator= ( DeclOpt && other)
noexcept

References DeclOpt().

◆ show_extended_annotations() [1/2]

bool LIEF::DeclOpt::show_extended_annotations ( ) const

Enable extended comments and annotations.

If true, the generated code will include comments containing low-level details such as memory addresses, offsets, type sizes, and original source locations.

◆ show_extended_annotations() [2/2]

DeclOpt & LIEF::DeclOpt::show_extended_annotations ( bool value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ show_field_offsets() [1/2]

bool LIEF::DeclOpt::show_field_offsets ( ) const

Show the relative offset of each field/attribute in structures.

If true, every member of a structure is prefixed with its byte offset,

struct Foo {
/* 0x00 *&zwj;/ int A;
/* 0x04 *&zwj;/ int B;
};

◆ show_field_offsets() [2/2]

DeclOpt & LIEF::DeclOpt::show_field_offsets ( bool value)

References DeclOpt(), and LIEF_LIFETIMEBOUND.

◆ target_triple() [1/2]

std::string_view LIEF::DeclOpt::target_triple ( ) const

The LLVM target (e.g. aarch64-unknown-linux-gnu) used to build the AST from which the definitions are generated.

The target defines the size of the builtin types (e.g. long) and the register names used in the annotations. If empty (default), the target is inferred from the binary associated with the debug info.

References LIEF_LIFETIMEBOUND.

Referenced by target_triple().

◆ target_triple() [2/2]

DeclOpt & LIEF::DeclOpt::target_triple ( std::string triple)

◆ type_aliases() [1/2]

const type_aliases_t & LIEF::DeclOpt::type_aliases ( ) const

Mapping of type names to user-friendly aliases.

◆ type_aliases() [2/2]

DeclOpt & LIEF::DeclOpt::type_aliases ( type_aliases_t aliases)

References DeclOpt(), and LIEF_LIFETIMEBOUND.


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