libabigail
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
corpus Class Reference

This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi artefacts like types and decls) bundled together as a corpus. A corpus is thus the Application binary interface of a program, a library or just a set of modules put together. More...

#include <abg-corpus.h>

Inheritance diagram for corpus:
[legend]

Classes

class  exported_decls_builder
 Abstracts the building of the set of exported variables and functions. More...
 
struct  priv
 The private data of the corpus type. More...
 

Public Types

typedef shared_ptr< exported_decls_builderexported_decls_builder_sptr
 Convenience typedef for shared_ptr<exported_decls_builder>. More...
 
typedef vector< const function_decl * > functions
 Convenience typedef for std::vector<abigail::ir::function_decl*> More...
 
typedef std::unordered_set< const function_decl * > functions_set
 Convenience typedef for std::unordered_set<const function_decl*> More...
 
enum  origin {
  ARTIFICIAL_ORIGIN , NATIVE_XML_ORIGIN , ELF_ORIGIN , DWARF_ORIGIN ,
  CTF_ORIGIN , BTF_ORIGIN , LINUX_KERNEL_BINARY_ORIGIN
}
 This abstracts where the corpus comes from. That is, either it has been read from the native xml format, from DWARF or built artificially using the library's API. More...
 
typedef vector< string > strings_type
 A convenience typedef for std::vector<string>. More...
 
typedef vector< const var_decl * > variables
 Convenience typedef for std::vector<abigail::ir::var_decl*> More...
 
typedef std::unordered_set< const var_decl * > variables_set
 Convenience typedef for std::unordered_set<const var_decl*>. More...
 

Public Member Functions

 corpus (const ir::environment &, const string &path="")
 Constructor of the corpus type. More...
 
void add (const translation_unit_sptr &)
 Add a translation unit to the current ABI Corpus. More...
 
bool do_log () const
 Test if logging was requested. More...
 
void do_log (bool)
 Request logging, or not. More...
 
void drop_translation_units ()
 Erase the translation units contained in this in-memory object. More...
 
const translation_unit_sptr find_translation_unit (const string &path) const
 Find the translation unit that has a given path. More...
 
const string & get_architecture_name () const
 Getter for the architecture name of the corpus. More...
 
const environmentget_environment () const
 Getter of the enviroment of the corpus. More...
 
exported_decls_builder_sptr get_exported_decls_builder () const
 Getter for the object that is responsible for determining what decls ought to be in the set of exported decls. More...
 
string & get_format_major_version_number () const
 Getter of the major version number of the abixml serialization format. More...
 
string & get_format_minor_version_number () const
 Getter of the minor version number of the abixml serialization format. More...
 
virtual const string_elf_symbols_map_typeget_fun_symbol_map () const
 Getter for the function symbols map. More...
 
virtual const functionsget_functions () const
 Return the functions public decl table of the current corpus. More...
 
corpus_groupget_group ()
 Getter of the group this corpus belongs to. More...
 
const corpus_groupget_group () const
 Getter of the group this corpus is a member of. More...
 
const vector< string > & get_needed () const
 Getter of the needed property of the corpus. More...
 
origin get_origin () const
 Getter for the origin of the corpus. More...
 
string & get_path () const
 Get the file path associated to the corpus file. More...
 
vector< string > & get_regex_patterns_of_fns_to_keep ()
 Accessor for the regex patterns describing the functions to keep into the public decl table. The other functions not matches by these regexes are dropped from the public decl table. More...
 
const vector< string > & get_regex_patterns_of_fns_to_keep () const
 Accessor for the regex patterns describing the functions to keep into the public decl table. The other functions not matches by these regexes are dropped from the public decl table. More...
 
vector< string > & get_regex_patterns_of_fns_to_suppress ()
 Accessor for the regex patterns describing the functions to drop from the public decl table. More...
 
const vector< string > & get_regex_patterns_of_fns_to_suppress () const
 Accessor for the regex patterns describing the functions to drop from the public decl table. More...
 
vector< string > & get_regex_patterns_of_vars_to_keep ()
 Accessor for the regex patterns describing the variables to keep into the public decl table. The other variables not matches by these regexes are dropped from the public decl table. More...
 
const vector< string > & get_regex_patterns_of_vars_to_keep () const
 Accessor for the regex patterns describing the variables to keep into the public decl table. The other variables not matches by these regexes are dropped from the public decl table. More...
 
vector< string > & get_regex_patterns_of_vars_to_suppress ()
 Accessor for the regex patterns describing the variables to drop from the public decl table. More...
 
const vector< string > & get_regex_patterns_of_vars_to_suppress () const
 Accessor for the regex patterns describing the variables to drop from the public decl table. More...
 
const string & get_soname ()
 Getter for the soname property of the corpus. More...
 
virtual const elf_symbolsget_sorted_fun_symbols () const
 Return a sorted vector of function symbols for this corpus. More...
 
