libabigail
Loading...
Searching...
No Matches
corpus_group Class Reference

Abstraction of a group of corpora. More...

#include <abg-corpus.h>

Inheritance diagram for corpus_group:
[legend]

Public Types

typedef vector< corpus_sptr > corpora_type
 
- Public Types inherited from corpus
typedef shared_ptr< exported_decls_builderexported_decls_builder_sptr
 Convenience typedef for shared_ptr<exported_decls_builder>.
 
typedef vector< const function_decl * > functions
 Convenience typedef for std::vector<abigail::ir::function_decl*>
 
typedef std::unordered_set< const function_decl * > functions_set
 Convenience typedef for std::unordered_set<const function_decl*>
 
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>.
 
typedef vector< var_decl_sptrvariables
 Convenience typedef for std::vector<abigail::ir::var_decl*>
 
typedef std::unordered_set< var_decl_sptrvariables_set
 Convenience typedef for std::unordered_set<const var_decl*>.
 

Public Member Functions

 corpus_group (const ir::environment &, const string &)
 Constructor of the corpus_group type.
 
virtual ~corpus_group ()
 Desctructor of the corpus_group type.
 
void add_corpus (const corpus_sptr &)
 Add a new corpus to the current instance of corpus_group.
 
const corpora_type & get_corpora () const
 Getter of the vector of corpora held by the current corpus_group.
 
virtual const string_elf_symbols_map_typeget_fun_symbol_map () const
 Get the symbols of the global functions exported by the corpora of the current corpus_group.
 
virtual const corpus::functionsget_functions () const
 Get the functions exported by the corpora of the current corpus group.
 
corpus_sptr get_main_corpus ()
 Getter of the first corpus added to this Group.
 
const corpus_sptr get_main_corpus () const
 Getter of the first corpus added to this Group.
 
unordered_set< interned_string, hash_interned_string > * get_public_types_pretty_representations ()
 Getter of a pointer to the set of types reachable from public interfaces of a given corpus group.
 
virtual const elf_symbolsget_sorted_fun_symbols () const
 Get a sorted vector of the symbols of the functions exported by the corpora of the current group.
 
virtual const elf_symbolsget_sorted_var_symbols () const
 Get a sorted vector of the symbols of the variables exported by the corpora of the current group.
 
virtual const elf_symbolsget_unreferenced_function_symbols () const
 Get the set of function symbols not referenced by any debug info, from all the corpora of the current corpus group.
 
virtual const elf_symbolsget_unreferenced_variable_symbols () const
 Get the set of variable symbols not referenced by any debug info, from all the corpora of the current corpus group.
 
virtual const string_elf_symbols_map_typeget_var_symbol_map () const
 Get the symbols of the global variables exported by the corpora of the current corpus_group.
 
virtual const corpus::variablesget_variables () const
 Get the global variables exported by the corpora of the current corpus group.
 
bool has_corpus (const string &)
 Test if a corpus of a given path has been added to the group.
 
virtual bool is_empty () const
 Test if the current corpus group is empty.
 
bool operator== (const corpus_group &) const
 
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_group.
 
- Public Member Functions inherited from corpus
 corpus (const ir::environment &, const string &path="")
 Constructor of the corpus type.
 
void add (const translation_unit_sptr &)
 Add a translation unit to the current ABI Corpus.
 
bool do_log () const
 Test if logging was requested.
 
void do_log (bool)
 Request logging, or not.
 
void drop_translation_units ()
 Erase the translation units contained in this in-memory object.
 
const translation_unit_sptr find_translation_unit (const string &path) const
 Find the translation unit that has a given path.
 
const string & get_architecture_name () const
 Getter for the architecture name of the corpus.
 
const environmentget_environment () const
 Getter of the enviroment of the 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.
 
string & get_format_major_version_number () const
 Getter of the major version number of the abixml serialization format.
 
string & get_format_minor_version_number () const
 Getter of the minor version number of the abixml serialization format.
 
corpus_groupget_group ()
 Getter of the group this corpus belongs to.
 
const corpus_groupget_group () const
 Getter of the group this corpus is a member of.
 
const vector< string > & get_needed () const
 Getter of the needed property of the corpus.
 
origin get_origin () const
 Getter for the origin of the corpus.
 
string & get_path () const
 Get the file path associated to the corpus file.
 
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.
 
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.
 
vector< string > & get_regex_patterns_of_fns_to_suppress ()
 Accessor for the regex patterns describing the functions to drop from the public decl table.
 
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.
 
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.
 
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.
 
