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

Class which represents an ELF note. This class can be instantiated using the static Note::create functions. More...

#include <Note.hpp>

Inheritance diagram for LIEF::ELF::Note:
Collaboration diagram for LIEF::ELF::Note:

Public Types

enum class  TYPE {
  UNKNOWN = 0 , GNU_ABI_TAG , GNU_HWCAP , GNU_BUILD_ID ,
  GNU_GOLD_VERSION , GNU_PROPERTY_TYPE_0 , GNU_BUILD_ATTRIBUTE_OPEN , GNU_BUILD_ATTRIBUTE_FUNC ,
  CRASHPAD , CORE_PRSTATUS , CORE_FPREGSET , CORE_PRPSINFO ,
  CORE_TASKSTRUCT , CORE_AUXV , CORE_PSTATUS , CORE_FPREGS ,
  CORE_PSINFO , CORE_LWPSTATUS , CORE_LWPSINFO , CORE_WIN32PSTATUS ,
  CORE_FILE , CORE_PRXFPREG , CORE_SIGINFO , CORE_ARM_VFP ,
  CORE_ARM_TLS , CORE_ARM_HW_BREAK , CORE_ARM_HW_WATCH , CORE_ARM_SYSTEM_CALL ,
  CORE_ARM_SVE , CORE_ARM_PAC_MASK , CORE_ARM_PACA_KEYS , CORE_ARM_PACG_KEYS ,
  CORE_TAGGED_ADDR_CTRL , CORE_PAC_ENABLED_KEYS , CORE_X86_TLS , CORE_X86_IOPERM ,
  CORE_X86_XSTATE , CORE_X86_CET , ANDROID_IDENT , ANDROID_MEMTAG ,
  ANDROID_KUSER , GO_BUILDID , STAPSDT , QNX_STACK
}
 LIEF representation of the ELF NT_ values. More...
 
using description_t = std::vector<uint8_t>
 Container used to handle the description data.
 
- Public Types inherited from LIEF::Object
template<class T >
using output_t = add_pointer_t<decay_t<T>>
 
template<class T >
using output_const_t = add_pointer_t<add_const_t<decay_t<T>>>
 

Public Member Functions

Noteoperator= (const Note &copy)=default
 
 Note (const Note &copy)=default
 
 ~Note () override=default
 
virtual std::unique_ptr< Noteclone () const
 Clone the current note and keep its polymorphic type.
 
const std::string & name () const
 Return the name of the note (also known as 'owner' )
 
const std::string & section_name () const
 Return the section name in which the note is or should be stored.
 
TYPE type () const
 Return the type of the note. This type does not match the NT_ type value. For accessing the original NT_ value, check original_type()
 
uint32_t original_type () const
 The original NT_xxx integer value. The meaning of this value likely depends on the owner of the note.
 
span< const uint8_t > description () const
 Return the description associated with the note.
 
span< uint8_t > description ()
 
void name (std::string name)
 
void description (description_t description)
 Change the description of the note.
 
uint64_t size () const
 Size of the raw note which includes padding.
 
virtual void dump (std::ostream &os) const
 
void accept (Visitor &visitor) const override
 
template<class T >
const T * cast () const
 
template<class T >
T * cast ()
 
- Public Member Functions inherited from LIEF::Object
 Object ()
 
 Object (const Object &other)
 
Objectoperator= (const Object &other)
 
template<class T >
output_t< T > as ()
 
template<class T >
output_const_t< T > as () const
 
virtual bool operator== (const Object &other) const
 
virtual bool operator!= (const Object &other) const
 
virtual ~Object ()
 

Static Public Member Functions

static result< TYPEconvert_type (Header::FILE_TYPE ftype, uint32_t type, const std::string &name)
 Convert the raw integer note type into a TYPE according to the owner.
 
static result< const char * > type_to_section (TYPE type)
 Try to determine the ELF section name associated with the TYPE provided in parameter.
 
static result< std::string > note_to_section (const Note &note)
 