const elf_symbolsget_sorted_undefined_fun_symbols () const
 Getter for a sorted vector of the function symbols undefined in this corpus. More...
 
const functionsget_sorted_undefined_functions () const
 Getter of the sorted vector of undefined functions of the corpus. More...
 
const elf_symbolsget_sorted_undefined_var_symbols () const
 Getter for a sorted vector of the variable symbols undefined in this corpus. More...
 
const variablesget_sorted_undefined_variables () const
 Getter of the sorted vector of undefined variables of the corpus. More...
 
virtual const elf_symbolsget_sorted_var_symbols () const
 Getter for the sorted vector of variable symbols for this corpus. More...
 
vector< string > & get_sym_ids_of_fns_to_keep ()
 Getter for the vector of function symbol IDs to keep. More...
 
const vector< string > & get_sym_ids_of_fns_to_keep () const
 Getter for the vector of function symbol IDs to keep. More...
 
vector< string > & get_sym_ids_of_vars_to_keep ()
 Getter for the vector of variable symbol IDs to keep. More...
 
const vector< string > & get_sym_ids_of_vars_to_keep () const
 Getter for the vector of variable symbol IDs to keep. More...
 
const symtab_reader::symtab_sptrget_symtab () const
 Getter for the symtab object. More...
 
const translation_unitsget_translation_units () const
 Return the list of translation units of the current corpus. More...
 
type_mapsget_type_per_loc_map ()
 Get the maps that associate a location string to a certain kind of type. More...
 
const type_mapsget_type_per_loc_map () const
 Get the maps that associate a location string to a certain kind of type. More...
 
type_mapsget_types ()
 Get the maps that associate a name to a certain kind of type. More...
 
const type_mapsget_types () const
 Get the maps that associate a name to a certain kind of type. More...
 
const vector< type_base_wptr > & get_types_not_reachable_from_public_interfaces () const
 Getter of a sorted vector of the types that are *NOT* reachable from public interfaces. More...
 
const string_elf_symbols_map_typeget_undefined_fun_symbol_map () const
 Getter for the map of function symbols that are undefined in this corpus. More...
 
functions_setget_undefined_functions ()
 Getter of the undefined functions of the corpus. More...
 
const functions_setget_undefined_functions () const
 Getter of the undefined functions of the corpus. More...
 
const string_elf_symbols_map_typeget_undefined_var_symbol_map () const
 Getter for the map of variable symbols that are undefined in this corpus. More...
 
variables_setget_undefined_variables ()
 Getter of the undefined variables of the corpus. More...
 
const variables_setget_undefined_variables () const
 Getter of the undefined variables of the corpus. More...
 
virtual const elf_symbolsget_unreferenced_function_symbols () const
 Getter of the set of function symbols that are not referenced by any function exported by the current corpus. More...
 
virtual const elf_symbolsget_unreferenced_variable_symbols () const
 Getter of the set of variable symbols that are not referenced by any variable exported by the current corpus. More...
 
virtual const string_elf_symbols_map_typeget_var_symbol_map () const
 Getter for the variable symbols map. More...
 
virtual const variablesget_variables () const
 Return the public decl table of the global variables of the current corpus. More...
 
virtual bool is_empty () const
 Tests if the corpus is empty from an ABI surface perspective. I.e. if all of these criteria are true: More...
 
const elf_symbol_sptr lookup_function_symbol (const elf_symbol &symbol) const
 Look in the function symbols map for a symbol with the same name and version as a given symbol. More...
 
const elf_symbol_sptr lookup_function_symbol (const string &n) const
 Look in the function symbols map for a symbol with a given name. More...
 
const elf_symbol_sptr lookup_function_symbol (const string &symbol_name, const elf_symbol::version &version) const
 Look in the function symbols map for a symbol with a given name. More...
 
const std::unordered_set< function_decl * > * lookup_functions (const char *id) const
 
const std::unordered_set< function_decl * > * lookup_functions (const interned_string &id) const
 Lookup the function which has a given function ID. More...
 
const var_decllookup_variable (const interned_string &id) const
 Lookup the exported variable which has a given variable ID. More...
 
const elf_symbol_sptr lookup_variable_symbol (const elf_symbol &symbol) const
 Look in the variable symbols map for a symbol with the same name and version as a given symbol. More...
 
const elf_symbol_sptr lookup_variable_symbol (const string &n) const
 Look in the variable symbols map for a symbol with a given name. More...
 
const elf_symbol_sptr lookup_variable_symbol (const string &symbol_name, const elf_symbol::version &version) const
 Look in the variable symbols map for a symbol with a given name. More...
 
void maybe_drop_some_exported_decls ()
 After the set of exported functions and variables have been built, consider all the tunables that control that set and see if some functions need to be removed from that set; if so, remove them. More...
 
