libabigail
|
This is the interface an ELF reader. More...
#include <abg-elf-reader.h>
Public Member Functions | |
reader (const std::string &elf_path, const vector< char ** > &debug_info_roots, environment &env) | |
The constructor of the elf::reader type. | |
~reader () | |
The destructor of the elf::reader type. | |
const Dwarf * | alternate_dwarf_debug_info () const |
Getter of the handle use to access DWARF information from the alternate split DWARF information. | |
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. | |
const vector< char ** > & | debug_info_root_paths () const |
Getter of the vector of directory paths to look into for split debug information files. | |
const vector< string > & | dt_needed () const |
Get the value of the DT_NEEDED property of the current ELF file. | |
const Dwarf * | dwarf_debug_info () const |
Getter of the handle used to access DWARF information from the current ELF file. | |
Dwfl_Callbacks & | dwfl_offline_callbacks () |
Getter of the functions used by the DWARF Front End library of elfutils to locate DWARF debug information. | |
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. | |
const string & | elf_architecture () const |
Get the value of the 'ARCHITECTURE' property of the current ELF file. | |
Elf * | elf_handle () const |
Getter of the handle used to access ELF information from the current ELF file. | |
const Elf_Scn * | find_alternate_ctf_section () const |
Find and return a pointer to the alternate CTF section of the current ELF file. | |
const Elf_Scn * | find_btf_section () const |
Find and return a pointer to the BTF section of the current ELF file. | |
const Elf_Scn * | find_ctf_section () const |
Find and return a pointer to the the CTF section. | |
const Elf_Scn * | find_symbol_table_section () const |
Find and return a pointer to the ELF symbol table section. | |
elf_symbol_sptr | function_symbol_is_exported (const string &name) const |
Test if a given function symbol has been exported. | |
elf_symbol_sptr | function_symbol_is_exported (GElf_Addr symbol_address) const |
Test if a given function symbol has been exported. | |
elf_symbol_sptr | function_symbol_is_undefined (const string &name) const |
Test if a name is the name of an undefined function symbol. | |
bool | has_btf_debug_info () const |
Test if the binary has BTF debug info. | |
bool | has_ctf_debug_info () const |
Test if the binary has CTF debug info. | |
bool | has_dwarf_debug_info () const |
Test if the binary has DWARF debug info. | |
virtual void | initialize (const std::string &elf_path) |
Re-initialize the resources used by the current elf::reader type. | |
virtual void | initialize (const std::string &elf_path, const vector< char ** > &debug_info_roots) |
Re-initialize the resources used by the current elf::reader type. | |
void | load_dt_soname_and_needed () |
Load the DT_NEEDED and DT_SONAME elf TAGS. | |
void | load_elf_architecture () |
Read the string representing the architecture of the current ELF file. | |
void | load_elf_properties () |
Load various ELF data. | |
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. | |
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. | |
void | reset_symbol_table_section () |
Clear the pointer to the ELF symbol table section. | |
symtab_reader::symtab_sptr & | symtab () const |
Getter of an abstract representation of the symbol table of the underlying ELF file. | |
elf_symbol_sptr | variable_symbol_is_exported (const string &name) const |
Test if a given variable symbol has been exported. | |
elf_symbol_sptr | variable_symbol_is_exported (GElf_Addr symbol_address) const |
Test if a given variable symbol has been exported. | |
elf_symbol_sptr | variable_symbol_is_undefined (const string &name) const |
Test if a name is the name of an undefined variable symbol. | |
Public Member Functions inherited from fe_iface | |
fe_iface (const std::string &corpus_path, environment &e) | |
Constructor of the type fe_iface. | |
virtual | ~fe_iface () |
Desctructor of the Front End Interface. | |
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. | |
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. | |
void | add_var_to_exported_or_undefined_decls (const var_decl_sptr &var) |
Add the representation of the ABI of a variable to the set of exported or undefined declarations of the current corpus. | |
corpus_sptr | corpus () |
Getter for the ABI corpus being built by the current front-end. | |
const corpus_sptr | corpus () const |
Getter for the ABI corpus being built by the current front-end. | |
corpus_group_sptr & | corpus_group () |
Getter for the ABI corpus group being built by the current front-end. | |
const corpus_group_sptr & | corpus_group () const |
Getter for the ABI corpus group being built by the current front-end. | |
void | corpus_group (const ir::corpus_group_sptr &cg) |
Setter for the ABI corpus group being built by the current front-end. | |
const std::string & | corpus_path () const |
Getter of the path to the file which an ABI corpus is to be created for. | |
void | corpus_path (const std::string &) |
Setter of the path to the file which an ABI corpus is to be created for. | |
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. | |
const string & | dt_soname () const |
Getter for the SONAME of the analyzed binary. | |
void | dt_soname (const string &) |
Getter for the SONAME of the analyzed binary. | |
bool | has_corpus_group () const |
Test if there is a corpus group being built. | |
bool | load_in_linux_kernel_mode () const |
Test if the input binary is to be considered as a Linux Kernel binary. | |
corpus_sptr | main_corpus_from_current_group () |
Return the main corpus from the current corpus group, if any. | |
options_type & | options () |
Getter of the the options of the current Front End Interface. | |
const options_type & | options () const |
Getter of the the options of the current Front End Interface. | |
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. | |
suppr::suppressions_type & | suppressions () |
Getter of the vector of suppression specifications associated with the current front-end. | |
const suppr::suppressions_type & | suppressions () const |
Getter of the vector of suppression specifications associated with the current front-end. | |
void | suppressions (suppr::suppressions_type &) |
Setter of the vector of suppression specifications associated with the current front-end. | |
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_ |
This is the interface an ELF reader.
It knows how to open an ELF file, read its content and expose an interface for its symbol table and other properties.
Note that the ABI corpus returned by the elf::read_corpus() member function doesn't contain any type representation. It only contains the representations of the the ELF symbols found in the ELF file.
To construct the type representations for the functions and global variables present in the ELF file, please use the implementations of the elf_based_reader interface. Those know how to read the debug information from the ELF file to build type representation in the abigail::ir::corpus instance.
Definition at line 62 of file abg-elf-reader.h.
reader | ( | const std::string & | elf_path, |
const vector< char ** > & | debug_info_roots, | ||
environment & | env ) |
The constructor of the elf::reader type.
elf_path | the path to the ELF file to read from. |
debug_info_root | a vector of directory paths to look into for split debug information files. |
env | the environment which the reader operates in. |
Definition at line 515 of file abg-elf-reader.cc.
~reader | ( | ) |
The destructor of the elf::reader type.
Definition at line 527 of file abg-elf-reader.cc.
const Dwarf * alternate_dwarf_debug_info | ( | ) | const |
Getter of the handle use to access DWARF information from the alternate split DWARF information.
In other words, this accesses the factorized DWARF information that has been constructed by the DWZ tool to de-duplicate DWARF information on disk.
Definition at line 641 of file abg-elf-reader.cc.
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.
Definition at line 653 of file abg-elf-reader.cc.
const vector< char ** > & debug_info_root_paths | ( | ) | const |
Getter of the vector of directory paths to look into for split debug information files.
Definition at line 572 of file abg-elf-reader.cc.
const vector< string > & dt_needed | ( | ) | const |
Get the value of the DT_NEEDED property of the current ELF file.
Definition at line 744 of file abg-elf-reader.cc.
const Dwarf * dwarf_debug_info | ( | ) | const |
Getter of the handle used to access DWARF information from the current ELF file.
Definition at line 606 of file abg-elf-reader.cc.
Dwfl_Callbacks & dwfl_offline_callbacks | ( | ) |
Getter of the functions used by the DWARF Front End library of elfutils to locate DWARF debug information.
Definition at line 588 of file abg-elf-reader.cc.
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.
Definition at line 580 of file abg-elf-reader.cc.
const string & elf_architecture | ( | ) | const |
Get the value of the 'ARCHITECTURE' property of the current ELF file.
Definition at line 753 of file abg-elf-reader.cc.
Elf * elf_handle | ( | ) | const |
Getter of the handle used to access ELF information from the current ELF file.
Definition at line 597 of file abg-elf-reader.cc.
const Elf_Scn * find_alternate_ctf_section | ( | ) | const |
Find and return a pointer to the alternate CTF section of the current ELF file.
Definition at line 718 of file abg-elf-reader.cc.
const Elf_Scn * find_btf_section | ( | ) | const |
Find and return a pointer to the BTF section of the current ELF file.
Definition at line 731 of file abg-elf-reader.cc.
const Elf_Scn * find_ctf_section | ( | ) | const |
Find and return a pointer to the the CTF section.
Definition at line 701 of file abg-elf-reader.cc.
const Elf_Scn * find_symbol_table_section | ( | ) | const |
Find and return a pointer to the ELF symbol table section.
Definition at line 684 of file abg-elf-reader.cc.
elf_symbol_sptr function_symbol_is_exported | ( | const string & | name | ) | const |
Test if a given function symbol has been exported.
name | the name of the symbol we are looking for. |
Definition at line 847 of file abg-elf-reader.cc.
elf_symbol_sptr function_symbol_is_exported | ( | GElf_Addr | symbol_address | ) | const |
Test if a given function symbol has been exported.
symbol_address | the address of the symbol we are looking for. Note that this address must be a relative offset from the beginning of the .text section, just like the kind of addresses that are present in the .symtab section. |
Definition at line 789 of file abg-elf-reader.cc.
elf_symbol_sptr function_symbol_is_undefined | ( | const string & | name | ) | const |
Test if a name is the name of an undefined function symbol.
name | the symbol name to consider. |
Definition at line 900 of file abg-elf-reader.cc.
bool has_btf_debug_info | ( | ) | const |
Test if the binary has BTF debug info.
Definition at line 628 of file abg-elf-reader.cc.
bool has_ctf_debug_info | ( | ) | const |
Test if the binary has CTF debug info.
Definition at line 621 of file abg-elf-reader.cc.
bool has_dwarf_debug_info | ( | ) | const |
Test if the binary has DWARF debug info.
Definition at line 613 of file abg-elf-reader.cc.
|
virtual |
Re-initialize the resources used by the current elf::reader type.
This lets the reader in a state where it's ready to read from another ELF file.
elf_path | the new ELF path to read from. |
Reimplemented from fe_iface.
Reimplemented in elf_based_reader.
Definition at line 560 of file abg-elf-reader.cc.
|
virtual |
Re-initialize the resources used by the current elf::reader type.
This lets the reader in a state where it's ready to read from another ELF file.
elf_path | the new ELF path to read from. |
debug_info_roots | a vector of directory paths to look into for split debug information files. |
Reimplemented in elf_based_reader.
Definition at line 541 of file abg-elf-reader.cc.
void load_dt_soname_and_needed | ( | ) |
Load the DT_NEEDED and DT_SONAME elf TAGS.
Definition at line 914 of file abg-elf-reader.cc.
void load_elf_architecture | ( | ) |
Read the string representing the architecture of the current ELF file.
Definition at line 931 of file abg-elf-reader.cc.
void load_elf_properties | ( | ) |
Load various ELF data.
This function loads ELF data that are not symbol maps or debug info. That is, things like various tags, elf architecture and so on.
Definition at line 949 of file abg-elf-reader.cc.
|
virtual |
Read the ELF information associated to the current ELF file and construct an ABI representation from it.
Note that this reader doesn't know how to interpret any debug information so the resulting ABI corpus won't have any type information. Rather, it will only have ELF symbol representation.
To have type information, consider using readers that know how to interpret the symbolic type information comprised in DWARF, CTF or other symbolic debug information format, like the or abigail::dwarf_reader::reader, abigail::ctf_reader::reader readers.
Implements fe_iface.
Definition at line 973 of file abg-elf-reader.cc.
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.
Note that "alternate debug info sections" is a GNU extension as of DWARF4 and is described at http://www.dwarfstd.org/ShowIssue.php?issue=120604.1.
alt_di | the path to the alternate debug info file. This is set iff the function returns true. |
Definition at line 669 of file abg-elf-reader.cc.
void reset_symbol_table_section | ( | ) |
Clear the pointer to the ELF symbol table section.
Definition at line 694 of file abg-elf-reader.cc.
symtab_reader::symtab_sptr & symtab | ( | ) | const |
Getter of an abstract representation of the symbol table of the underlying ELF file.
Note that the symbol table is loaded lazily, upon the first invocation of this member function.
@returnt the symbol table.
Definition at line 764 of file abg-elf-reader.cc.
elf_symbol_sptr variable_symbol_is_exported | ( | const string & | name | ) | const |
Test if a given variable symbol has been exported.
name | the name of the symbol we are looking for. |
Definition at line 874 of file abg-elf-reader.cc.
elf_symbol_sptr variable_symbol_is_exported | ( | GElf_Addr | symbol_address | ) | const |
Test if a given variable symbol has been exported.
symbol_address | the address of the symbol we are looking for. Note that this address must be a relative offset from the beginning of the .text section, just like the kind of addresses that are present in the .symtab section. |
Definition at line 820 of file abg-elf-reader.cc.
elf_symbol_sptr variable_symbol_is_undefined | ( | const string & | name | ) | const |
Test if a name is the name of an undefined variable symbol.
name | the symbol name to consider. |
Definition at line 909 of file abg-elf-reader.cc.