static result< const char * > type_owner (TYPE type)
 Try to determine the owner's name of the TYPE provided in parameter.
 
static std::unique_ptr< Notecreate (const std::string &name, uint32_t type, description_t description, std::string section_name, Header::FILE_TYPE ftype=Header::FILE_TYPE::NONE, ARCH arch=ARCH::NONE, Header::CLASS cls=Header::CLASS::NONE)
 Create a new note from the given parameters. Additional information such as the architecture or the ELF class could be required for creating notes like Coredump notes.
 
static std::unique_ptr< Notecreate (const std::string &name, TYPE type, description_t description, std::string section_name, ARCH arch=ARCH::NONE, Header::CLASS cls=Header::CLASS::NONE)
 Create a new note from the given parameters. Additional information such as the architecture or the ELF class could be required for creating notes like Coredump notes.
 
static std::unique_ptr< Notecreate (BinaryStream &stream, std::string section_name, Header::FILE_TYPE ftype=Header::FILE_TYPE::NONE, ARCH arch=ARCH::NONE, Header::CLASS cls=Header::CLASS::NONE)
 Create a new note from the given stream. Additional information such as the architecture or the ELF class could be required for creating notes like Coredump notes.
 

Detailed Description

Class which represents an ELF note. This class can be instantiated using the static Note::create functions.

Member Typedef Documentation

◆ description_t

using LIEF::ELF::Note::description_t = std::vector<uint8_t>

Container used to handle the description data.

Member Enumeration Documentation

◆ TYPE

enum class LIEF::ELF::Note::TYPE
strong

LIEF representation of the ELF NT_ values.

Enumerator
UNKNOWN 
GNU_ABI_TAG 

Match NT_GNU_ABI_TAG: Operating system (OS) ABI information.

See: NoteAbi

GNU_HWCAP 

Match NT_HWCAP: Synthetic hardware capabilities information.

GNU_BUILD_ID 

Match NT_GNU_BUILD_ID: Unique build ID as generated by the GNU ld.

GNU_GOLD_VERSION 

Match NT_GNU_GOLD_VERSION: The version of gold used to link.

GNU_PROPERTY_TYPE_0 

Match NT_GNU_PROPERTY_TYPE_0: Program property note, as described in "Linux Extensions to the gABI".

GNU_BUILD_ATTRIBUTE_OPEN 
GNU_BUILD_ATTRIBUTE_FUNC 
CRASHPAD 

Crashpad note used by the Chromium project.

CORE_PRSTATUS 

Coredump that wraps the elf_prstatus structure.

CORE_FPREGSET 
CORE_PRPSINFO 

Coredump that wraps the elf_prpsinfo structure.

See: CorePrPsInfo

CORE_TASKSTRUCT 
CORE_AUXV 

Coredump that contains a copy of all the auxiliary vectors (auxv)

See: CoreAuxv

CORE_PSTATUS 
CORE_FPREGS 

Coredump that wraps the fpregset structure.

CORE_PSINFO 

Coredump that wraps the psinfo structure.

CORE_LWPSTATUS 
CORE_LWPSINFO 
CORE_WIN32PSTATUS 
CORE_FILE 
CORE_PRXFPREG 
CORE_SIGINFO 
CORE_ARM_VFP 
CORE_ARM_TLS 
CORE_ARM_HW_BREAK 
CORE_ARM_HW_WATCH 
CORE_ARM_SYSTEM_CALL 
CORE_ARM_SVE 
CORE_ARM_PAC_MASK 
CORE_ARM_PACA_KEYS 
CORE_ARM_PACG_KEYS 
CORE_TAGGED_ADDR_CTRL 
CORE_PAC_ENABLED_KEYS 
CORE_X86_TLS 
CORE_X86_IOPERM 
CORE_X86_XSTATE 
CORE_X86_CET 
ANDROID_IDENT 

Note that is specific to Android and that describes information such as the NDK version or the SDK build number.

See AndroidIdent

ANDROID_MEMTAG 
ANDROID_KUSER 
GO_BUILDID 