bool operator== (const corpus &) const
 Compare the current corpus against another one. More...
 
void record_type_as_reachable_from_public_interfaces (const type_base &)
 Record a type as being reachable from public interfaces (global functions and variables). More...
 
virtual bool recording_types_reachable_from_public_interface_supported ()
 Test if the recording of reachable types (and thus, indirectly, the recording of non-reachable types) is activated for the current corpus. More...
 
void set_architecture_name (const string &)
 Setter for the architecture name of the corpus. More...
 
void set_format_major_version_number (const string &)
 Setter of the major version number of the abixml serialization format. More...
 
void set_format_minor_version_number (const string &)
 Setter of the minor version number of the abixml serialization format. More...
 
void set_needed (const vector< string > &)
 Setter of the needed property of the corpus. More...
 
void set_origin (origin)
 Setter for the origin of the corpus. More...
 
void set_path (const string &)
 Set the file path associated to the corpus file. More...
 
void set_soname (const string &)
 Setter for the soname property of the corpus. More...
 
void set_symtab (symtab_reader::symtab_sptr)
 Setter for the symtab object. More...
 
void sort_functions ()
 Sort the set of functions exported by this corpus. More...
 
void sort_variables ()
 Sort the set of variables exported by this corpus. More...
 
bool type_is_reachable_from_public_interfaces (const type_base &) const
 Test if a type is reachable from public interfaces (global functions and variables). More...
 

Public Attributes

std::unique_ptr< privpriv_
 

Friends

class corpus_group
 
class type_base
 

Detailed Description

This is the abstraction of a set of translation units (themselves seen as bundles of unitary abi artefacts like types and decls) bundled together as a corpus. A corpus is thus the Application binary interface of a program, a library or just a set of modules put together.

Definition at line 24 of file abg-corpus.h.

Member Typedef Documentation

◆ exported_decls_builder_sptr

Convenience typedef for shared_ptr<exported_decls_builder>.

Definition at line 45 of file abg-corpus.h.

◆ functions

typedef vector<const function_decl*> functions

Convenience typedef for std::vector<abigail::ir::function_decl*>

Definition at line 31 of file abg-corpus.h.

◆ functions_set

typedef std::unordered_set<const function_decl*> functions_set

Convenience typedef for std::unordered_set<const function_decl*>

Definition at line 34 of file abg-corpus.h.

◆ strings_type

typedef vector<string> strings_type

A convenience typedef for std::vector<string>.

Definition at line 28 of file abg-corpus.h.

◆ variables

typedef vector<const var_decl*> variables

Convenience typedef for std::vector<abigail::ir::var_decl*>

Definition at line 37 of file abg-corpus.h.

◆ variables_set

typedef std::unordered_set<const var_decl*> variables_set

Convenience typedef for std::unordered_set<const var_decl*>.

Definition at line 40 of file abg-corpus.h.

Member Enumeration Documentation

◆ origin

enum origin

This abstracts where the corpus comes from. That is, either it has been read from the native xml format, from DWARF or built artificially using the library's API.

Definition at line 50 of file abg-corpus.h.

Constructor & Destructor Documentation

◆ corpus()

corpus ( const ir::environment env,
const string &  path = "" 
)

Constructor of the corpus type.

Parameters
envthe environment of the corpus.
paththe path to the file containing the ABI corpus.

Definition at line 686 of file abg-corpus.cc.

Member Function Documentation

◆ add()

void add ( const translation_unit_sptr tu)

Add a translation unit to the current ABI Corpus.

Note that two translation units with the same path (as returned by translation_unit::get_path) cannot be added to the same corpus. If that happens, the library aborts.

Parameters
tuthe new translation unit to add.

Definition at line 723 of file abg-corpus.cc.

◆ do_log() [1/2]

bool do_log ( ) const

Test if logging was requested.

Returns
true iff logging was requested.

Definition at line 705 of file abg-corpus.cc.

◆ do_log() [2/2]

void do_log ( bool  f)

Request logging, or not.

Parameters
ftrue iff logging is requested.

Definition at line 712 of file abg-corpus.cc.

◆ drop_translation_units()

void drop_translation_units ( )

Erase the translation units contained in this in-memory object.

Note that the on-disk archive file that contains the serialized representation of this object is not modified.

Definition at line 768 of file abg-corpus.cc.

◆ find_translation_unit()

const translation_unit_sptr find_translation_unit ( const string &  path) const

Find the translation unit that has a given path.

Parameters
paththe path of the translation unit to look for.
Returns
the translation unit found, if any. Otherwise, return nil.

Definition at line 753 of file abg-corpus.cc.

◆ get_architecture_name()

const string & get_architecture_name ( ) const

Getter for the architecture name of the corpus.

This property is meaningful for e.g, corpora built from ELF shared library files. In that case, this is a string representation of the Elf{32,64}_Ehdr::e_machine field.

Returns
the architecture name string.

