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

This class represents a stub entry in sections like __stubs,__auth_stubs. More...

#include <Stub.hpp>

Classes

class  Iterator
 
struct  target_info_t
 

Public Member Functions

 Stub ()=delete
 
 Stub (const Stub &)=default
 
Stuboperator= (const Stub &)=default
 
 Stub (Stub &&) noexcept=default
 
Stuboperator= (Stub &&) noexcept=default
 
 ~Stub ()=default
 
 Stub (target_info_t target_info, uint64_t addr, std::vector< uint8_t > raw)
 
span< const uint8_t > raw () const
 The (raw) instructions of this entry as a slice of bytes.
 
uint64_t address () const
 The virtual address where the stub is located.
 
result< uint64_t > target () const
 The address resolved by this stub.
 

Detailed Description

This class represents a stub entry in sections like __stubs,__auth_stubs.

It wraps assembly instructions which are used to access the got where the address of the symbol is resolved.

Example:

0000000236a3c1bc: ___memcpy_chk
adrp x17, #0x241513aa8
add x17, x17, #0x241513aa8
ldr x16, [x17]
braa x16, x17

Constructor & Destructor Documentation

◆ Stub() [1/4]

LIEF::MachO::Stub::Stub ( )
delete

◆ Stub() [2/4]

LIEF::MachO::Stub::Stub ( const Stub & )
default

◆ Stub() [3/4]

LIEF::MachO::Stub::Stub ( Stub && )
defaultnoexcept

◆ ~Stub()

LIEF::MachO::Stub::~Stub ( )
default

◆ Stub() [4/4]

LIEF::MachO::Stub::Stub ( target_info_t target_info,
uint64_t addr,
std::vector< uint8_t > raw )
inline

Member Function Documentation

◆ address()

uint64_t LIEF::MachO::Stub::address ( ) const
inline

The virtual address where the stub is located.

◆ operator=() [1/2]

Stub & LIEF::MachO::Stub::operator= ( const Stub & )
default

◆ operator=() [2/2]

Stub & LIEF::MachO::Stub::operator= ( Stub && )
defaultnoexcept

◆ raw()

span< const uint8_t > LIEF::MachO::Stub::raw ( ) const
inline

The (raw) instructions of this entry as a slice of bytes.

◆ target()

result< uint64_t > LIEF::MachO::Stub::target ( ) const

The address resolved by this stub.

For instance, given this stub:

0x3eec: adrp x16, #4096
0x3ef0: ldr x16, [x16, #24]
0x3ef4: br x16

The function returns: 0x4018.

Warning
This function is only available with LIEF's extended version

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