libabigail
Public Member Functions | Protected Member Functions | List of all members
elf_based_reader Class Referenceabstract

The common interface of readers based on ELF. More...

#include <abg-elf-based-reader.h>

Inheritance diagram for elf_based_reader:
[legend]

Public Member Functions

 ~elf_based_reader ()
 Destructor of the reader. More...
 
virtual void initialize (const std::string &corpus_path)
 (re)Initialize the resources used by the current reader. More...
 
virtual void initialize (const std::string &elf_path, const vector< char ** > &debug_info_root_paths)
 (re)Initialize) the resources used by the current reader. More...
 
virtual void initialize (const string &elf_path, const vector< char ** > &debug_info_root_paths, bool load_all_types, bool linux_kernel_mode)=0
 
virtual ir::corpus_sptr read_and_add_corpus_to_group (ir::corpus_group &group, fe_iface::status &status)
 Read an ABI corpus and add it to a given corpus group. More...
 
- Public Member Functions inherited from reader
 reader (const std::string &elf_path, const vector< char ** > &debug_info_roots, environment &env)
 
 ~reader ()
 The destructor of the elf::reader type. More...
 
const Dwarf * alternate_dwarf_debug_info () const
 Getter of the handle use to access DWARF information from the alternate split DWARF information. More...
 
const string & alternate_dwarf_debug_info_path () const
 Getter of the path to the alternate split DWARF information file, on disk. In othe words, this returns the path to the factorized DWARF information used by the current ELF file, created by the 'DWZ' tool. More...
 
const vector< char ** > & debug_info_root_paths () const
 Getter of the vector of directory paths to look into for split debug information files. More...
 
const vector< string > & dt_needed () const
 Get the value of the DT_NEEDED property of the current ELF file. More...
 
const Dwarf * dwarf_debug_info () const
 Getter of the handle used to access DWARF information from the current ELF file. More...
 
Dwfl_Callbacks & dwfl_offline_callbacks ()
 Getter of the functions used by the DWARF Front End library of elfutils to locate DWARF debug information. More...
 
const Dwfl_Callbacks & dwfl_offline_callbacks () const
 Getter of the functions used by the DWARF Front End library of elfutils to locate DWARF debug information. More...
 
const string & elf_architecture () const
 Get the value of the 'ARCHITECTURE' property of the current ELF file. More...
 
Elf * elf_handle () const
 Getter of the handle used to access ELF information from the current ELF file. More...
 
const Elf_Scn * find_alternate_ctf_section () const
 Find and return a pointer to the alternate CTF section of the current ELF file. More...
 
const Elf_Scn * find_btf_section () const
 Find and return a pointer to the BTF section of the current ELF file. More...
 
const Elf_Scn * find_ctf_section () const
 Find and return a pointer to the the CTF section. More...
 
const Elf_Scn * find_symbol_table_section () const
 Find and return a pointer to the ELF symbol table section. More...
 
elf_symbol_sptr function_symbol_is_exported (const string &name) const
 Test if a given function symbol has been exported. More...
 
elf_symbol_sptr function_symbol_is_exported (GElf_Addr symbol_address) const
 Test if a given function symbol has been exported. More...
 
elf_symbol_sptr function_symbol_is_undefined (const string &name) const
 Test if a name is the name of an undefined function symbol. More...
 
bool has_btf_debug_info () const
 Test if the binary has BTF debug info. More...
 
bool has_ctf_debug_info () const
 Test if the binary has CTF debug info. More...
 
bool has_dwarf_debug_info () const
 Test if the binary has DWARF debug info. More...
 
void load_dt_soname_and_needed ()
 Load the DT_NEEDED and DT_SONAME elf TAGS. More...
 
void load_elf_architecture ()
 Read the string representing the architecture of the current ELF file. More...
 
void load_elf_properties ()
 Load various ELF data. More...
 
virtual ir::corpus_sptr read_corpus (status &status)
 Read the ELF information associated to the current ELF file and construct an ABI representation from it. More...
 
bool refers_to_alt_debug_info (string &alt_di_path) const
 Check if the underlying elf file refers to an alternate debug info file associated to it. More...
 
void reset_symbol_table_section ()
 Clear the pointer to the ELF symbol table section. More...
 
symtab_reader::symtab_sptrsymtab () const
 Getter of an abstract representation of the symbol table of the underlying ELF file. More...
 
elf_symbol_sptr variable_symbol_is_exported (const string &name) const
 Test if a given variable symbol has been exported. More...
 
elf_symbol_sptr variable_symbol_is_exported (GElf_Addr symbol_address) const
 Test if a given variable symbol has been exported. More...
 
elf_symbol_sptr variable_symbol_is_undefined (const string &name) const
 Test if a name is the name of an undefined variable symbol. More...
 
- Public Member Functions inherited from fe_iface
 fe_iface (const std::string &corpus_path, environment &e)
 Constructor of the type fe_iface. More...
 
virtual ~fe_iface ()
 Desctructor of the Front End Interface. More...
 
void add_fn_to_exported_or_undefined_decls (const function_decl *fn)
 Add the representation of the ABI of a function to the set of exported declarations or undefined declarations of the current corpus. More...
 
void add_suppressions (const suppr::suppressions_type &)
 Add suppressions specifications to the set of suppressions to be used during the construction of the ABI internal representation (the ABI corpus) from the input file. More...
 