Definition at line 1049 of file abg-corpus.cc.

◆ get_environment()

const environment & get_environment ( ) const

Getter of the enviroment of the corpus.

Returns
the environment of this corpus.

Definition at line 698 of file abg-corpus.cc.

◆ get_exported_decls_builder()

corpus::exported_decls_builder_sptr get_exported_decls_builder ( ) const

Getter for the object that is responsible for determining what decls ought to be in the set of exported decls.

The object does have methods to add the decls to the set of exported decls, right at the place where the corpus expects it, so that there is no unnecessary copying involved.

Returns
a (smart) pointer to the instance of corpus::exported_decls_builder that is responsible for determine what decls ought to be in the set of exported decls.

Definition at line 1731 of file abg-corpus.cc.

◆ get_format_major_version_number()

string & get_format_major_version_number ( ) const

Getter of the major version number of the abixml serialization format.

Returns
the major version number of the abixml format.

Definition at line 943 of file abg-corpus.cc.

◆ get_format_minor_version_number()

string & get_format_minor_version_number ( ) const

Getter of the minor version number of the abixml serialization format.

Returns
the minor version number of the abixml serialization format.

Definition at line 960 of file abg-corpus.cc.

◆ get_fun_symbol_map()

const string_elf_symbols_map_type & get_fun_symbol_map ( ) const
virtual

Getter for the function symbols map.

Returns
a reference to the function symbols map.

Reimplemented in corpus_group.

Definition at line 1133 of file abg-corpus.cc.

◆ get_functions()

const corpus::functions & get_functions ( ) const
virtual

Return the functions public decl table of the current corpus.

The function public decl tables is a vector of all the functions and member functions found in the current corpus.

Note that the caller can suppress some functions from the vector supplying regular expressions describing the set of functions she want to see removed from the public decl table by populating the vector of regular expressions returned by corpus::get_regex_patterns_of_fns_to_suppress().

Returns
the vector of functions of the public decl table. The functions are sorted using their mangled name or name if they don't have mangle names.

Reimplemented in corpus_group.

Definition at line 1379 of file abg-corpus.cc.

◆ get_group() [1/2]

corpus_group * get_group ( )

Getter of the group this corpus belongs to.

Returns
the group this corpus belong to, or nil if it's not part of any corpus_group.

Definition at line 900 of file abg-corpus.cc.

◆ get_group() [2/2]

const corpus_group * get_group ( ) const

Getter of the group this corpus is a member of.

Returns
the group this corpus is a member of, or nil if it's not part of any corpus_group.

Definition at line 892 of file abg-corpus.cc.

◆ get_needed()

const vector< string > & get_needed ( ) const

Getter of the needed property of the corpus.

This property is meaningful for, e.g, corpora built from ELF shared library files. In that case, this is a vector of names of dependencies of the ELF shared library file.

Returns
the vector of dependencies needed by this corpus.

Definition at line 1004 of file abg-corpus.cc.

◆ get_origin()

corpus::origin get_origin ( ) const

Getter for the origin of the corpus.

Returns
the origin of the corpus.

Definition at line 928 of file abg-corpus.cc.

◆ get_path()

string & get_path ( ) const

Get the file path associated to the corpus file.

A subsequent call to corpus::read will deserialize the content of the abi file expected at this path; likewise, a call to corpus::write will serialize the translation units contained in the corpus object into the on-disk file at this path.

Returns
the file path associated to the current corpus.

Definition at line 981 of file abg-corpus.cc.

◆ get_regex_patterns_of_fns_to_keep() [1/2]

vector< string > & get_regex_patterns_of_fns_to_keep ( )

Accessor for the regex patterns describing the functions to keep into the public decl table. The other functions not matches by these regexes are dropped from the public decl table.

Returns
the regex patterns describing the functions to keep into the public decl table.

Definition at line 1617 of file abg-corpus.cc.

◆ get_regex_patterns_of_fns_to_keep() [2/2]

const vector< string > & get_regex_patterns_of_fns_to_keep ( ) const

Accessor for the regex patterns describing the functions to keep into the public decl table. The other functions not matches by these regexes are dropped from the public decl table.

Returns
the regex patterns describing the functions to keep into the public decl table.

Definition at line 1627 of file abg-corpus.cc.

◆ get_regex_patterns_of_fns_to_suppress() [1/2]

vector< string > & get_regex_patterns_of_fns_to_suppress ( )

Accessor for the regex patterns describing the functions to drop from the public decl table.

Returns
the regex patterns describing the functions to drop from the public decl table.

Definition at line 1580 of file abg-corpus.cc.

◆ get_regex_patterns_of_fns_to_suppress() [2/2]

const vector< string > & get_regex_patterns_of_fns_to_suppress ( ) const

Accessor for the regex patterns describing the functions to drop from the public decl table.

Returns
the regex patterns describing the functions to drop from the public decl table.