vector< string > & get_regex_patterns_of_vars_to_suppress ()
 Accessor for the regex patterns describing the variables to drop from the public decl table.
 
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.
 
const string & get_soname ()
 Getter for the soname property of the corpus.
 
const elf_symbolsget_sorted_undefined_fun_symbols () const
 Getter for a sorted vector of the function symbols undefined in this corpus.
 
const functionsget_sorted_undefined_functions () const
 Getter of the sorted vector of undefined functions of the corpus.
 
const elf_symbolsget_sorted_undefined_var_symbols () const
 Getter for a sorted vector of the variable symbols undefined in this corpus.
 
const variablesget_sorted_undefined_variables () const
 Getter of the sorted vector of undefined variables of the corpus.
 
vector< string > & get_sym_ids_of_fns_to_keep ()
 Getter for the vector of function symbol IDs to keep.
 
const vector< string > & get_sym_ids_of_fns_to_keep () const
 Getter for the vector of function symbol IDs to keep.
 
vector< string > & get_sym_ids_of_vars_to_keep ()
 Getter for the vector of variable symbol IDs to keep.
 
const vector< string > & get_sym_ids_of_vars_to_keep () const
 Getter for the vector of variable symbol IDs to keep.
 
const symtab_reader::symtab_sptrget_symtab () const
 Getter for the symtab object.
 
const translation_unitsget_translation_units () const
 Return the list of translation units of the current corpus.
 
type_mapsget_type_per_loc_map ()
 Get the maps that associate a location string to a certain kind of type.
 
const type_mapsget_type_per_loc_map () const
 Get the maps that associate a location string to a certain kind of type.
 
type_mapsget_types ()
 Get the maps that associate a name to a certain kind of type.
 
const type_mapsget_types () const
 Get the maps that associate a name to a certain kind of type.
 
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.
 
const string_elf_symbols_map_typeget_undefined_fun_symbol_map () const
 Getter for the map of function symbols that are undefined in this corpus.
 
functions_setget_undefined_functions ()
 Getter of the undefined functions of the corpus.
 
const functions_setget_undefined_functions () const
 Getter of the undefined functions of the corpus.
 
const string_elf_symbols_map_typeget_undefined_var_symbol_map () const
 Getter for the map of variable symbols that are undefined in this corpus.
 
variables_setget_undefined_variables ()
 Getter of the undefined variables of the corpus.
 
const variables_setget_undefined_variables () const
 Getter of the undefined variables of the corpus.
 
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.
 
const elf_symbol_sptr lookup_function_symbol (const string &n) const
 Look in the function symbols map for a symbol with a given name.
 
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.
 
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.
 
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.
 
const elf_symbol_sptr lookup_variable_symbol (const string &n) const
 Look in the variable symbols map for a symbol with a given name.
 
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.
 
const std::unordered_set< var_decl_sptr > * lookup_variables (const char *id) const
 Lookup the exported variables which all have a given variable ID.
 
const std::unordered_set< var_decl_sptr > * lookup_variables (const interned_string &id) const
 Lookup the exported variables which all have a given variable ID.
 
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.
 
bool operator== (const corpus &) const
 Compare the current corpus against another one.
 
void record_type_as_reachable_from_public_interfaces (const type_base &)
 Record a type as being reachable from public interfaces (global functions and variables).
 
void set_architecture_name (const string &)
 Setter for the architecture name of the corpus.
 
void set_format_major_version_number (const string &)
 Setter of the major version number of the abixml serialization format.
 
void set_format_minor_version_number (const string &)
 Setter of the minor version number of the abixml serialization format.
 
void set_needed (const vector< string > &)
 Setter of the needed property of the corpus.
 
void set_origin (origin)
 Setter for the origin of the corpus.
 
void set_path (const string &)
 Set the file path associated to the corpus file.
 
void set_soname (const string &)
 Setter for the soname property of the corpus.
 
void set_symtab (symtab_reader::symtab_sptr)
 Setter for the symtab object.
 
void sort_functions ()
 Sort the set of functions exported by this corpus.
 
void sort_variables ()
 Sort the set of variables exported by this corpus.
 
bool type_is_reachable_from_public_interfaces (const type_base &) const
 Test if a type is reachable from public interfaces (global functions and variables).
 

Additional Inherited Members

- Public Attributes inherited from corpus
std::unique_ptr< privpriv_
 

Detailed Description

Abstraction of a group of corpora.

A corpus group is a union of corpora. It provides a unified view of a set of corpora. It lets you get the set of functions, variables and symbols that are defined and exported by a set of corpora.

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

Member Typedef Documentation

◆ corpora_type

