libabigail
Public Types | Public Member Functions | List of all members
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>. 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_group (const ir::environment &, const string &)
 Constructor of the corpus_group type. More...
 
virtual ~corpus_group ()
 Desctructor of the corpus_group type. More...
 
void add_corpus (const corpus_sptr &)
 Add a new corpus to the current instance of corpus_group. More...
 
const corpora_type & get_corpora () const
 Getter of the vector of corpora held by the current corpus_group. More...
 
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. More...
 
virtual const corpus::functionsget_functions () const
 Get the functions exported by the corpora of the current corpus group. More...
 
corpus_sptr get_main_corpus ()
 Getter of the first corpus added to this Group. More...
 
const corpus_sptr get_main_corpus () const
 Getter of the first corpus added to this Group. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual const corpus::variablesget_variables () const
 Get the global variables exported by the corpora of the current corpus group. More...
 
bool has_corpus (const string &)
 Test if a corpus of a given path has been added to the group. More...
 
virtual bool is_empty () const
 Test if the current corpus group is empty. More...
 
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. More...
 
- Public Member Functions inherited from corpus
 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...
 
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...
 
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...
 
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...
 
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...
 
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...
 

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 382 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 1884 of file abg-corpus.cc.

◆ ~corpus_group()

~corpus_group ( )
virtual

Desctructor of the corpus_group type.

Definition at line 1889 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 1896 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 1947 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 2074 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 1985 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 1961 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 1954 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 2239 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 2091 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 2123 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 2162 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 2205 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 2057 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 2023 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 1935 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 1972 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 2249 of file abg-corpus.cc.


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