Definition at line 1589 of file abg-corpus.cc.

◆ get_regex_patterns_of_vars_to_keep() [1/2]

vector< string > & get_regex_patterns_of_vars_to_keep ( )

Accessor for the regex patterns describing the variables to keep into the public decl table. The other variables not matches by these regexes are dropped from the public decl table.

Returns
the regex patterns describing the variables to keep into the public decl table.

Definition at line 1657 of file abg-corpus.cc.

◆ get_regex_patterns_of_vars_to_keep() [2/2]

const vector< string > & get_regex_patterns_of_vars_to_keep ( ) const

Accessor for the regex patterns describing the variables to keep into the public decl table. The other variables not matches by these regexes are dropped from the public decl table.

Returns
the regex patterns describing the variables to keep into the public decl table.

Definition at line 1667 of file abg-corpus.cc.

◆ get_regex_patterns_of_vars_to_suppress() [1/2]

vector< string > & get_regex_patterns_of_vars_to_suppress ( )

Accessor for the regex patterns describing the variables to drop from the public decl table.

Returns
the regex patterns describing the variables to drop from the public decl table.

Definition at line 1598 of file abg-corpus.cc.

◆ get_regex_patterns_of_vars_to_suppress() [2/2]

const vector< string > & get_regex_patterns_of_vars_to_suppress ( ) const

Accessor for the regex patterns describing the variables to drop from the public decl table.

Returns
the regex patterns describing the variables to drop from the public decl table.

Definition at line 1607 of file abg-corpus.cc.

◆ get_soname()

const string & get_soname ( )

Getter for the soname property of the corpus.

This property is meaningful for, e.g, corpora built from ELF shared library files. In that case, this is the shared object name exported by the shared library.

Returns
the soname property of the corpus.

Definition at line 1027 of file abg-corpus.cc.

◆ get_sorted_fun_symbols()

const elf_symbols & get_sorted_fun_symbols ( ) const
virtual

Return a sorted vector of function symbols for this corpus.

Note that the first time this function is called, the symbols are sorted and cached. Subsequent invocations of this function return the cached vector that was built previously.

Returns
the sorted list of function symbols.

Reimplemented in corpus_group.

Definition at line 1154 of file abg-corpus.cc.

◆ get_sorted_undefined_fun_symbols()

const elf_symbols & get_sorted_undefined_fun_symbols ( ) const

Getter for a sorted vector of the function symbols undefined in this corpus.

Returns
a vector of the function symbols undefined in this corpus, sorted by name and then version.

Definition at line 1163 of file abg-corpus.cc.

◆ get_sorted_undefined_functions()

const corpus::functions & get_sorted_undefined_functions ( ) const

Getter of the sorted vector of undefined functions of the corpus.

Returns
a vector of function_decl* representing the functions that are undefined in the corpus.

Definition at line 1505 of file abg-corpus.cc.

◆ get_sorted_undefined_var_symbols()

const elf_symbols & get_sorted_undefined_var_symbols ( ) const

Getter for a sorted vector of the variable symbols undefined in this corpus.

Returns
a vector of the variable symbols undefined in this corpus, sorted by name and then version.

Definition at line 1183 of file abg-corpus.cc.

◆ get_sorted_undefined_variables()

const corpus::variables & get_sorted_undefined_variables ( ) const

Getter of the sorted vector of undefined variables of the corpus.

Returns
a sorted vector of var_decl* representing the variables that are undefined in the corpus.

Definition at line 1537 of file abg-corpus.cc.

◆ get_sorted_var_symbols()

const elf_symbols & get_sorted_var_symbols ( ) const
virtual

Getter for the sorted vector of variable symbols for this corpus.

Note that the first time this function is called, it computes the sorted vector, caches the result and returns it. Subsequent invocations of this function just return the cached vector.

Returns
the sorted vector of variable symbols for this corpus.

Reimplemented in corpus_group.

Definition at line 1174 of file abg-corpus.cc.

◆ get_sym_ids_of_fns_to_keep() [1/2]

vector< string > & get_sym_ids_of_fns_to_keep ( )

Getter for the vector of function symbol IDs to keep.

A symbol ID is a string made of the name of the symbol and its version, separated by one or two '@'.

Returns
a vector of IDs of function symbols to keep.

Definition at line 1637 of file abg-corpus.cc.

◆ get_sym_ids_of_fns_to_keep() [2/2]

const vector< string > & get_sym_ids_of_fns_to_keep ( ) const

Getter for the vector of function symbol IDs to keep.

A symbol ID is a string made of the name of the symbol and its version, separated by one or two '@'.

Returns
a vector of IDs of function symbols to keep.

Definition at line 1647 of file abg-corpus.cc.

◆ get_sym_ids_of_vars_to_keep() [1/2]

vector< string > & get_sym_ids_of_vars_to_keep ( )

