libabigail
|
An abstraction of a diff between between two abi corpus. More...
#include <abg-comparison.h>
Classes | |
class | diff_stats |
This is a document class that aims to capture statistics about the changes carried by a corpus_diff type. More... | |
struct | priv |
Public Types | |
typedef shared_ptr< diff_stats > | diff_stats_sptr |
A convenience typedef for a shared pointer to diff_stats. More... | |
Public Member Functions | |
const string_function_ptr_map & | added_functions () |
Getter for the added functions of the diff. More... | |
const string_type_base_sptr_map & | added_unreachable_types () const |
Getter for a map of added types that are not reachable from global functions/variables. More... | |
const vector< type_base_sptr > & | added_unreachable_types_sorted () const |
Getter of a sorted vector of added types that are not reachable from global functions/variables. More... | |
const string_elf_symbol_map & | added_unrefed_function_symbols () const |
Getter for function symbols not referenced by any debug info and that got added. More... | |
const string_elf_symbol_map & | added_unrefed_variable_symbols () const |
Getter for variable symbols not referenced by any debug info and that got added. More... | |
const string_var_ptr_map & | added_variables () const |
Getter for the added variables of the diff. More... | |
void | append_child_node (diff_sptr) |
Append a new child node to the vector of children nodes for the current instance of corpus_diff node. More... | |
const diff_stats & | apply_filters_and_suppressions_before_reporting () |
Apply the different filters that are registered to be applied to the diff tree; that includes the categorization filters. Also, apply the suppression interpretation filters. More... | |
bool | architecture_changed () const |
Test if the architecture of the underlying corpus has changed. More... | |
virtual void | chain_into_hierarchy () |
Populate the vector of children node of the corpus_diff type. More... | |
const string_function_decl_diff_sptr_map & | changed_functions () const |
Getter for the functions which signature didn't change, but which do have some indirect changes in their parms. More... | |
const function_decl_diff_sptrs_type & | changed_functions_sorted () const |
Getter for a sorted vector of functions which signature didn't change, but which do have some indirect changes in their parms. More... | |
const string_diff_sptr_map & | changed_unreachable_types () const |
Getter for a map of changed types that are not reachable from global functions/variables. More... | |
const vector< diff_sptr > & | changed_unreachable_types_sorted () const |
Getter of a sorted vector of changed types that are not reachable from global functions/variables. More... | |
const string_var_diff_sptr_map & | changed_variables () |
Getter for the non-sorted map of variables which signature didn't change but which do have some indirect changes in some sub-types. More... | |
const var_diff_sptrs_type & | changed_variables_sorted () |
Getter for the sorted vector of variables which signature didn't change but which do have some indirect changes in some sub-types. More... | |
const vector< diff * > & | children_nodes () const |
const diff_context_sptr | context () const |
Getter of the diff context of this diff. More... | |
const string_function_ptr_map & | deleted_functions () const |
Getter for the deleted functions of the diff. More... | |
const string_type_base_sptr_map & | deleted_unreachable_types () const |
Getter for a map of deleted types that are not reachable from global functions/variables. More... | |
const vector< type_base_sptr > & | deleted_unreachable_types_sorted () const |
Getter of a sorted vector of deleted types that are not reachable from global functions/variables. More... | |
const string_elf_symbol_map & | deleted_unrefed_function_symbols () const |
Getter for function symbols not referenced by any debug info and that got deleted. More... | |
const string_elf_symbol_map & | deleted_unrefed_variable_symbols () const |
Getter for variable symbols not referenced by any debug info and that got deleted. More... | |
const string_var_ptr_map & | deleted_variables () const |
Getter for the variables that got deleted from the first subject of the diff. More... | |
bool | do_log () const |
Test if logging was requested. More... | |
void | do_log (bool) |
Request logging, or not. More... | |
corpus_sptr | first_corpus () const |
edit_script & | function_changes () const |
diff_maps & | get_leaf_diffs () |
Get the set of maps that contain leaf nodes. A leaf node being a node with a local change. More... | |
const diff_maps & | get_leaf_diffs () const |
Get the set of maps that contain leaf nodes. A leaf node being a node with a local change. More... | |
const string & | get_pretty_representation () const |
bool | has_changes () const |
Return true iff the current corpus_diff node carries a change. More... | |
bool | has_incompatible_changes () const |
Test if the current instance of corpus_diff carries changes that we are sure are incompatible. By incompatible change we mean a change that "breaks" the ABI of the corpus we are looking at. More... | |
bool | has_net_changes () const |
Test if the current instance of corpus_diff carries changes whose reports are not suppressed by any suppression specification. In effect, these are deemed incompatible ABI changes. More... | |
bool | has_net_subtype_changes () const |
Test if the current instance of corpus_diff carries subtype changes whose reports are not suppressed by any suppression specification. In effect, these are deemed incompatible ABI changes. More... | |
function_decl_diff_sptrs_type & | incompatible_changed_functions () |
Getter of the set of diff nodes representing incompatibly changed functions. More... | |
const function_decl_diff_sptrs_type & | incompatible_changed_functions () const |
Getter of the set of diff nodes representing incompatibly changed functions. More... | |
var_diff_sptrs_type & | incompatible_changed_variables () |
Getter of the set of diff nodes representing incompatibly changed global variables. More... | |
const var_diff_sptrs_type & | incompatible_changed_variables () const |
Getter of the set of diff nodes representing incompatibly changed global variables. More... | |
void | mark_leaf_diff_nodes () |
Walks the diff nodes associated to the current corpus diff and mark those that carry local changes. They are said to be leaf diff nodes. More... | |
virtual void | report (ostream &out, const string &indent="") const |
Report the diff in a serialized form. More... | |
corpus_sptr | second_corpus () const |
bool | soname_changed () const |
Test if the soname of the underlying corpus has changed. More... | |
virtual bool | traverse (diff_node_visitor &v) |
Traverse the diff sub-tree under the current instance corpus_diff. More... | |
edit_script & | variable_changes () const |
Protected Member Functions | |
corpus_diff (corpus_sptr first, corpus_sptr second, diff_context_sptr ctxt=diff_context_sptr()) | |
Constructor for corpus_diff. More... | |
void | finish_diff_type () |
Finish building the current instance of corpus_diff. More... | |
Friends | |
void | apply_suppressions (const corpus_diff *diff_tree) |
Walk a corpus_diff tree and appply the suppressions carried by the context. If the suppression applies to a given node then categorize the node into the SUPPRESSED_CATEGORY category and propagate that categorization. More... | |
corpus_diff_sptr | compute_diff (const corpus_sptr f, const corpus_sptr s, diff_context_sptr ctxt) |
Compute the diff between two instances of corpus. More... | |
class | default_reporter |
class | leaf_reporter |
void | maybe_report_unreachable_type_changes (const corpus_diff &d, const corpus_diff::diff_stats &s, const string &indent, ostream &out) |
Report changes about types that are not reachable from global functions and variables, in a given. More... | |
An abstraction of a diff between between two abi corpus.
Definition at line 2485 of file abg-comparison.h.
typedef shared_ptr<diff_stats> diff_stats_sptr |
A convenience typedef for a shared pointer to diff_stats.
Definition at line 2505 of file abg-comparison.h.
|
protected |
Constructor for corpus_diff.
first | the first corpus of the diff. |
second | the second corpus of the diff. |
ctxt | the diff context to use. Note that this context object must stay alive at least during the life time of the current instance of corpus_diff. Otherwise memory corruption issues occur. |
Definition at line 11703 of file abg-comparison.cc.
const string_function_ptr_map & added_functions | ( | ) |
Getter for the added functions of the diff.
Definition at line 11828 of file abg-comparison.cc.
const string_type_base_sptr_map & added_unreachable_types | ( | ) | const |
Getter for a map of added types that are not reachable from global functions/variables.
Definition at line 11987 of file abg-comparison.cc.
const vector< type_base_sptr > & added_unreachable_types_sorted | ( | ) | const |
Getter of a sorted vector of added types that are not reachable from global functions/variables.
Definition at line 11997 of file abg-comparison.cc.
const string_elf_symbol_map & added_unrefed_function_symbols | ( | ) | const |
Getter for function symbols not referenced by any debug info and that got added.
Definition at line 11934 of file abg-comparison.cc.
const string_elf_symbol_map & added_unrefed_variable_symbols | ( | ) | const |
Getter for variable symbols not referenced by any debug info and that got added.
Definition at line 11952 of file abg-comparison.cc.
const string_var_ptr_map & added_variables | ( | ) | const |
Getter for the added variables of the diff.
Definition at line 11882 of file abg-comparison.cc.
void append_child_node | ( | diff_sptr | d | ) |
Append a new child node to the vector of children nodes for the current instance of corpus_diff node.
Note that the vector of children nodes for the current instance of corpus_diff node must remain sorted, using diff_less_than_functor.
d | the new child node. Note that the life time of the object held by d will thus equal the life time of the current instance of corpus_diff. |
Definition at line 11761 of file abg-comparison.cc.
const corpus_diff::diff_stats & apply_filters_and_suppressions_before_reporting | ( | ) |
Apply the different filters that are registered to be applied to the diff tree; that includes the categorization filters. Also, apply the suppression interpretation filters.
After the filters are applied, this function calculates some statistics about the changes carried by the current instance of corpus_diff. These statistics are represented by an instance of corpus_diff::diff_stats.
This member function is called by the reporting function corpus_diff::report().
Note that for a given instance of corpus_diff, this function applies the filters and suppressions only the first time it is invoked. Subsequent invocations just return the instance of corpus_diff::diff_stats that was cached after the first invocation.
Definition at line 12196 of file abg-comparison.cc.
bool architecture_changed | ( | ) | const |
Test if the architecture of the underlying corpus has changed.
Definition at line 11814 of file abg-comparison.cc.
|
virtual |
Populate the vector of children node of the corpus_diff type.
The children node can then later be retrieved using corpus_diff::children_node().
Definition at line 11683 of file abg-comparison.cc.
const string_function_decl_diff_sptr_map & changed_functions | ( | ) | const |
Getter for the functions which signature didn't change, but which do have some indirect changes in their parms.
Definition at line 11840 of file abg-comparison.cc.
const function_decl_diff_sptrs_type & changed_functions_sorted | ( | ) | const |
Getter for a sorted vector of functions which signature didn't change, but which do have some indirect changes in their parms.
Definition at line 11849 of file abg-comparison.cc.
const string_diff_sptr_map & changed_unreachable_types | ( | ) | const |
Getter for a map of changed types that are not reachable from global functions/variables.
Definition at line 12013 of file abg-comparison.cc.
const vector< diff_sptr > & changed_unreachable_types_sorted | ( | ) | const |
Getter of a sorted vector of changed types that are not reachable from global functions/variables.
Definition at line 12023 of file abg-comparison.cc.
const string_var_diff_sptr_map & changed_variables | ( | ) |
Getter for the non-sorted map of variables which signature didn't change but which do have some indirect changes in some sub-types.
Definition at line 11890 of file abg-comparison.cc.
const var_diff_sptrs_type & changed_variables_sorted | ( | ) |
Getter for the sorted vector of variables which signature didn't change but which do have some indirect changes in some sub-types.
Definition at line 11898 of file abg-comparison.cc.
const vector< diff * > & children_nodes | ( | ) | const |
Definition at line 11747 of file abg-comparison.cc.
const diff_context_sptr context | ( | ) | const |
Getter of the diff context of this diff.
Definition at line 12030 of file abg-comparison.cc.
const string_function_ptr_map & deleted_functions | ( | ) | const |
Getter for the deleted functions of the diff.
Definition at line 11821 of file abg-comparison.cc.
const string_type_base_sptr_map & deleted_unreachable_types | ( | ) | const |
Getter for a map of deleted types that are not reachable from global functions/variables.
Definition at line 11961 of file abg-comparison.cc.
const vector< type_base_sptr > & deleted_unreachable_types_sorted | ( | ) | const |
Getter of a sorted vector of deleted types that are not reachable from global functions/variables.
Definition at line 11971 of file abg-comparison.cc.
const string_elf_symbol_map & deleted_unrefed_function_symbols | ( | ) | const |
Getter for function symbols not referenced by any debug info and that got deleted.
Definition at line 11925 of file abg-comparison.cc.
const string_elf_symbol_map & deleted_unrefed_variable_symbols | ( | ) | const |
Getter for variable symbols not referenced by any debug info and that got deleted.
Definition at line 11943 of file abg-comparison.cc.
const string_var_ptr_map & deleted_variables | ( | ) | const |
Getter for the variables that got deleted from the first subject of the diff.
Definition at line 11875 of file abg-comparison.cc.
bool do_log | ( | ) | const |
Test if logging was requested.
Definition at line 11725 of file abg-comparison.cc.
void do_log | ( | bool | f | ) |
Request logging, or not.
f | true iff logging is requested. |
Definition at line 11732 of file abg-comparison.cc.
|
protected |
Finish building the current instance of corpus_diff.
Definition at line 11713 of file abg-comparison.cc.
corpus_sptr first_corpus | ( | ) | const |
Definition at line 11737 of file abg-comparison.cc.
edit_script & function_changes | ( | ) | const |
Definition at line 11794 of file abg-comparison.cc.
diff_maps & get_leaf_diffs | ( | ) |
Get the set of maps that contain leaf nodes. A leaf node being a node with a local change.
Definition at line 12359 of file abg-comparison.cc.
const diff_maps & get_leaf_diffs | ( | ) | const |
Get the set of maps that contain leaf nodes. A leaf node being a node with a local change.
Definition at line 12368 of file abg-comparison.cc.
const string & get_pretty_representation | ( | ) | const |
Definition at line 12036 of file abg-comparison.cc.
bool has_changes | ( | ) | const |
Return true iff the current corpus_diff node carries a change.
Definition at line 12055 of file abg-comparison.cc.
bool has_incompatible_changes | ( | ) | const |
Test if the current instance of corpus_diff carries changes that we are sure are incompatible. By incompatible change we mean a change that "breaks" the ABI of the corpus we are looking at.
In concrete terms, this function considers the following changes as being ABI incompatible for sure:
Note that subtype changes *can* represent changes that break ABI too. But they also can be changes that are OK, ABI-wise.
It's up to the user to provide suppression specifications to say explicitely which subtype change is OK. The remaining sub-type changes are then considered to be ABI incompatible. But to test if such ABI incompatible subtype changes are present you need to use the function corpus_diff::has_net_subtype_changes()
Definition at line 12096 of file abg-comparison.cc.
bool has_net_changes | ( | ) | const |
Test if the current instance of corpus_diff carries changes whose reports are not suppressed by any suppression specification. In effect, these are deemed incompatible ABI changes.
Definition at line 12172 of file abg-comparison.cc.
bool has_net_subtype_changes | ( | ) | const |
Test if the current instance of corpus_diff carries subtype changes whose reports are not suppressed by any suppression specification. In effect, these are deemed incompatible ABI changes.
Definition at line 12154 of file abg-comparison.cc.
function_decl_diff_sptrs_type & incompatible_changed_functions | ( | ) |
Getter of the set of diff nodes representing incompatibly changed functions.
Definition at line 11867 of file abg-comparison.cc.
const function_decl_diff_sptrs_type & incompatible_changed_functions | ( | ) | const |
Getter of the set of diff nodes representing incompatibly changed functions.
Definition at line 11858 of file abg-comparison.cc.
var_diff_sptrs_type & incompatible_changed_variables | ( | ) |
Getter of the set of diff nodes representing incompatibly changed global variables.
Definition at line 11916 of file abg-comparison.cc.
const var_diff_sptrs_type & incompatible_changed_variables | ( | ) | const |
Getter of the set of diff nodes representing incompatibly changed global variables.
Definition at line 11907 of file abg-comparison.cc.
void mark_leaf_diff_nodes | ( | ) |
Walks the diff nodes associated to the current corpus diff and mark those that carry local changes. They are said to be leaf diff nodes.
The marked nodes are available from the corpus_diff::get_leaf_diffs() function.
Definition at line 12334 of file abg-comparison.cc.
|
virtual |
Report the diff in a serialized form.
out | the stream to serialize the diff to. |
indent | the prefix to use for the indentation of this serialization. |
Definition at line 12378 of file abg-comparison.cc.
corpus_sptr second_corpus | ( | ) | const |
Definition at line 11742 of file abg-comparison.cc.
bool soname_changed | ( | ) | const |
Test if the soname of the underlying corpus has changed.
Definition at line 11807 of file abg-comparison.cc.
|
virtual |
Traverse the diff sub-tree under the current instance corpus_diff.
v | the visitor to invoke on each diff node of the sub-tree. |
Definition at line 12389 of file abg-comparison.cc.
edit_script & variable_changes | ( | ) | const |
Definition at line 11800 of file abg-comparison.cc.
|
friend |
Walk a corpus_diff tree and appply the suppressions carried by the context. If the suppression applies to a given node then categorize the node into the SUPPRESSED_CATEGORY category and propagate that categorization.
diff_tree | the diff tree to apply the suppressions to. |
Definition at line 13357 of file abg-comparison.cc.
|
friend |
Compute the diff between two instances of corpus.
Note that the two corpora must have been created in the same environment, otherwise, this function aborts.
f | the first corpus to consider for the diff. |
s | the second corpus to consider for the diff. |
ctxt | the diff context to use. |
Definition at line 12485 of file abg-comparison.cc.
|
friend |
Definition at line 2656 of file abg-comparison.h.
|
friend |
Definition at line 2657 of file abg-comparison.h.
|
friend |
Report changes about types that are not reachable from global functions and variables, in a given.
corpus_diff. | |
d | the corpus_diff to consider. |
s | the statistics of the changes, after filters and suppressions are reported. This is typically what is returned by corpus_diff::apply_filters_and_suppressions_before_reporting(). |
indent | the indendation string (usually a string of white spaces) to use for indentation during the reporting. |
out | the output stream to emit the report to. |
Definition at line 1363 of file abg-reporter-priv.cc.