Note specific to Go binaries.

STAPSDT 

Note for SystemTap probes.

QNX_STACK 

QNX Note.

Constructor & Destructor Documentation

◆ Note()

LIEF::ELF::Note::Note ( const Note & copy)
default

◆ ~Note()

LIEF::ELF::Note::~Note ( )
overridedefault

Member Function Documentation

◆ accept()

void LIEF::ELF::Note::accept ( Visitor & visitor) const
overridevirtual

◆ cast() [1/2]

template<class T >
T * LIEF::ELF::Note::cast ( )
inline

◆ cast() [2/2]

template<class T >
const T * LIEF::ELF::Note::cast ( ) const
inline

◆ clone()

virtual std::unique_ptr< Note > LIEF::ELF::Note::clone ( ) const
inlinevirtual

◆ convert_type()

static result< TYPE > LIEF::ELF::Note::convert_type ( Header::FILE_TYPE ftype,
uint32_t type,
const std::string & name )
static

Convert the raw integer note type into a TYPE according to the owner.

◆ create() [1/3]

static std::unique_ptr< Note > LIEF::ELF::Note::create ( BinaryStream & stream,
std::string section_name,
Header::FILE_TYPE ftype = Header::FILE_TYPE::NONE,
ARCH arch = ARCH::NONE,
Header::CLASS cls = Header::CLASS::NONE )
static

Create a new note from the given stream. Additional information such as the architecture or the ELF class could be required for creating notes like Coredump notes.

◆ create() [2/3]

static std::unique_ptr< Note > LIEF::ELF::Note::create ( const std::string & name,
TYPE type,
description_t description,
std::string section_name,
ARCH arch = ARCH::NONE,
Header::CLASS cls = Header::CLASS::NONE )
static

Create a new note from the given parameters. Additional information such as the architecture or the ELF class could be required for creating notes like Coredump notes.

◆ create() [3/3]

static std::unique_ptr< Note > LIEF::ELF::Note::create ( const std::string & name,
uint32_t type,
description_t description,
std::string section_name,
Header::FILE_TYPE ftype = Header::FILE_TYPE::NONE,
ARCH arch = ARCH::NONE,
Header::CLASS cls = Header::CLASS::NONE )
static

Create a new note from the given parameters. Additional information such as the architecture or the ELF class could be required for creating notes like Coredump notes.

◆ description() [1/3]

span< uint8_t > LIEF::ELF::Note::description ( )
inline

◆ description() [2/3]

span< const uint8_t > LIEF::ELF::Note::description ( ) const
inline

Return the description associated with the note.

◆ description() [3/3]

void LIEF::ELF::Note::description ( description_t description)
inline

Change the description of the note.

◆ dump()

◆ name() [1/2]

const std::string & LIEF::ELF::Note::name ( ) const
inline

Return the name of the note (also known as 'owner' )

◆ name() [2/2]

void LIEF::ELF::Note::name ( std::string name)
inline

◆ note_to_section()

static result< std::string > LIEF::ELF::Note::note_to_section ( const Note & note)
inlinestatic

References section_name(), and type().

◆ operator=()

Note & LIEF::ELF::Note::operator= ( const Note & copy)
default

◆ original_type()

uint32_t LIEF::ELF::Note::original_type ( ) const
inline

The original NT_xxx integer value. The meaning of this value likely depends on the owner of the note.

◆ section_name()

const std::string & LIEF::ELF::Note::section_name ( ) const
inline

Return the section name in which the note is or should be stored.

Referenced by note_to_section().

◆ size()

uint64_t LIEF::ELF::Note::size ( ) const

Size of the raw note which includes padding.

◆ type()

◆ type_owner()

static result< const char * > LIEF::ELF::Note::type_owner ( TYPE type)
static

Try to determine the owner's name of the TYPE provided in parameter.

◆ type_to_section()

static result< const char * > LIEF::ELF::Note::type_to_section ( TYPE type)
static

Try to determine the ELF section name associated with the TYPE provided in parameter.


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