Getter for the vector of variable symbol IDs to keep.

A symbol ID is a string made of the name of the symbol and its version, separated by one or two '@'.

Returns
a vector of IDs of variable symbols to keep.

Definition at line 1677 of file abg-corpus.cc.

◆ get_sym_ids_of_vars_to_keep() [2/2]

const vector< string > & get_sym_ids_of_vars_to_keep ( ) const

Getter for the vector of variable symbol IDs to keep.

A symbol ID is a string made of the name of the symbol and its version, separated by one or two '@'.

Returns
a vector of IDs of variable symbols to keep.

Definition at line 1687 of file abg-corpus.cc.

◆ get_symtab()

const symtab_reader::symtab_sptr & get_symtab ( ) const

Getter for the symtab object.

Returns
a shared pointer to the symtab object

Definition at line 1126 of file abg-corpus.cc.

◆ get_translation_units()

const translation_units & get_translation_units ( ) const

Return the list of translation units of the current corpus.

Returns
the list of translation units of the current corpus.

Definition at line 743 of file abg-corpus.cc.

◆ get_type_per_loc_map() [1/2]

type_maps & get_type_per_loc_map ( )

Get the maps that associate a location string to a certain kind of type.

The location string is the result of the invocation to the function abigail::ir::location::expand(). It has the form "file.c:4:1", with 'file.c' being the file name, '4' being the line number and '1' being the column number.

Returns
the maps.

Definition at line 884 of file abg-corpus.cc.

◆ get_type_per_loc_map() [2/2]

const type_maps & get_type_per_loc_map ( ) const

Get the maps that associate a location string to a certain kind of type.

The location string is the result of the invocation to the function abigail::ir::location::expand(). It has the form "file.c:4:1", with 'file.c' being the file name, '4' being the line number and '1' being the column number.

Returns
the maps.

Definition at line 796 of file abg-corpus.cc.

◆ get_types() [1/2]

type_maps & get_types ( )

Get the maps that associate a name to a certain kind of type.

Returns
the maps that associate a name to a certain kind of type.

Definition at line 775 of file abg-corpus.cc.

◆ get_types() [2/2]

const type_maps & get_types ( ) const

Get the maps that associate a name to a certain kind of type.

Returns
the maps that associate a name to a certain kind of type.

Definition at line 783 of file abg-corpus.cc.

◆ get_types_not_reachable_from_public_interfaces()

const vector< type_base_wptr > & get_types_not_reachable_from_public_interfaces ( ) const

Getter of a sorted vector of the types that are *NOT* reachable from public interfaces.

Note that for this to be non-empty, the libabigail reader that analyzed the input (be it a binary or an abixml file) must have be configured to load types that are not reachable from public interfaces.

Returns
a reference to a vector of sorted types NON reachable from public interfaces.

Definition at line 855 of file abg-corpus.cc.

◆ get_undefined_fun_symbol_map()

const string_elf_symbols_map_type & get_undefined_fun_symbol_map ( ) const

Getter for the map of function symbols that are undefined in this corpus.

Returns
the map of function symbols not defined in this corpus. The key of the map is the name of the function symbol. The value is a vector of all the function symbols that have the same name.

Definition at line 1143 of file abg-corpus.cc.

◆ get_undefined_functions() [1/2]

corpus::functions_set & get_undefined_functions ( )

Getter of the undefined functions of the corpus.

Returns
a set of function_decl* representing the functions that are undefined in the corpus.

Definition at line 1497 of file abg-corpus.cc.

◆ get_undefined_functions() [2/2]

const corpus::functions_set & get_undefined_functions ( ) const

Getter of the undefined functions of the corpus.

Undefined functions are functions which symbols are not defined.

Returns
a set of function_decl* representing the functions that are undefined in the corpus.

Definition at line 1489 of file abg-corpus.cc.

◆ get_undefined_var_symbol_map()

const string_elf_symbols_map_type & get_undefined_var_symbol_map ( ) const

Getter for the map of variable symbols that are undefined in this corpus.

Returns
the map of variable symbols not defined in this corpus. The key of the map is the name of the variable symbol. The value is a vector of all the variable symbols that have the same name.

Definition at line 1200 of file abg-corpus.cc.

◆ get_undefined_variables() [1/2]

corpus::variables_set & get_undefined_variables ( )

Getter of the undefined variables of the corpus.

Returns
a set of var_decl* representing the variables that are undefined in the corpus.

Definition at line 1529 of file abg-corpus.cc.

◆ get_undefined_variables() [2/2]

const corpus::variables_set & get_undefined_variables ( ) const

Getter of the undefined variables of the corpus.

Returns
a set of var_decl* representing the variables that are undefined in the corpus.

Definition at line 1521 of file abg-corpus.cc.

◆ get_unreferenced_function_symbols()

const elf_symbols & get_unreferenced_function_symbols ( ) const
virtual