void add_var_to_exported_or_undefined_decls (const var_decl *var)
 Add the representation of the ABI of a variable to the set of exported or undefined declarations of the current corpus. More...
 
corpus_sptr corpus ()
 Getter for the ABI corpus being built by the current front-end. More...
 
const corpus_sptr corpus () const
 Getter for the ABI corpus being built by the current front-end. More...
 
corpus_group_sptr & corpus_group ()
 Getter for the ABI corpus group being built by the current front-end. More...
 
const corpus_group_sptr & corpus_group () const
 Getter for the ABI corpus group being built by the current front-end. More...
 
void corpus_group (const ir::corpus_group_sptr &cg)
 Setter for the ABI corpus group being built by the current front-end. More...
 
const std::string & corpus_path () const
 Getter of the path to the file which an ABI corpus is to be created for. More...
 
void corpus_path (const std::string &)
 Setter of the path to the file which an ABI corpus is to be created for. More...
 
bool current_corpus_is_main_corpus_from_current_group ()
 Test if the current corpus being built is the main corpus of the current corpus group. More...
 
const string & dt_soname () const
 Getter for the SONAME of the analyzed binary. More...
 
void dt_soname (const string &)
 Getter for the SONAME of the analyzed binary. More...
 
bool has_corpus_group () const
 Test if there is a corpus group being built. More...
 
bool load_in_linux_kernel_mode () const
 Test if the input binary is to be considered as a Linux Kernel binary. More...
 
corpus_sptr main_corpus_from_current_group ()
 Return the main corpus from the current corpus group, if any. More...
 
options_typeoptions ()
 Getter of the the options of the current Front End Interface. More...
 
const options_typeoptions () const
 Getter of the the options of the current Front End Interface. More...
 
corpus_sptr should_reuse_type_from_corpus_group ()
 Return true if the current corpus is part of a corpus group being built and if it's not the main corpus of the group. More...
 
suppr::suppressions_typesuppressions ()
 Getter of the vector of suppression specifications associated with the current front-end. More...
 
const suppr::suppressions_typesuppressions () const
 Getter of the vector of suppression specifications associated with the current front-end. More...
 
void suppressions (suppr::suppressions_type &)
 Setter of the vector of suppression specifications associated with the current front-end. More...
 

Protected Member Functions

 elf_based_reader (const std::string &elf_path, const vector< char ** > &debug_info_root_paths, environment &env)
 Readers that implement this interface must provide a factory method to create a reader instance as this constructor is protected. More...
 

Additional Inherited Members

- Public Types inherited from fe_iface
enum  status {
  STATUS_UNKNOWN , STATUS_OK , STATUS_DEBUG_INFO_NOT_FOUND , STATUS_ALT_DEBUG_INFO_NOT_FOUND ,
  STATUS_NO_SYMBOLS_FOUND
}
 The status of the fe_iface::read_corpus call. More...
 
- Protected Attributes inherited from fe_iface
priv * priv_
 

Detailed Description

The common interface of readers based on ELF.

These are for readers like DWARF and CTF readers that read debug information describing binaries in the ELF format.

This interface extends the elf_reader::reader interface and thus also provides facilities for reading ELF binaries.

Definition at line 33 of file abg-elf-based-reader.h.

Constructor & Destructor Documentation

◆ elf_based_reader()

elf_based_reader ( const std::string &  elf_path,
const vector< char ** > &  debug_info_root_paths,
environment env 
)
protected

Readers that implement this interface must provide a factory method to create a reader instance as this constructor is protected.

Constructor of the @erf elf_based_reader type.

Parameters
elf_paththe path the ELF file to read.
debug_info_root_pathsa vector of paths to look into for split debug info files.
envthe environment used by the reader.

Definition at line 51 of file abg-elf-based-reader.cc.

◆ ~elf_based_reader()

Destructor of the reader.

Definition at line 61 of file abg-elf-based-reader.cc.

Member Function Documentation

◆ initialize() [1/2]

void initialize ( const std::string &  corpus_path)
virtual

(re)Initialize the resources used by the current reader.

This invokes fe_iface::initialize as wel as the virtual pure elf_based_reader::initialize() interface.

Parameters
corpus_pathpath to the corpus to be built.

Reimplemented from reader.

Definition at line 88 of file abg-elf-based-reader.cc.

◆ initialize() [2/2]

void initialize ( const std::string &  elf_path,
const vector< char ** > &  debug_info_root_paths 
)
virtual

(re)Initialize) the resources used by the current reader.

This frees the resources of the current reader and gets it ready to read data from another ELF file.

Parameters
elf_paththe path to the new ELF file to consider.
debug_info_root_pathsa vector of paths to look into for split debug info files.

Reimplemented from reader.

Definition at line 74 of file abg-elf-based-reader.cc.

◆ read_and_add_corpus_to_group()

ir::corpus_sptr read_and_add_corpus_to_group ( ir::corpus_group group,
fe_iface::status status 
)
virtual

Read an ABI corpus and add it to a given corpus group.

Parameters
groupthe corpus group to consider. The new corpus is added to this group.
statusoutput parameter. This is the status of the creation of the current ABI corpus. It's set by this function iff a non-nil corpus_sptr is returned.
Returns
the resulting ABI corpus.

Definition at line 107 of file abg-elf-based-reader.cc.


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