LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
LIEF::runtime::Module Class Reference

This class represents an in-memory module which can be an executable or a library. More...

#include <Module.hpp>

Inheritance diagram for LIEF::runtime::Module:

Classes

class  Iterator

Public Member Functions

 Module ()=delete
 Module (std::unique_ptr< details::Module > impl)
 Module (const Module &)=delete
Moduleoperator= (const Module &)=delete
 Module (Module &&) noexcept
Moduleoperator= (Module &&) noexcept
virtual std::unique_ptr< Moduleclone () const
uint64_t imagebase () const
 Base address where the module is loaded in memory.
uint64_t size () const
 Virtual size of the current module.
uint64_t end () const
 End address of the module.
std::string name () const
 Name of the module (e.g. libc.so.6, kernel32.dll, libsystem_c.dylib).
std::string path () const
 Path of the module.
bool contains (uintptr_t addr) const
 Check if the current module contains the given address.
std::vector< uint8_t > dump () const
 Return the content of the module as it is currently mapped in memory.
std::vector< uint8_t > dump (const std::string &filepath) const
 Same as dump() but also writes the content into the file located at filepath.
std::vector< uint8_t > dump (std::ostream &os) const
 Same as dump() but also writes the content into the given output stream.
std::string to_string () const
template<class T>
const T * as () const
 This function can be used to downcast a Module instance.
template<class T>
T * as ()
virtual ~Module ()

Detailed Description

This class represents an in-memory module which can be an executable or a library.

Constructor & Destructor Documentation

◆ Module() [1/4]

◆ Module() [2/4]

LIEF::runtime::Module::Module ( std::unique_ptr< details::Module > impl)

References Module().

◆ Module() [3/4]

LIEF::runtime::Module::Module ( const Module & )
delete

References Module().

◆ Module() [4/4]

LIEF::runtime::Module::Module ( Module && )
noexcept

References Module().

◆ ~Module()

virtual LIEF::runtime::Module::~Module ( )
virtual

Member Function Documentation

◆ as() [1/2]

template<class T>
T * LIEF::runtime::Module::as ( )
inline

References LIEF_LIFETIMEBOUND, and Module().

◆ as() [2/2]

template<class T>
const T * LIEF::runtime::Module::as ( ) const
inline

This function can be used to downcast a Module instance.

References LIEF_LIFETIMEBOUND.

◆ clone()

virtual std::unique_ptr< Module > LIEF::runtime::Module::clone ( ) const
virtual

References clone(), and Module().

Referenced by clone().

◆ contains()

bool LIEF::runtime::Module::contains ( uintptr_t addr) const
inline

Check if the current module contains the given address.

References imagebase(), and size().

◆ dump() [1/3]

std::vector< uint8_t > LIEF::runtime::Module::dump ( ) const
inline

Return the content of the module as it is currently mapped in memory.

The returned buffer spans imagebase() over size() bytes. An empty buffer is returned if the imagebase or the size is null.

References imagebase(), and size().

Referenced by dump(), and dump().

◆ dump() [2/3]

std::vector< uint8_t > LIEF::runtime::Module::dump ( const std::string & filepath) const
inline

Same as dump() but also writes the content into the file located at filepath.

References dump().

◆ dump() [3/3]

std::vector< uint8_t > LIEF::runtime::Module::dump ( std::ostream & os) const
inline

Same as dump() but also writes the content into the given output stream.

References dump().

◆ end()

uint64_t LIEF::runtime::Module::end ( ) const
inline

End address of the module.

References end(), imagebase(), and size().

Referenced by end().

◆ imagebase()

uint64_t LIEF::runtime::Module::imagebase ( ) const

Base address where the module is loaded in memory.

References imagebase().

Referenced by contains(), dump(), end(), and imagebase().

◆ name()

std::string LIEF::runtime::Module::name ( ) const

◆ operator=() [1/2]

Module & LIEF::runtime::Module::operator= ( const Module & )
delete

References Module().

◆ operator=() [2/2]

Module & LIEF::runtime::Module::operator= ( Module && )
noexcept

References Module().

◆ path()

std::string LIEF::runtime::Module::path ( ) const

Path of the module.

◆ size()

uint64_t LIEF::runtime::Module::size ( ) const

Virtual size of the current module.

References size().

Referenced by contains(), dump(), end(), and size().

◆ to_string()

std::string LIEF::runtime::Module::to_string ( ) const

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