Getter of the set of function symbols that are not referenced by any function exported by the current corpus.

When the corpus has been created from an ELF library or program, this function returns the set of function symbols not referenced by any debug information.

Returns
the vector of function symbols not referenced by any function exported by the current corpus.

Reimplemented in corpus_group.

Definition at line 1558 of file abg-corpus.cc.

◆ get_unreferenced_variable_symbols()

const elf_symbols & get_unreferenced_variable_symbols ( ) const
virtual

Getter of the set of variable symbols that are not referenced by any variable exported by the current corpus.

When the corpus has been created from an ELF library or program, this function returns the set of variable symbols not referenced by any debug information.

Returns
the vector of variable symbols not referenced by any variable exported by the current corpus.

Reimplemented in corpus_group.

Definition at line 1571 of file abg-corpus.cc.

◆ get_var_symbol_map()

const string_elf_symbols_map_type & get_var_symbol_map ( ) const
virtual

Getter for the variable symbols map.

Returns
a reference to the variabl symbols map.

Reimplemented in corpus_group.

Definition at line 1190 of file abg-corpus.cc.

◆ get_variables()

const corpus::variables & get_variables ( ) const
virtual

Return the public decl table of the global variables of the current corpus.

The variable public decls table is a vector of all the public global variables and static member variables found in the current corpus.

Note that the caller can suppress some variables from the vector supplying regular expressions describing the set of variables she wants to see removed from the public decl table by populating the vector of regular expressions returned by corpus::get_regex_patterns_of_fns_to_suppress().

Returns
the vector of variables of the public decl table. The variables are sorted using their name.

Reimplemented in corpus_group.

Definition at line 1461 of file abg-corpus.cc.

◆ is_empty()

bool is_empty ( ) const
virtual

Tests if the corpus is empty from an ABI surface perspective. I.e. if all of these criteria are true:

  • all translation units (members) are empty
  • the maps function and variable symbols are not having entries
  • for shared libraries:
    • the soname is empty
    • there are no DT_NEEDED entries
Returns
true if the corpus contains no translation unit.

Reimplemented in corpus_group.

Definition at line 1073 of file abg-corpus.cc.

◆ lookup_function_symbol() [1/3]

const elf_symbol_sptr lookup_function_symbol ( const elf_symbol symbol) const

Look in the function symbols map for a symbol with the same name and version as a given symbol.

Parameters
symbolthe symbol to look for.

return the symbol with the same name and version as symbol.

Definition at line 1303 of file abg-corpus.cc.

◆ lookup_function_symbol() [2/3]

const elf_symbol_sptr lookup_function_symbol ( const string &  n) const

Look in the function symbols map for a symbol with a given name.

Parameters
nthe name of the symbol to look for.

return the first symbol with the name n.

Definition at line 1209 of file abg-corpus.cc.

◆ lookup_function_symbol() [3/3]

const elf_symbol_sptr lookup_function_symbol ( const string &  symbol_name,
const elf_symbol::version version 
) const

Look in the function symbols map for a symbol with a given name.

Parameters
symbol_namethe name of the symbol to look for.
versionthe version of the symbol to look for.

return the symbol with name symbol_name and with version version, or nil if no symbol has been found with that name and version.

Definition at line 1278 of file abg-corpus.cc.

◆ lookup_functions()

const std::unordered_set< function_decl * > * lookup_functions ( const interned_string id) const

Lookup the function which has a given function ID.

Note that there can have been several functions with the same ID. This is because debug info can declare the same function in several different translation units. Normally, all these function should be equal. But still, this function returns all these functions.

Parameters
idthe ID of the function to lookup. This ID must be either the result of invoking function::get_id() of elf_symbol::get_id_string().
Returns
the set of functions which ID is id, or nil if no function with that ID was found.

Definition at line 1397 of file abg-corpus.cc.

◆ lookup_variable()

const var_decl * lookup_variable ( const interned_string id) const

Lookup the exported variable which has a given variable ID.

Parameters
idthe ID of the variable to look up.
Returns
the variable with ID id that was found or nil if none was found.

Definition at line 1417 of file abg-corpus.cc.

◆ lookup_variable_symbol() [1/3]

const elf_symbol_sptr lookup_variable_symbol ( const elf_symbol symbol) const

Look in the variable symbols map for a symbol with the same name and version as a given symbol.

Parameters
symbolthe symbol to look for.

return the symbol with the same name and version as symbol.

Definition at line 1361 of file abg-corpus.cc.

◆ lookup_variable_symbol() [2/3]

const elf_symbol_sptr lookup_variable_symbol ( const string &  n) const

Look in the variable symbols map for a symbol with a given name.

Parameters
nthe name of the symbol to look for.

return the first symbol with the name n.

Definition at line 1312 of file abg-corpus.cc.

◆ lookup_variable_symbol() [3/3]