vector<corpus_sptr> corpora_type

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

Constructor & Destructor Documentation

◆ corpus_group()

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

Constructor of the corpus_group type.

Parameters
envthe environment of the corpus_group.
paththe path to the file represented by the corpus group.

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

◆ ~corpus_group()

~corpus_group ( )
virtual

Desctructor of the corpus_group type.

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

Member Function Documentation

◆ add_corpus()

void add_corpus ( const corpus_sptr & corp)

Add a new corpus to the current instance of corpus_group.

Parameters
corpthe new corpus to add.

Add the unreferenced function and variable symbols of this corpus to the unreferenced symbols of the current corpus group.

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

◆ get_corpora()

const corpus_group::corpora_type & get_corpora ( ) const

Getter of the vector of corpora held by the current corpus_group.

Returns
the vector corpora.

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

◆ get_fun_symbol_map()

const string_elf_symbols_map_type & get_fun_symbol_map ( ) const
virtual

Get the symbols of the global functions exported by the corpora of the current corpus_group.

Returns
the symbols of the global functions exported by the corpora

Reimplemented from corpus.

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

◆ get_functions()

const corpus::functions & get_functions ( ) const
virtual

Get the functions exported by the corpora of the current corpus group.

Upon its first invocation, this function walks the corpora contained in the corpus group and caches the functions they exported.

Subsequent invocations just return the cached functions.

Returns
the exported functions.

Reimplemented from corpus.

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

◆ get_main_corpus() [1/2]

corpus_sptr get_main_corpus ( )

Getter of the first corpus added to this Group.

Returns
the first corpus added to this Group.

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

◆ get_main_corpus() [2/2]

const corpus_sptr get_main_corpus ( ) const

Getter of the first corpus added to this Group.

Returns
the first corpus added to this Group.

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

◆ get_public_types_pretty_representations()

unordered_set< interned_string, hash_interned_string > * get_public_types_pretty_representations ( )

Getter of a pointer to the set of types reachable from public interfaces of a given corpus group.

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

◆ get_sorted_fun_symbols()

const elf_symbols & get_sorted_fun_symbols ( ) const
virtual

Get a sorted vector of the symbols of the functions exported by the corpora of the current group.

Returns
the sorted vectors of the exported function symbols.

Reimplemented from corpus.

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

◆ get_sorted_var_symbols()

const elf_symbols & get_sorted_var_symbols ( ) const
virtual

Get a sorted vector of the symbols of the variables exported by the corpora of the current group.

Returns
the sorted vectors of the exported variable symbols.

Reimplemented from corpus.

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

◆ get_unreferenced_function_symbols()

const elf_symbols & get_unreferenced_function_symbols ( ) const
virtual

Get the set of function symbols not referenced by any debug info, from all the corpora of the current corpus group.

Upon its first invocation, this function possibly walks all the copora of this corpus group and caches the unreferenced symbols they export. The function then returns the cache.

Upon subsequent invocations, this functions just returns the cached symbols.

Returns
the unreferenced symbols.

Reimplemented from corpus.

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

◆ get_unreferenced_variable_symbols()

const elf_symbols & get_unreferenced_variable_symbols ( ) const
virtual

Get the set of variable symbols not referenced by any debug info, from all the corpora of the current corpus group.

Upon its first invocation, this function possibly walks all the copora of this corpus group and caches the unreferenced symbols they export. The function then returns the cache.

Upon subsequent invocations, this functions just returns the cached symbols.

Returns
the unreferenced symbols.

Reimplemented from corpus.

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

◆ get_var_symbol_map()

const string_elf_symbols_map_type & get_var_symbol_map ( ) const
virtual

Get the symbols of the global variables exported by the corpora of the current corpus_group.

Returns
the symbols of the global variables exported by the corpora

Reimplemented from corpus.

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

◆ get_variables()

const corpus::variables & get_variables ( ) const
virtual

Get the global variables exported by the corpora of the current corpus group.

Upon its first invocation, this function walks the corpora contained in the corpus group and caches the variables they export.

Returns
the exported variables.

Reimplemented from corpus.

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

◆ has_corpus()

bool has_corpus ( const string & path)

Test if a corpus of a given path has been added to the group.

Parameters
paththe path to the corpus to consider.
Returns
true iff a corpus with path path is already present in the groupâ‹…

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

◆ is_empty()

bool is_empty ( ) const
virtual

Test if the current corpus group is empty.

Returns
true iff the current corpus group is empty.

Reimplemented from corpus.

Definition at line 1990 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_group.

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

Reimplemented from corpus.

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


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