const elf_symbol_sptr lookup_variable_symbol ( const string &  symbol_name,
const elf_symbol::version version 
) const

Look in the variable symbols map for a symbol with a given name.

Parameters
symbol_namethe name of the symbol to look for.
symbol_versionthe version of the symbol to look for.

return the first symbol with the name symbol_name and with version version.

Definition at line 1336 of file abg-corpus.cc.

◆ maybe_drop_some_exported_decls()

void maybe_drop_some_exported_decls ( )

After the set of exported functions and variables have been built, consider all the tunables that control that set and see if some functions need to be removed from that set; if so, remove them.

Definition at line 1694 of file abg-corpus.cc.

◆ operator==()

bool operator== ( const corpus other) const

Compare the current corpus against another one.

Parameters
otherthe other corpus to compare against.
Returns
true if the two corpus are equal, false otherwise.

Definition at line 1100 of file abg-corpus.cc.

◆ record_type_as_reachable_from_public_interfaces()

void record_type_as_reachable_from_public_interfaces ( const type_base t)

Record a type as being reachable from public interfaces (global functions and variables).

Parameters
tthe type to record as reachable.

Definition at line 817 of file abg-corpus.cc.

◆ recording_types_reachable_from_public_interface_supported()

bool recording_types_reachable_from_public_interface_supported ( )
virtual

Test if the recording of reachable types (and thus, indirectly, the recording of non-reachable types) is activated for the current corpus.

Returns
true iff the recording of reachable types is activated for the current corpus.

Reimplemented in corpus_group.

Definition at line 806 of file abg-corpus.cc.

◆ set_architecture_name()

void set_architecture_name ( const string &  arch)

Setter for the architecture name of the corpus.

This property is meaningful for e.g, corpora built from ELF shared library files. In that case, this is a string representation of the Elf{32,64}_Ehdr::e_machine field.

Parameters
archthe architecture name string.

Definition at line 1060 of file abg-corpus.cc.

◆ set_format_major_version_number()

void set_format_major_version_number ( const string &  maj)

Setter of the major version number of the abixml serialization format.

Parameters
majthe new major version numberof the abixml format.

Definition at line 951 of file abg-corpus.cc.

◆ set_format_minor_version_number()

void set_format_minor_version_number ( const string &  min)

Setter of the minor version number of the abixml serialization format.

Parameters
minthe new minor version number of the abixml serialization format.

Definition at line 969 of file abg-corpus.cc.

◆ set_needed()

void set_needed ( const vector< string > &  needed)

Setter of the needed property of the corpus.

This property is meaningful for, e.g, corpora built from ELF shared library files. In that case, this is a vector of names of dependencies of the ELF shared library file.

Parameters
neededthe new vector of dependencies needed by this corpus.

Definition at line 1016 of file abg-corpus.cc.

◆ set_origin()

void set_origin ( origin  o)

Setter for the origin of the corpus.

Parameters
othe new origin for the corpus.

Definition at line 935 of file abg-corpus.cc.

◆ set_path()

void set_path ( const string &  path)

Set the file path associated to the corpus file.

A subsequent call to corpus::read will deserialize the content of the abi file expected at this path; likewise, a call to corpus::write will serialize the translation units contained in the corpus object into the on-disk file at this path.

Parameters
paththe new file path to assciate to the current corpus.

Definition at line 993 of file abg-corpus.cc.

◆ set_soname()

void set_soname ( const string &  soname)

Setter for the soname property of the corpus.

This property is meaningful for, e.g, corpora built from ELF shared library files. In that case, this is the shared object name exported by the shared library.

Parameters
sonamethe new soname property of the corpus.

Definition at line 1038 of file abg-corpus.cc.

◆ set_symtab()

void set_symtab ( symtab_reader::symtab_sptr  symtab)

Setter for the symtab object.

Parameters
symtaba shared pointer to the new symtab object

Definition at line 1119 of file abg-corpus.cc.

◆ sort_functions()

void sort_functions ( )

Sort the set of functions exported by this corpus.

Normally, you shouldn't be calling this as the code that creates the corpus for you should do it for you too.

Definition at line 1431 of file abg-corpus.cc.

◆ sort_variables()

void sort_variables ( )

Sort the set of variables exported by this corpus.

Normally, you shouldn't be calling this as the code that creates the corpus for you should do it for you too.

Definition at line 1469 of file abg-corpus.cc.

◆ type_is_reachable_from_public_interfaces()

bool type_is_reachable_from_public_interfaces ( const type_base t) const

Test if a type is reachable from public interfaces (global functions and variables).

For a type to be considered reachable from public interfaces, it must have been previously marked as such by calling corpus::record_type_as_reachable_from_public_interfaces.

Parameters
tthe type to test for.
Returns
true iff t is reachable from public interfaces.

Definition at line 835 of file abg-corpus.cc.


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