Dodji Seketeli [Wed, 7 Jan 2015 12:45:53 +0000 (13:45 +0100)]
Detect and report changes in ELF architecture
Libabigail does not take in account the architecture of the ELF file
it reads. This patch changes that to represent the ELF architecture
as a string, detect when that architecture changes accross two corpora
being compared and emit a report about that change.
* configure.ac: Detect the presence of libebl.a and add it to the
list of library we depend on to build libabigail. Report when
libelf.so is not found.
* include/abg-comparison.h:
(diff_context::show_architecture_change): Declare new accessors.
(corpus_diff::architecture_changed): Declare new method.
* include/abg-corpus.h (corpus::{get,set}_architecture_name):
Declare new accessors.
* src/abg-comparison.cc
(diff_context::priv::show_architecture_change_): New data member.
(diff_context::priv::priv): Initialize it.
(diff_context::show_architecture_change): Define new accessors.
(function_decl_diff::report): Report when the size/alignment of
the function address changes.
(corpus_diff::priv::architectures_equal_): New data member.
(corpus_diff::priv::priv): Initialize it.
(corpus_diff::priv::emit_diff_stats): Take in account changes of
architecture.
(corpus_diff::architecture_changed): Define new method.
(corpus_diff::length): Take in account changes of architecture.
(corpus_diff::report): Report about changes of architecture.
(compute_diff): In the overload for corpus_diff_sptr, detect
changes fo architecture.
* src/abg-corpus.cc (corpus_priv::architecture_name): Define new
data member.
(corpus::{get,set}_architecture_name): Define new method.
* src/abg-dwarf-reader.cc: Include elfutils/libebl.h to use
ebl_openbackend() and ebl_backend_name()
(read_context::elf_architecture_): Define new data member.
(read_context::elf_architecture): Define new accessor.
(read_context::{load_elf_architecture, load_remaining_elf_data}):
Define new methods.
(read_corpus_from_elf): Use ctxt.load_remaining_elf_data() in lieu
of ctxt.load_dt_soname_and_needed. Stick the architecture into
the corpus.
* src/abg-reader.cc (read_corpus_from_input): Read the
'architecture' XML property.
* src/abg-writer.cc (write_corpus_to_native_xml): Write the
'architecture' XML property.
* tests/data/test-diff-dwarf/libtest-23-diff-arch-v0-32.so: New
test input file.
* tests/data/test-diff-dwarf/libtest-23-diff-arch-v0-64.so:
Likewise.
* tests/data/test-diff-dwarf/test-23-diff-arch-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test-23-diff-arch-v0.cc: Source code
for the binary test input files above.
* tests/data/Makefile.am: Add the new test input files to the
source distribution.
* tests/test-diff-dwarf.cc (in_out_specs): Add the new test input
data to the set of input data to run this test harness over.
* tests/test-read-dwarf.cc (main): Do not take the architecture in
account during comparisons.
Dodji Seketeli [Sat, 27 Dec 2014 11:42:34 +0000 (12:42 +0100)]
Add a --dump-diff-tree to abidiff for debugging purposes
I have felt the need to emit a textual representation of the diff
nodes tree maintained by the comparison engine for changed functions
and variables. This patch adds that functionality.
* include/abg-comparison.h (enum visiting_kind): Add new
DO_NOT_MARK_VISITED_NODES_AS_TRAVERSED enumerator.
(diff_context::{default_output_stream, error_output_stream,
dump_diff_tree}): Declare new accessors.
(diff::end_traversing): Take a new boolean flag.
(print_diff_tree): Add new overload for diff_sptr.
* src/abg-comparison.cc
(diff_context::priv::{default_output_stream_,
error_output_stream_, dump_diff_tree_}): New data members.
(priv::priv): Initialize them.
(diff_context::{default_output_stream_, error_output_stream_,
dump_diff_tree, dump_diff_tree}): Define new accessors.
(diff::end_traversing): Take a new flag that control whether or
not to mark the current diff node as having been traversed.
(diff::traverse): Take in account the visiting kind carried by the
visitor to determine if the visited node should be marked as being
traversed.
(corpus_diff::priv::maybe_dump_diff_tree): Define new member
function.
(corpus_diff::report): Call it.
(diff_node_printer::visit): Pretty print the diff node just once.
(print_diff_tree): Define a new overload for diff_sptr.
* tools/abidiff.cc (options::dump_diff_tree): New data member.
(options::options): Initialize it.
(display_usage): Add a help string for the new --dump-diff-tree
command line switch.
(parse_command_line): Parse the new --dump-diff-tree command line
switch.
(set_diff_context_from_opts): Set the diff context according to
the --dump-diff-tree presence.
* doc/manuals/abidiff.rst: Add a bullet point for the new
--dump-diff-tree command line switch.
Dodji Seketeli [Fri, 26 Dec 2014 18:15:24 +0000 (19:15 +0100)]
Fix the doc string of the CanonicalDiff section of the apidoc
* src/abg-comparison.cc: The summary of the CanonicalDiff should
not be a @par directive, otherwise it won't show up in the summary
field on the html-genereated page.
Dodji Seketeli [Fri, 26 Dec 2014 14:50:06 +0000 (15:50 +0100)]
Make abidiff *NOT* show redundant changes by default
Now that we are handling redundant diff node marking (and reporting)
with more finesse, I guess we can enable redundant diff reporting
elision by default again.
* tools/abidiff.cc (options::options): Initialize
options::show_redundant_changes to false.
Dodji Seketeli [Fri, 26 Dec 2014 17:28:20 +0000 (18:28 +0100)]
Try harder to handle pointer/reference to void
When a pointer_type_def or reference_type_def is initialized with an
empty pointed-to type, we want consider that as a pointer/reference to
void.
This patch does that. That helps to avoids to later crash because the
pointed-to-type is empty. Also, this patch fixes spots where the
pointed-to-type seems nonetheless empty.
I have used the two different versions of libstdc++ from RHEL 6.5 and RHEL
7 to spot and fix these issues.
* include/abg-fwd.h (type_or_void): Declare new function.
* src/abg-ir.cc (type_or_void): Define it.
(pointer_type_def::pointer_type_def)
(reference_type_def::reference_type_def)
(reference_type_def::get_qualified_name, strip_typedef): Use it to
ensure that empty pointed-to-type is considered as a void type.
Dodji Seketeli [Fri, 26 Dec 2014 13:46:27 +0000 (14:46 +0100)]
Do not mark sibling structurally identical nodes as redundant
Consider the C code below:
int
foo(int a, int b)
{
}
that is changed as:
float
foo(float a, float b)
{
}
In this case, we want the 'abidiff' tool to report the three
occurrences of the 'int' -> 'float' change (in the return type and in
the two parameter changes of the function foo).
In the current code, the comparison engine only reports the first
occurrence of the change and consider the two other occurrences as
being redundant. So, by default, it only reports the first occurrence
of the change.
This patch modifies the comparison engine to make it *NOT* mark the
two later occurrences of change as redundant because the three
occurrences of changes happen at the same logical level: they are all
children of the function diff node in the diff tree.
* include/abg-comparison.h (diff::parent_node): Declare new
accessor.
* src/abg-comparison.cc (diff::priv::parent_): New data member.
(diff::priv::priv): Initialize it.
(diff::parent_node): Define new accessor.
(diff::append_child_node): Set the diff::priv::parent_ data member
of the added child node.
(redundancy_marking_visitor::visit_begin): If two (logical)
sibbling nodes are structurally equivalent, do not mark them as
being redundant.
* tests/data/test-diff-suppr/libtest10-changed-parm-c-v0.so: New
test input binary.
* tests/data/test-diff-suppr/libtest10-changed-parm-c-v1.so:
Likewise.
* tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt:
New test input data.
* tests/data/test-diff-suppr/test10-changed-parm-c-v0.c: Source
code for the binary input above.
* tests/data/test-diff-suppr/test10-changed-parm-c-v1.c: Likewise.
* tests/data/Makefile.am: Add the new test files to source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
to the vector of test inputs to run this harness over.
Dodji Seketeli [Fri, 26 Dec 2014 12:22:16 +0000 (13:22 +0100)]
Un-share diff nodes in the comparison IR
Until now, the diff nodes of the comparison IR were shared. That is,
two diffs about the same subjects were represented by the same diff
node that would appear twice in the tree.
This was preventing us from spotting e.g, the first occurrence of a
diff node that would later (in the tree) turn to be redundant because
all redundant diff nodes are represented by the same diff node
pointer.
This patch now makes each diff node be different, as far of pointer
comparison is concerned. But it introduces the concept of canonical
diff node to ease the comparison between two diff nodes. Two diff
nodes that are equal have the same canonical diff node.
With this facility, it's now possible to tell the difference between
diff nodes that are (structurally) equal. It's not possible to say
things like "this is the first or second occurrence of the redundant
diff node foo'.
* include/abg-ir.h: Prefix the doc string with "///", rather than
writing it inside a /**/ comment.
* include/abg-comparison.h (function_decl_diff)
(function_decl_diff_sptr, fn_parm_diff, fn_parm_diff_sptr)
(var_diff_sptr, base_diff, class_diff, class_diff_sptr): Move
these class & typedef decls to the top of the file.
(string_changed_base_map, string_changed_parm_map)
(unsigned_changed_parm_map, changed_function_ptr)
(string_changed_function_ptr_map): Remove these typedefs.
(string_base_diff_sptr_map, string_fn_parm_diff_sptr_map)
(unsigned_fn_parm_diff_sptr_map, string_var_diff_sptr_map)
(unsigned_var_diff_sptr_map, string_function_decl_diff_sptr_map)
(string_var_diff_ptr_map): New typedefs.
(diff_context::{has_diff_for,add_diff}): Make these member
functions private.
(diff_context::{set_canonical_diff_for,
set_or_get_canonical_diff_for}): Declare new private member
functions.
(diff_context::{get_canonical_diff_for,
initialize_canonical_diff}): New public member functions.
(diff_context::maybe_apply_filters): Set the default value of the
'traverse_nodes_once' parameter to false.
(compute_diff): Make the overload for class_decl_sptr friend of
the diff_context class.
(class diff): Make the diff_context class a friend of this one.
(diff::set_canonical_diff): Declare new private member function.
(diff::get_canonical_diff): Declare new public member function.
(diff::children_nodes): Make this return a vector<diff_sptr>, rather
than a vector<diff*>.
(diff::append_child_node): Make this take a diff_sptr rather than
a diff*.
(class fn_parm_diff): Declare new type.
(compute_diff): Declare new overload for the new
function_decl::parameter_sptr.
(function_decl_diff::subtype_changed_parms): Return a
string_fn_parm_diff_sptr_map rather than a string_changed_parm.
(function_decl_diff::children_nodes): Return a vector<diff_sptr>.
(function_decl_diff::append_child_node): Take a diff_sptr.
(function_decl_diff::changed_functions): Return a
string_function_decl_diff_sptr_map.
(function_decl_diff::changed_variables): Return a
string_var_diff_sptr.
(class function_decl::parameter): Make this a pimpled class.
Also, make it inherit decl_base.
(equals): New overload for function_decl::parameter.
(struct function_decl::parameter::hash): Declare this.
(ir_node_visitor::visit): Declare new overload for
function_decl::parameter.
* src/abg-comparison.cc: Add doc-string about the internal
representation of the comparison engine and also about the concept
of canonical diff of the comparison engine.
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER3): Consider the
canonical diff when trying to know if the current node was
reported earlier.
(diff_context::priv::canonical_diffs): New data member.
(diff_context::{get_canonical_diff_for, set_canonical_diff_for,
set_or_get_canonical_diff_for, initialize_canonical_diff}): Define
new member functions.
(diff_context::{diff_has_been_traversed, mark_diff_as_traversed):
Consider canonical diff for these tests and actions.
(diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(diff::canonical_diff_): New data member.
(diff::diff): Initialize the diff::canonical_diff_ data member.
(diff::begin_traversing): Mark the canonical diff node too.
(diff::is_traversing): Consider the canonical diff node in this
test.
(diff::end_traversing): Make the canonical diff node too. Also
mark the current node as having been traversed.
(diff::children_nodes): Return a vector<diff_sptr> type.
(diff::{get_canonical_diff, set_canonical_diff}): Define new
member functions.
(diff::append_child_node): Take a diff_sptr type parameter.
(diff::{reported_once, currently_reporting}): Flag the canonical
diff node too. And consider the canonical diff node when checking
the flag.
(diff::traverse): No need to mark the node as being traversed
because the diff::end_traversing() function does it now. Adjust
the code because diff::children_nodes() now returns
vector<diff_sptr>.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, typedef_diff,
corpus_diff}::chain_into_hierarchy): Adjust to the new type that
diff::append_child_node() takes. Also, take into account that the
diff nodes are now un-shared.
(compute_diff_for_distinct_kinds, compute_diff_for_types)
(compute_diff): Do not share diff nodes anymore. Initialize the
canonical diff node for the new created node.
(represent): Take a var_diff_sptr rather than two var_decl_sptr.
Adjust. Also take in account the fact that diff nodes are not
shared anymore, and that they do have canonical diffs.
(var_diff::type_diff): Make the computation of the type_diff of
the var_diff be lazy. This avoids infinite (recursive) creation
of diff nodes when a class diff node has a sub-type of data member
that is a class diff node too.
(var_diff::report): Detect redundant reporting of this kind of
diff node.
(class_diff::priv::changed_bases_): Change the type of this to
string_base_diff_sptr_map.
(class_diff::priv::subtype_changed_dm_): Change the type of this
to string_var_diff_sptr_map.
(class_diff::priv::changed_dm_): Change the type of this to
unsigned_var_diff_sptr_map.
(class_diff::priv::{count_filtered_subtype_changed_dm,
count_filtered_bases}): Do not take a diff_context_sptr anymore.
(class_diff::ensure_lookup_tables_populated): changed_bases_
subtype_changed_dm_ and changed_dm_ are now *NOT* shared diff
nodes anymore.
(class_diff::priv::base_has_changed): Adjust.
(class_diff::priv::subtype_changed_dm): Adjust.
(class_diff::priv::count_filtered_bases): Adjust as changed_bases_
is now a map of un-shared diff nodes.
(class_diff::priv::count_filtered_subtype_changed_dm): Adjust as
subtype_changed_dm_ is now a map of un-shared diff nodes.
(class_diff::priv::{count_filtered_changed_mem_fns,
count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns,
}): Adjust for change of the default parameter value of
diff_context::maybe_apply_filters().
(class_diff::~class_diff): New destructor.
(class_diff::changed_bases): Return a string_base_diff_sptr_map&
type.
(class_diff::{inserted_data_members, deleted_data_members,
changed_member_fns}): Add doc strings.
(struct changed_data_member_comp): Remove.
(struct var_diff_comp): New comparison functor.
(sort_changed_data_members): Remove.
(sort_var_diffs): Define new sorting function.
(class_diff::report): Adjust.
(fn_parm_diff::*): Define member types and functions of the new
fn_parm_diff type.
(function_decl_diff::priv::{subtype_changed_parms_,
changed_parms_by_id_}): Make these take a map of fn_parm_diff_sptr
nodes.
(function_decl_diff::ensure_lookup_tables_populated): Adjust to
the fact that priv_->subtype_changed_parms_ and
priv_->priv_->changed_parms_by_id_ now are maps of un-shared
fn_parm_diff_sptr nodes.
(function_decl_diff::subtype_changed_parms): Adjust.
(struct changed_parm_comp): Remove.
(struct fn_parm_diff_comp): New comparison functor.
(sort_changed_parm_map): Remove.
(sort_string_fn_parm_diff_sptr_map): New sorting function.
(function_decl_diff::report): Adjust.
(corpus_diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(corpus_diff::priv::changed_fns_): Changed the type of this to
string_function_decl_diff_sptr_map.
(corpus_diff::priv::changed_vars_): Changed the type of this to
string_var_diff_sptr_map.
(corpus_diff::priv::ensure_lookup_tables_populated): Adjust.
(corpus_diff::priv::apply_filters_and_compute_diff_stats}):
Adjust. Do not need to clear redundancy categorization anymore
because the diff nodes are not shared anymore.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
Adjust.
(corpus_diff::priv::clear_redundancy_categorization): Adjust.
(corpus_diff::changed_variables): Adjust.
(struct changed_function_ptr_comp): Remove.
(struct function_decl_diff_comp): New comparison functor.
(sort_string_changed_function_ptr_map): Remove.
(sort_string_function_decl_diff_sptr_map): Define new sorting
function.
(struct changed_vars_comp): Remove.
(struct var_diff_sptr_comp): New comparison functor.
(sort_changed_vars): Remove.
(sort_string_var_diff_sptr_map): Define new sorting function.
(corpus_diff::report): Adjust.
(corpus_diff::traverse): Adjust.
({category_propagation_visitor,
suppression_categorization_visitor}::visit_end): Adjust.
(clear_redundancy_categorization): Adjust.
* src/abg-hash.cc (function_decl::parameter::hash::operator):
Adjust.
* src/abg-ir.cc (struct function_decl::parameter::priv): Define
here as part of pimpl-ifying the function_decl::parameter type.
(function_decl::parameter::*): Define here the member functions as
part of pimpl-ifying the function_decl::parameter type.
(equals): Define the overload for function_decl::parameter here
too.
(ir_node_visitor::visit(function_decl::parameter*)): Define this.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-v0.cc: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test21-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v0.c: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v1.c: Likewise.
* tests/test-diff-dwarf.cc (in_out_spec): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v0.so: New test
input binary.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v1.so: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-v0.cc: Source code
code for binary test input above.
* tests/data/test-diff-suppr/test8-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt:
New test input data.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v0.so: New
test input binary.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v1.so: New
test input binary.
* tests/data/test-diff-suppr/test9-changed-parm-c-v0.c: Source
code for binary test input above.
* tests/data/test-diff-suppr/test9-changed-parm-c-v1.c: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/Makefile.am: Add the new files to the source
distribution.
Dodji Seketeli [Thu, 25 Dec 2014 10:08:48 +0000 (11:08 +0100)]
Fix pretty printing of pointer_diff node
While working on un-sharing diff nodes, I observed that the pretty
printed representation of pointer_diff nodes was lacking an opening
square bracket. Fixed thus.
* src/abg-comparison.cc (pointer_diff::get_pretty_representation):
Add the missing opening square bracket.
Sinny Kumari [Wed, 17 Dec 2014 11:56:26 +0000 (17:26 +0530)]
Add new methods in corpus_diff class
Functions added_unrefed_function_symbols() and
added_unrefed_variable_symbols() are required in order to access
added functions and variables obtained while calculating abi diff
between libraries with no debug information available
* include/abg-comparison.h
(corpus_diff::added_unrefed_function_symbols):
Declare new member function
(corpus_diff::added_unrefed_variable_symbols):
Declare new member function
* src/abg-comparison.cc
(corpus_diff::added_unrefed_function_symbols):
Define new member function
(corpus_diff::added_unrefed_variable_symbols):
Define new member function
Sinny Kumari [Mon, 15 Dec 2014 06:49:11 +0000 (01:49 -0500)]
Add new corpus_diff::added_variables() method
Function added_variables() is required in order to access the list of
added variables obtained while calculating abi diff between two
libraries outside libabigail
* include/abg-comparison.h (corpus_diff::added_variables):
Declare new member function
* src/abg-comparison.cc (corpus_diff::added_variables):
Define new member function
Dodji Seketeli [Fri, 12 Dec 2014 13:30:31 +0000 (14:30 +0100)]
Extend detection of compatible types to arrays
* include/abg-fwd.h (is_array_type): Renamed is_array_type_def()
into this for consistency.
* src/abg-comparison.cc (type_suppression::suppresses_diff):
Adjust.
* src/abg-dwarf-reader.cc (build_array_type): Remove useless code
that was trying to read a DW_AT_byte_size attribute from the DIE
of the array, but then wasn't doing anything with the value. But
then if the attribute was not present, the array type wouldn't be
built.
* src/abg-ir.cc (strip_typedef): Strip typedefs from sub-types of
array types too.
(is_array_type): Rename is_array_def() to this, for consistency.
(var_decl::get_pretty_representation): Adjust.
* tests/data/test-diff-filter/libtest24-compatible-vars-v0.so: New
test input data.
* tests/data/test-diff-filter/libtest24-compatible-vars-v1.so: Likewise.
* tests/data/test-diff-filter/test24-compatible-vars-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test24-compatible-vars-v0.c: Source
code for the first binary above.
* tests/data/test-diff-filter/test24-compatible-vars-v1.c: Source
code for the second binary above.
* tests/data/Makefile.am: Add the new test input data to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test input
data to the list of input to run this test harness over.
Dodji Seketeli [Thu, 11 Dec 2014 14:47:44 +0000 (15:47 +0100)]
Better handle pointer-to-void in various places of the pipeline
This is the last patch that should fix the issue
https://sourceware.org/bugzilla/show_bug.cgi?id=17655
A pointer to void can be represented as an instance of
abigail::ir::pointer_type_def which has a NULL pointed-to attribute.
Unfortunately, there are various places in the code that assume that
abigail::ir::pointer_type_def::get_pointed_to_type() returns a
non-null value. This patch is an attempt at fixing those spots.
* src/abg-comparison.cc (pointer_diff::report): Handle the case of
pointer to void.
* src/abg-dwarf-reader.cc (build_pointer_type_def): Assert that
the underlying pointer is non-null.
* src/abg-ir.cc (pointer_type_def::pointer_type_def): Handle the
case of pointer to void.
(equals): Likewise in the overload for const pointer_type_def.
(pointer_type_def::get_qualified_name): Likewise.
Dodji Seketeli [Thu, 11 Dec 2014 12:48:43 +0000 (13:48 +0100)]
Try harder to detect a DWARF attribute pointing into alternate DWARF section
This is bug https://sourceware.org/bugzilla/show_bug.cgi?id=17655.
There are several issues conflated into that one problem report. This
patch addresses one of them.
The value of a DW_AT_type attribute on a DW_TAG_subprogram DIE can be
a type that lies in an alternate DWARF section. The link from the
DW_TAG_subprogram die to the attribute value can be very much
indirect; for instance, the DW_TAG_subprogram might be linked to an
abstract origin function through a DW_AT_abstract_origin, which itself
can be linked to a function specification that lies in the alternate
DWARF section through a DW_AT_specification attribute. It's that last
function specification (in the alternate DWARF section) that would
have the DW_AT_type that points to the return type of the function,
defined in the alternate DWARF section. In this specific case, we
were failing to detect that the DW_AT_type was inside the alternate
debug info section; note that detecting that is not obvious because
the elfutils function dwarf_attr_integrate that we use to get the
value of the DW_AT_type magically does the walking through all the
hops, but doesn't tell us if the resulting type is in the alternate
debug info section or not. So we do have our own function that does
the detection.
This patch makes the detection work in this case.
* src/abg-dwarf-reader.cc
(is_die_attribute_resolved_through_gnu_ref_alt): Support the case
of the origin function itself having a specification function
link.
Dodji Seketeli [Thu, 11 Dec 2014 10:32:09 +0000 (11:32 +0100)]
Fix accidentally removing the scope of variables when fixing them up
This is about bug
https://sourceware.org/bugzilla/show_bug.cgi?id=17652. Some old DWARF
producers emit incomplete debug info for static data members. We
currently detect this and fix the resulting constructed variables up.
During this fix up, it appears that we sometimes accidentally remove
the scope of some variables. Fixed thus.
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
During var decl fixup, remove the scope of a variable only when we
are sure that we want to re-scope it.
Dodji Seketeli [Thu, 11 Dec 2014 08:28:55 +0000 (09:28 +0100)]
Fix several aborts while diffing libdw.so
Several crashes were spotted when running abidiff on the libdw.so from
elfutils versions 0.158 and 0.160. This is the problem report
https://sourceware.org/bugzilla/show_bug.cgi?id=17650 and the patch
below addresses that.
* src/abg-corpus.cc
(corpus::priv::build_unreferenced_symbols_tables): Fix wrong
guestimation of the size of the map of unreferenced symbol table.
* src/abg-dwarf-reader.cc (get_version_needed_for_versym): Honour
the conditions of breaking out from walking the verneed table.
So, this is all about problem report
https://sourceware.org/bugzilla/show_bug.cgi?id=17693.
When redundant diff node reporting is enabled and when a diff node
appears twice in a diff tree, we detect that and the second occurrence
of the diff node is flagged as being redundant. Later at diff tree
node reporting time, the redundant diff node is not reported.
The problem is that diff nodes are canonicalized. That is, when the
same change is present twice in a diff, the same diff node is going to
be present twice. So flagging the second occurrence as being
redundant amounts as flagging the first occurrence as being redundant
too! So at reporting time, the diff tree visitor that walks the diff
tree nodes will avoid reporting the two occurrences of diff tree nodes
altogether. This is what happens in the example of the bug above. I
am reproducing the example here for convenience:
So suppose we have a first version of a library named lib-v0.so which
is made of this C code:
int add(int a, int b)
{
}
Then suppose that code was changed in a subsequent version of the
library named lib-v1.so, leading to the following code:
int add(float a, float b)
{
}
So, the diff tree node for the 'add' function is going to have several
child diff tree nodes, among which, one that carries the change for
the first parameter (int a becoming float a) and the one carrying the
change for the second parameter (int b becoming float b).
The diff tree node for the second parameter is going to be same diff
tree node as the one for the first parameter because what counts is
the change in the *type* of the parameter. Thus, the diff tree node
for the second parameter is going to be marked as being redundant; and
so is the first parameter.
You can see that even the function 'add' is not mentioned in the
report. This is because it has also been considered as being
redundant because of a phenomenon named 'propagation'. The
redundant-ness of the children nodes of the diff tree node of the
'add' function is propagated to the diff tree node of the add function
itself because that add function diff tree node has no child but
redundant diff children nodes. This categorization behaviour is
correct.
What is not correct is that only the second child node of the add
function diff tree node should have been marked redundant.
I am going to tackle this issue a bit later. For now, I am
temporarily disabling redundancy categorization for diff tree nodes by
default. Hence this patch.
With this patch, abidiff lib-v0.so lib-v1.so yields:
[C]'function int add(int, int)' has some indirect sub-type changes:
parameter 0 of type 'int' changed:
name changed from 'int' to 'float'
parameter 1 of type 'int' changed:
name changed from 'int' to 'float'
Note how the change on the second parameter appears equal to the
change on the first.
* src/abg-comparison.cc
(diff_context::priv::priv): Show redundant changes by default.
(categorize_redundancy): Do not categorize redundancy if the
diff_context says that we shouldn't.
* tools/abicompat.cc (options::show_redundant): New data member.
(options::options): Initialize to true.
(display_usage): Add new help string for new --no-redundant and
--redundant options.
(parse_command_line): Parse new --no-redundant and --redundant
command line options.
(main): Initialize the diff context with respect to the
options::show_redundant property.
* tools/abidiff.cc (options::options): Initialize the
show_redundant_changes data member to true.
(display_usage): Show new help string for the new --no-redundant
command line option.
(parse_command_line): Parse the new --no-redundant command line
option.
* tests/data/test-diff-filter/libtest23-redundant-fn-parm-change-v0.so:
New test data input.
* tests/data/test-diff-filter/libtest23-redundant-fn-parm-change-v1.so:
Likewise.
* tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test23-redundant-fn-parm-change-v0.c:
Source code for the first binary above.
* tests/data/test-diff-filter/test23-redundant-fn-parm-change-v1.c:
Source code for the second binary above.
* tests/data/Makefile.am: Add the new test data input to source
distribution.
* tests/test-abicompat.cc (in_out_specs): Add --no-redundant to
abicompat when we don't want it to show redundant diff reports.
* test-diff-filter.cc (in_out_specs): Likewise for abidiff.
* test-diff-suppr.cc (in_out_specs): Likewise.
./configure: line 15878: ENABLE_ZIP_ARCHIVE_AND_CXX11:
command not found
caused by bad syntax:
ENABLE_ZIP_ARCHIVE_AND_CXX11 = yes
(Variable assignments must not use spaces around '=').
* configure.ac: remove (broken) assignment to the
ENABLE_ZIP_ARCHIVE_AND_CXX11 variable
* Makefile.am: replace variable assignments to
ZIP_ARCHIVE_TESTS_FIRST_PART, ZIP_ARCHIVE_TESTS_SECOND_PART
by ZIP_ARCHIVE_TESTS using the "+=" automake operator.
Likewise for CXX11_TESTS.
Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Dodji Seketeli [Wed, 10 Dec 2014 06:25:01 +0000 (07:25 +0100)]
Make determining of compatible types complete
Until now, two types that are different were considered compatible if
one type is a typedef of the other. This is useful because two
different types, if compatible, are not ABI-incompatible. This patch
extends the concept of compatible types to types which might have
sub-types that are typedefs of each others, including function types.
Note implementing this required that I fixed various other things left
and right. Like style fixes, crash avoiding fixes, etc.
* include/abg-fwd.h (is_reference_type, is_function_type)
(is_method_type): Declare new predicates.
* include/abg-ir.h (class qualified_type_def): Pimpl this class.
(qualified_type_def::qualified_type_def): Use the convenience
type_base_sptr typedef.
(qualified_type_def::{get_cv_quals, set_cv_quals}): Use the
qualified_type_def::CV type rather than char.
(qualified_type_def::get_underlying_type): Use the convenience
type_base_sptr typedef.
(pointer_type_def::pointer_type_def): Likewise.
(function_decl::parameter::parameter): Add a new constructor.
* src/abg-ir.cc (is_reference_type, is_function_type)
(is_method_type): Define new predicates.
(class qualified_type_def::priv): Define this new private type,
for the purpose of Pimpl-ifying the qualified_type_def class.
(qualified_type_def::{qualified_type_def, build_name,
get_cv_quals_string_prefix, get_underlying_type}): Adjust for the
purpose of Pimpl-ifying the qualified_type_def class.
(equals): In the qualified_type_def, reference_type_def overloads,
trust the fact that we have operator== overload for the
type_base_sptr. This avoids crashes for when the (possible)
underlying type is null.
(pointer_type_def::operator==): Likewise.
(strip_typedef): Make this recursively strip
typedefs from sub-types.
(types_are_compatible): Handle null types.
(qualified_type_def::{get_cv_quals, set_cv_quals}): Handle
qualified_type_def::CV rather than char.
(pointer_type_def::pointer_type_def): Use the convenience
type_base_sptr typedef.
* include/abg-comparison.h (distinct_diff::compatible_child_diff):
Declare new member function.
* src/abg-comparison.cc (distinct_diff::compatible_child_diff):
Define new member function.
(distinct_diff::chain_into_hierarchy):
Chain the compatible child diff node that might be present.
(distinct_diff::report): Now when a distinct diff carries a
compatible change, mention it in the report.
* src/abg-comp-filter.cc (is_compatible_change): A compatible
change can now involve types that are not typedefs. Only their
sub-types need to be involved with typedef-ness.
* tests/data/test-diff-dwarf/test{2,4,5}-report.txt: Adjust.
* tests/data/test-diff-filter/libtest21-compatible-vars-v0.so: New
test data input.
* tests/data/test-diff-filter/libtest21-compatible-vars-v1.so: Likewise.
* tests/data/test-diff-filter/test21-compatible-vars-report-0.txt Likewise.
* tests/data/test-diff-filter/test21-compatible-vars-report-1.txt Likewise.
* tests/data/test-diff-filter/test21-compatible-vars-v0.cc: Source
code for the first data input binary above.
* tests/data/test-diff-filter/test21-compatible-vars-v1.cc: Source
code for the second data input binary above.
* tests/data/test-diff-filter/libtest22-compatible-fns-v0.so: New
test data input.
* tests/data/test-diff-filter/libtest22-compatible-fns-v1.so Likewise.
* tests/data/test-diff-filter/test22-compatible-fns-report-0.txt:
New test data input.
* tests/data/test-diff-filter/test22-compatible-fns-report-1.txt: Likewise.
* tests/data/test-diff-filter/test22-compatible-fns-v0.c: Source
code for the first test data input binary above.
* tests/data/test-diff-filter/test22-compatible-fns-v1.c: Source
code for the second test data input binary above.
* tests/data/Makefile.am: Add the new test input data to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test data
input above to the list of test data this harness has to be run
over.
Dodji Seketeli [Tue, 9 Dec 2014 11:37:23 +0000 (12:37 +0100)]
Fix classification of parameter addition in C
The comparison engine classifies an addition or removal of parameter
from a C function as harmless. This is a mistake that impacts abidiff
and abicompat. Fixed thus.
* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
Compare the fully qualified name of the functions; not their
pretty representation.
* tests/data/test-diff-dwarf/libtest20-add-fn-parm-v0.so: New test
data intput.
* tests/data/test-diff-dwarf/libtest20-add-fn-parm-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test20-add-fn-parm-report-0.txt:
Likewise.
* tests/data/test-diff-dwarf/test20-add-fn-parm-v0.c: Source code
for the first shared library above.
* tests/data/test-diff-dwarf/test20-add-fn-parm-v1.c: Source code
for the second shared library above.
* tests/test-diff-dwarf.cc (in_out_specs): Add the test input data
above to the list of test input the harness must run over.
* Makefile.am: Add the new files above to source distribution.
Dodji Seketeli [Mon, 8 Dec 2014 12:36:01 +0000 (13:36 +0100)]
Wire the soname check into abicompat
Now that the comparison engine knows how to take SONAMEs into account
during ABI abi comparison, it's feasible to make abicompat leverage
that capability. This patch does just that.
* include/abg-comparison.h (corpus_diff::soname_changed): Declare
new member function.
* src/abg-comparison.cc (corpus_diff::soname_changed): Define new
member function.
(corpus_diff::length): Use the new corpus_diff::soname_changed()
method.
* tests/data/test-abicompat/libtest4-soname-changed-v0.so: New
test input data.
* tests/data/test-abicompat/libtest4-soname-changed-v1.so:
Likewise.
* tests/data/test-abicompat/test4-soname-changed-app: Likewise.
* tests/data/test-abicompat/test4-soname-changed-report-0.txt:
Likewise.
* tests/data/test-abicompat/test4-soname-changed-app.cc: Source
code for one of the binaries above.
* tests/data/test-abicompat/test4-soname-changed-v0.cc: Likewise.
* tests/data/test-abicompat/test4-soname-changed-v1.cc: Likewise.
* tests/test-abicompat.cc (in_out_specs): Add the new test input
data to the list of input data to run this harness over.
(main): Take the soname change in account to determine if the
change is ABI incompatible.
* tests/data/Makefile.am: Add the new test input data above to source
distribution.
Dodji Seketeli [Sun, 7 Dec 2014 22:34:21 +0000 (23:34 +0100)]
Fixup messed up old runtestdiffdwarf input tests
While working on supporting the comparison of sonames I realized that
the runtestdiffdwarf test harness was missing some input data. This
patch addresses that.
* tests/data/test-diff-dwarf/test17-non-refed-syms-report-0.txt:
Add this missing reference test output.
* tests/data/Makefile.am: Add the new reference test output to
source distribution.
* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Fix
this output to avoid emitting symbol alias information in it.
* tests/test-diff-dwarf.cc (in_out_specs): Add two missing test
input data to the list of input data this harness is supposed to
run over.
Dodji Seketeli [Sun, 7 Dec 2014 20:01:20 +0000 (21:01 +0100)]
Support reading and comparing soname from ELF files
Libabigail's DWARF reader doesn't read the DT_SONAME tag from the
.dynamic section. The abigail::corpus type doesn't have a property
for that tag either. And the comparison engine doesn't take that tag
in when comparing corpora.
This patch modifies the DWARF reader to read the DT_SONAME and
DT_NEEDED tags from the .dynamic section. The value of DT_SONAME tag
is then saved in the new corpus property accessed by the new
abigail::corpus::get_soname() accessor. The comparison engine has
also been modified to compare the sonames of two corpora being
compared. Note that the value of the DT_NEEDED elf tag is saved in a
new corpus property that is accessed via the new
abigail::corpus::get_needed() getter. This property is not used yet.
This patch also adds a unit test for this new feature.
* include/abg-corpus.h (corpus::{get_needed, set_needed,
get_soname, set_soname}): Declare new accessors.
* src/abg-corpus.cc (corpus::priv::{needed, soname}): New data
members.
(corpus::{get_needed, set_needed, get_soname, set_soname}): Define
new accessors.
(corpus::is_empty): Take dt_needed and dt_soname in account in
computing empty-ness.
* src/abg-dwarf-reader.cc (read_context::{dt_needed_,
dt_soname_}): New data members.
(read_context::{dt_needed, dt_soname}): New accessors.
(read_context::load_dt_soname_and_needed): New member function.
(read_corpus_from_elf): Call the new
read_context::load_dt_soname_and_needed() to read the dt_soname
and dt_needed tags. Set them to the corpus.
* include/abg-comparison.h (diff_context::show_soname_change):
Declare new accessors.
* src/abg-comparison.cc (diff_context::priv::show_soname_change_):
New data member.
(diff_context::priv::priv): Initialize the new data member
diff_context::priv::show_soname_change_.
(diff_context::show_soname_change): Define new accessors.
(corpus_diff::priv::sonames_equal_): New data member.
(corpus_diff::priv::priv): Initialize the new data member
corpus_diff::priv::sonames_equal_.
(corpus_diff::length): Take the new priv_->sonames_equals_ data
member in account.
(corpus_diff::{report, priv::emit_diff_stats}): If the sonames
changed and we are allowed to report it, then report it.
(compute_diff): In the variant for corpus_diff, do not forget to
compare the sonames.
* src/abg-reader.cc (build_needed, read_elf_needed_from_input):
Define new static functions.
(read_corpus_from_input): Read the 'soname' attribute from the
'abi-corpus' xml element node.
* src/abg-writer.cc (write_elf_needed): Define new static
function.
(write_corpus_to_native_xml): Write a new 'elf-needed' xml element
node that contains one xml 'dependency' element node per
dependency to emit. This uses the new write_elf_needed() function
above.
* tests/data/test-diff-dwarf/libtest19-soname-v0.so: New test
input data.
* tests/data/test-diff-dwarf/libtest19-soname-v1.so: Likewise.
* tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test19-soname-v0.c: Source code of
the first binary above.
* tests/data/test-diff-dwarf/test19-soname-v1.c: Source code of
the second binary above.
* tests/test-diff-dwarf.cc (in_out_specs): Add the test input
above to the list of test input to run this harness on.
* tests/data/Makefile.am: Add the new test input data above.
* tests/data/test-read-dwarf/test{0,1}.abi: Adjust.
* tests/data/test-read-dwarf/test{2,3,4,6,}.so.abi: Adjust.
Dodji Seketeli [Sun, 7 Dec 2014 22:39:18 +0000 (23:39 +0100)]
Fix some style nits in the native reader and writer
While working on the soname comparison support I stumbled across some
small style issues. Fixed thus.
* src/abg-reader.cc (read_symbol_db_from_input): Align parameter
names. Fix indentation of the first line of the function.
* src/abg-writer.cc (write_elf_symbols_table): Align parameter names.
Dodji Seketeli [Sun, 7 Dec 2014 16:05:38 +0000 (17:05 +0100)]
Fix a crash while writing symbol information
While working on something else, I noticed that the abilint tool would
crash when trying to write information relative to some symbol
information. It turned out that invoking corpus::get_fun_symbol_map()
or corpus::get_var_symbol_map() on a corpus that has an empty function
(or variable) symbol map yields a crash. This patch fixes that.
To test the fix I had to extend the test-read-write.cc test harness to
teach it to load corpus files too; up to now it was only loading
simple translation unit files (named Binary Instrumentation files). I
then created a native xml corpus file using the abidw tool on a simple
shared library I created. That corpus file does have an empty
variable symbol section which triggers the crash on a non-fixed tree.
* src/abg-corpus.cc (corpus::{get_fun_symbol_map_sptr,
get_var_symbol_map_sptr}): Make sure the symbol map is always
constructed, even if it's empty.
* tests/data/test-read-write/test26.xml: New test input data.
* tests/test-read-write.cc (in_out_spec): Add this new test input
data to the list of input data to run the harness on.
(main): Support reading and writing corpus files alongside
translation unit files that we were handling already.
* tests/data/Makefile.am: Add the new test input data to source
distribution.
Dodji Seketeli [Sun, 30 Nov 2014 17:18:55 +0000 (18:18 +0100)]
Initial implementation of the abicompat tool
Given an application A that links to a shared library L of version V
denoted L(V) and a subsequent version of that library denoted L(V+P),
the 'abicompat' tool tells the user if L(V+P) is still ABI compatible
with L(V+P). And if it is not, abicompat gives a reports that shows
the differences between L(V) and L(V+P) that makes L(V+P)
ABI-incompatible with A.
The source code of this tool is in the tools/abicompat.cc source
file. To support this new tool, this commit changes the comparison
engine to optionally avoid showing added symbols that were not
referenced by any debug info. It changes the ABI corpus type to allow
the specification of a list of variables and functions symbols to keep
(and drop all other functions and variables which have other symbols
on the floor even before starting to compare the two libraries).
This is how the abicompat tool itself works. It basically compares
L(V) and L(V+P) but it only looks at their exported functions and
variables which symbols are undefined in application A. If the list
of exported and defined variables and functions of L(V) whose symbols
are undefined in A equals that of L(V+P) (including the sub-types of
these variables and functions) A is still compatible with L(V+P).
Otherwise, they might not be compatible depending on the kind of
differences that are found.
* include/abg-comparison.h
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Declare new accessors.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols,
apply_filters_and_suppressions_before_reporting}): Declare new
methods.
(corpus_diff::diff_stats): Declare this new type. Actually this
was previously corpus_diff::priv::diff_stats, which was a hidden
internal type.. We are moving it here, in the external API so
that client code can have more information about changes
statistics. Change all the previously publicly accessible data
members into accessor functions.
* src/abg-comparison.cc (class corpus_diff::diff_stats::priv): New
type.
(diff_context::priv::show_added_syms_unreferenced_by_di_): New
data member.
(diff_context::priv::priv): Adjust.
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Define this new method.
(corpus_diff::priv::emit_diff_stats): Do not show the diff stat
if the only changes is added function or variables symbols and if
we were instructed to not show added symbols.
(corpus_diff::priv::{diff_stats_, filters_and_suppr_applied_}):
New data members.
(corpus_diff::priv::priv): Initialize the
filters_and_suppr_applied_ data member.
(corpus_diff::priv::diff_stats): Move this type to
corpus_diff::diff_stats.
(corpus_diff::priv::{apply_filters_and_compute_diff_stats,
emit_diff_stats}): Adjust.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Define new member function.
(corpus_diff::report): Use the new
apply_filters_and_suppressions_before_reporting() function, rather
than applying the filters and suppressions by ourselves. Also
adjust to the use the accessors of the new corpus_diff::diff_stats
type.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols}): Define new accessors.
(corpus_diff::diff_stats::{diff_stats, num_func_removed,
num_func_added, num_func_changed, num_func_filtered_out,
net_num_func_changed, num_vars_removed, num_vars_added,
num_vars_changed, num_vars_filtered_out, net_num_vars_changed,
num_func_sym_removed, num_func_syms_added, num_var_syms_removed,
num_var_syms_added}): Define new member functions.
* include/abg-corpus.h (corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Declare new methods.
* src/abg-corpus.cc (corpus::priv::{sym_id_fns_to_keep,
sym_id_vars_to_keep}): Added data members.
(symtab_build_visitor_type::{unrefed_fun_symbols,
unrefed_var_symbols, sym_id_fns_to_keep, sym_id_vars_to_keep}):
Added new data members.
(symtab_build_visitor_type::symtab_build_visitor_type): Take two
additional parameters for the function and variable symbol ids to
keep.
(symtab_build_visitor_type::add_fn_to_wip_fns): Take the function
symbols to keep in account when building the exported symbol
table.
(symtab_build_visitor_type::add_var_to_wip_vars): Likewise, take
the variable symbols to keep in account when building the exported
symbol table.
(corpus::priv::build_public_decl_table): Adjust the initialization
of the visitor that walks the ABI artifacts to build the exported
symbol table to know take a list of function/variable symbols to
keep.
(corpus::priv::build_unreferenced_symbols_tables): Ensure that the
public table of functions/variables is built before doing the work
of this function. Also, if a list of variable/function symbols to
keep is given, drop all symbols that are not in that list on the
floor.
(corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Define new accessors.
* tools/abicompat.cc: New abicompat tool.
* doc/manuals/abicompat.rst: New documentation source for
abicompat.
* doc/manuals/libabigail-tools.rst: Add an entry for the abicompat
doc.
* tests/test-abicompat.cc: New test harness for the 'abicompat'
tool.
* tests/Makefile.am: Build the runtestabicompat test harness and
add it to the list of tests harnesses that are run by make check.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v0.so: New
test input.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v1.so: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app: Likewise.
* tests/data/test-abicompat/test0-fn-changed-0.suppr: Likewise
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp.h: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v0.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v1.cc: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v1.so: Likewise.
* tests/data/test-abicompat/test2-var-removed-app: Likewise.
* tests/data/test-abicompat/test2-var-removed-app.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test2-var-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-version-script-0 Likewise.:
* tests/data/test-abicompat/test3-fn-removed-version-script-1: Likewise.
* tests/data/Makefile.am: Add the new test inputs above to the
source distribution.
Dodji Seketeli [Sun, 30 Nov 2014 10:16:28 +0000 (11:16 +0100)]
Support reading undefined symbols from an ELF file
In preparation to support the upcoming 'abicompat' tool, we need the
ABI corpus type to capture the symbols that are undefined in a given
ELF file.
This patch changes the ELF reader to capture the undefined symbols as
well as the symbol versions they need to be satisfied. These
undefined symbols are then stored in the instance ABI corpus build as
a result of the reading of the ELF file.
At the moment, these undefined symbols are not serialized to the
native XML format of libabigail yet. I guess I'll do that in a
subsequent patch.
* include/abg-corpus.h (corpus::{set_undefined_fun_symbol_map,
set_undefined_var_symbol_map, get_undefined_fun_symbol_map_sptr,
get_undefined_fun_symbol_map, get_sorted_undefined_fun_symbols,
get_undefined_var_symbol_map_sptr, get_undefined_var_symbol_map,
get_sorted_undefined_var_symbols}): Declare new methods ...
* src/abg-corpus.cc (corpus::{set_undefined_fun_symbol_map,
set_undefined_var_symbol_map, get_undefined_fun_symbol_map_sptr,
get_undefined_fun_symbol_map, get_sorted_undefined_fun_symbols,
get_undefined_var_symbol_map_sptr, get_undefined_var_symbol_map,
get_sorted_undefined_var_symbols}): ... and define them.
(struct corpus::priv::{undefined_var_symbol_map,
sorted_undefined_var_symbols, undefined_fun_symbol_map,
sorted_undefined_fun_symbols}): New data members.
* src/abg-dwarf-reader.cc (get_symbol_versionning_sections): Also
return the SHT_GNU_verneed section.
(get_version_needed_for_versym): New static function.
(get_version_definition_for_versym): Factorize this function out
of ..
(get_version_for_symbol): ... this one. Take a flag that says if
we want the definition version or the needed version of a symbol.
Extend the implementation using the two new function
get_version_needed_for_versym() and
get_version_definition_for_versym() above. This function now
returns the version either for a defined & exported symbol, or for
an undefined symbol.
(lookup_symbol_from_sysv_hash_tab)
(lookup_symbol_from_gnu_hash_tab, lookup_symbol_from_symtab):
Adjust for the change of signature of get_version_for_symbol().
(read_context::{undefined_fun_syms_, undefined_var_syms_}): New
data members.
(read_context::lookup_elf_symbol_from_index): Adjust for
invocation of the new signature of get_version_for_symbol().
(read_context::{undefined_fun_syms_sptr, undefined_fun_syms,
undefined_var_syms_sptr, undefined_var_syms}): Define new methods.
(read_context::load_symbol_maps): Add support for loading
undefined symbols and their versions.
(read_context::maybe_load_symbol_maps): Take in account the need
to load undefined symbols as well.
(read_corpus_from_elf): Once the undefined symbols have been read
from the ELF file, stuff them into the resulting ABI corpus that
has been built.
Dodji Seketeli [Sun, 30 Nov 2014 11:44:58 +0000 (12:44 +0100)]
Show the pretty representation of deleted variables in the diff output
While working on the 'abicompat' tool, it appeared that only the names
of deleted variables where printed in the diff report; what we want is
the full pretty representation of the variables, that is, we want
their type too.
This patch changes the reporting code of the corpus_diff to show the
full pretty representation of deleted variables.
* src/abg-comparison.cc (corpus_diff::report): Show the pretty
representation of deleted variables in all cases.
Dodji Seketeli [Sun, 30 Nov 2014 09:51:01 +0000 (10:51 +0100)]
Rename elf_symbol::get_is_defined() to elf_symbol::is_defined()
It's let's awkward to type if (elf_symbol->is_defined()); than
...->get_is_defined(). So I am going to the former. A chance we
still can change ABI here ;-)
* include/abg-ir.h (elf_symbol::get_is_defined): Rename into
elf_symbol::is_defined.
(elf_symbol::set_is_defined): Rename into elf_symbol::is_defined.
* src/abg-ir.cc (elf_symbol::get_is_defined): Likewise, rename
this into elf_symbol::is_defined.
(elf_symbol::set_is_defined): Likewise, rename this into
elf_symbol::is_defined.
(elf_symbol::{elf_symbol, is_public}): Adjust.
* src/abg-writer.cc (write_elf_symbol): Adjust.
Dodji Seketeli [Thu, 20 Nov 2014 10:26:30 +0000 (11:26 +0100)]
Make tests/data directory have its own Makefile
On RHEL 6, make distcheck was trying to compile the C++ files that are
in tests/data. Having a dedicated tests/data Makefile.am which only
put the data files into an EXTRA_DIST variable fixes that.
* configure.ac(AC_CONFIG_FILE): Generate a new tests/data/Makefile
file.
* tests/Makefile.am: Link the data/ sub-directory from here. Move
the EXTRA_DIST definition to ...
* tests/data/Makefile.am: ... this new file here.
Dodji Seketeli [Wed, 19 Nov 2014 20:00:50 +0000 (21:00 +0100)]
Fix manual documentation generation
The manual building was failing in make distcheck because it was being
built using the standard 'html' target. That target needs the output
to not be rebuilt each time make install-html is called. Which is not
easily possible for us. So for now, the apidoc is being generated
using the html-doc target. Also fix some other issues in the Makefile.
* doc/manuals/Makefile.am: Trigger the manual generation from the
html-doc target. Add the source files to the distribution. Fix
the clean target.
Dodji Seketeli [Wed, 19 Nov 2014 19:57:24 +0000 (20:57 +0100)]
Fix apidoc building
The apidoc building was failing in make distcheck because it was being
built using the standard 'html' target. That target needs the output
to not be rebuilt each time make install-html is called. Which is not
easily possible for us. So for now, the apidoc is being generated
using the html-doc target.
* doc/Makefile.am: Trigger the building frm the html-doc target.
Dodji Seketeli [Wed, 19 Nov 2014 16:31:34 +0000 (17:31 +0100)]
Add loads of forgotten test data files to source distribution
* tests/Makefile.am: Add lots of test data file that were
forgotten and then revealed by running make distcheck. Also fix
some wrong paths to test data files.
Dodji Seketeli [Wed, 19 Nov 2014 16:08:10 +0000 (17:08 +0100)]
Make the install-html target of apidoc/manual be conditional
When running 'make distcheck', make install is automatically run,
which runs 'make install-html', especially in the apidoc and manual
sub-directories. That triggers the building of the documentation,
using doxygen and python-sphinx even when these two packages are not
installed; in this case, install-html fails because doxygen or or the
python-sphinx binary is not found. So this patch conditionnaly make the
install-html target run. To run them, one must enable the building of
the apidoc or the manuals. Note that just installing doxygen or
python-sphinx enables the building of the apidoc and the manuals.
* configure.ac: add --enable-apidoc and --enable-manual. Add the
two ENABLE_APIDOC and ENABLE_MANUAL automake conditional
variables. Add the activation of the apidoc and manual into the
final package configuration report.
* doc/Makefile.am: Make the install-html, install-data-local and
uninstall-local targets conditional on the ENABLE_APIDOC
conditional variable.
* doc/manuals/Makefile.am: Likewise, make the install-html,
install-data-local and uninstall-data-local conditional on the
ENABLE_MANUAL conditional variable.
Dodji Seketeli [Wed, 19 Nov 2014 15:50:48 +0000 (16:50 +0100)]
Make the alt dwarf debug file *not* be a symlink
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug:
Make this be a real file, no more a symlink to
../../../test0-common-dwz.debug.
* tests/data/test-alt-dwarf-file/test0-report.txt: Now that the
file above is no more a symlink the message emitted by the test
changes. It now says that the file found is the base name of the
real file. So change the reference report accordingly.
Dodji Seketeli [Wed, 19 Nov 2014 14:38:51 +0000 (15:38 +0100)]
Use the POSIX 1003.1-1988 tar format for dist tar
* configure.ac: For the tar invocation made by make dist, make
sure to use the POSIX 1003.1-1988 tar format that can support file
names of more than 99 characters. This is useful for the
test-alt-dwarf-file test that has data made of a file which patch
has more than 99 characters.
Dodji Seketeli [Wed, 19 Nov 2014 09:23:41 +0000 (10:23 +0100)]
Nested automake conditionals don't work
* configure.ac (ENABLE_ZIP_ARCHIVE_AND_CXX11): Define this
automake condition variable that is true if both the zip archive
and c++11 features are enabled. This is important to know if the
test runtestdot is going to be compiled. That test needs both
c++11 and the zip archive features.
* tests/Makefile.am: Do not nest automake conditional statements.
It does not work. Rather, use the new
ENABLE_ZIP_ARCHIVE_AND_CXX11 condition variable.
Dodji Seketeli [Tue, 18 Nov 2014 22:54:16 +0000 (23:54 +0100)]
make html now generates the apidoc, manual and web site
* doc/Makefile.am (html-local): Make the html file generation be
triggered by the html-local target, not the html target. The html
target is a recursive target that calls the the html-local targets
under each directory.
(apidoc-html-doxygen): Rename the doc-html-doxygen target into
(apidoc-install-html-doxygen): Rename doc-install-html-doxygen
into this. this.
(DO_HTML, DO_INSTALL_HTML): Adjust.
(install-data-local): New target.
* doc/manuals/Makefile.am (install-html, install-data-local): New
targets.
Dodji Seketeli [Tue, 18 Nov 2014 22:32:50 +0000 (23:32 +0100)]
Generate the manual html documentation in the proper build directory
* doc/manuals/Makefile.am: Renamed doc/manuals/Makefile into this.
(BUILDDIR): Make this variable point to $(builddir)/_build as
opposed to just _build previously.
(SOURCEDIR): New variable that points to the source dir as known
by the autotools magic.
(ALLSPHINXOPTS): Make the source dir refer to the new
$(SOURCEDIR), rather than just '.' as previously.
* configure.ac (doc/manuals/Makefile): Generate this now.
* doc/Makefile.am: Link the sub-directory doc/manuals.
Dodji Seketeli [Tue, 18 Nov 2014 14:56:44 +0000 (15:56 +0100)]
Not all ChangeLog file lines end up with a ':'
* gen-changelog.py (process_commit): When trying to recognize the
beginning of a ChangeLog entry body, do not expect a line that
starts with a '*' to end with a ':' because there can be long file
names that end on the next line.
Dodji Seketeli [Tue, 18 Nov 2014 14:34:22 +0000 (15:34 +0100)]
Allow introductory text in commit log and ignore it when generating ChangeLog
* gen-changelog.py (process_commit): Everything that comes between
the subject line of the commit and the first \t* sequence is
considered to be introductory text. Ignore it when generating the
ChangeLog entry.
* COMMIT-LOG-GUIDELINES: Update the commit log guidelines to
reflect the fact that we can now have introductory text in the
commit log.
Dodji Seketeli [Tue, 18 Nov 2014 13:25:26 +0000 (14:25 +0100)]
Initial import of gen-changelog.py
* gen-changelog.py: Copy from
https://github.com/GNOME/gnet/blob/master/gen-changelog.py.
License it under LGPLV v2+ after asking Edward Hervey's kind
permission. Ain't Free Software really great?
Dodji Seketeli [Mon, 10 Nov 2014 15:32:50 +0000 (16:32 +0100)]
Consider enclosing template when comparing template parameters
* src/abg-ir.cc (template_parameter::priv::comparison_started_):
New data member.
(template_parameter::priv::priv): Initialize it.
(template_parameter::operator==): Compare the enclosing template
too. And avoid infinite recursion.
Dodji Seketeli [Mon, 10 Nov 2014 14:47:10 +0000 (15:47 +0100)]
Cleanup of the web page
* doc/website/libabigail-website.doxy: Remove the redundant
information that was appearing on the web page.
* doc/website/mainpage.txt: Clean-up the text of the web page, add
information for the new IRC channel #libabigail on oftc.net,
re-organize the content by putting sections where we had
paragraphs. Add a table of content. Also add a web form to
subscribe/unsubscribe to the mailing list.
Dodji Seketeli [Sat, 8 Nov 2014 10:32:58 +0000 (11:32 +0100)]
Sort reported changed declarations & types in a given scope
* src/abg-comparison.cc (struct changed_type_or_decl_comp, struct
changed_vars_comp): New comparison functors.
(sort_changed_type_or_decl, sort_changed_vars): New static
functions.
(scope_diff::report): Use the above to sort changed declarations,
and types in a given scope.
(corpus_diff::report): Likewise for the changed variables.
* tests/data/test-abidiff/test-struct1-report.txt: Adjust.
* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt:
Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt:
Likewise.
Dodji Seketeli [Sat, 8 Nov 2014 10:22:43 +0000 (11:22 +0100)]
Sort elf symbols before serializing them
* include/abg-corpus.h (corpus::{get_sorted_fun_symbols,
get_sorted_var_symbols}): Declare new member functions.
* src/abg-corpus.cc (corpus_priv::{sorted_var_symbols,
sorted_fun_symbols}): New data members.
(struct elf_symbol_comp_functor): Define new comparison functor.
(corpus::{get_sorted_fun_symbols, get_sorted_var_symbols}): Define
new member functions.
* src/abg-writer.cc (write_elf_symbols_table): Take a sorted
vector of symbols in parameters, rather than an unsorted map.
(write_corpus_to_native_xml): Write a sorted vector of symbols,
rather than an unsorted map of symbols.
* tests/data/test-read-dwarf/test0.abi: Adjust.
* tests/data/test-read-dwarf/test1.abi: Likewise.
* tests/data/test-read-dwarf/test2.so.abi: Likewise.
* tests/data/test-read-dwarf/test3.so.abi: Likewise.
* tests/data/test-read-dwarf/test6.so.abi: Likewise.
Dodji Seketeli [Fri, 7 Nov 2014 11:13:53 +0000 (12:13 +0100)]
Fix template parameter hashing: make it know about enclosing template
* include/abg-ir.h (template_parameter_sptr, template_decl_sptr)
(template_decl_wptr): Declare new typedefs.
(class template_decl): Make this virtually inherit decl_base and
pimpl-ify it.
(class template_parameter): Pimpl-ify this. Make the constructor
take the enclosing template parameter.
(struct template_decl::hash): Declare this here, rather than in
src/abg-hash.cc
(class type_tparameter, non_type_tparameter, template_tparameter)
(class type_composition, function_tdecl, class_tdecl): Pimpl-ify
this.
* src/abg-hash.cc (template_parameter::hash::operator()): Hash the
enclosing template parameter. Avoid infinite recursion due to the
loop hash parameter -> hash template -> hash parameter.
(template_decl::hash::operator()) Define this here, now that it's
declared in abg-ir.h. Also, avoid infinite recursion here; this
is complementary to what is done in the hashing for
template_parameter.
({type_tparameter, template_tparameter, }::hash::operator()):
Cache the calculated hash just as what is done for other types
hashed.
(template_decl::priv): Define this new type.
(template_decl::{add_template_parameter, get_template_parameters,
~template_decl}): Define these here to pimpl-ify template_decl.
(template_parameter::priv): Define this new type.
(template_parameter::template_parameter): Define this here to
pimpl-ify template_parameter. Note also that this now takes the
enclosing template decl.
(template_parameter::{get_index, get_enclosing_template_decl,
get_hashing_has_started, set_hashing_has_started, operator::==}):
Define these here to pimpl-ify template_parameter.
(type_tparameter::priv): Define this new type.
(type_tparameter::type_tparameter): Define this here to pimpl-ify
type_tparameter. Also, not that this constructor now takes the
enclosing template decl.
(class non_type_tparameter::priv): Define new type.
(non_type_tparameter::{non_type_tparameter, get_type}): Define
these here to pimpl-ify non_type_tparameter. The constructor now
takes the enclosing template.
(template_tparameter::priv): Define new type.
(template_tparameter::template_tparameter): Define this here to
pimpl-ify template_tparameter. This constructor now takes the
enclosing template.
(class type_composition::priv): New type.
(type_composition::{type_composition, get_composed_type,
set_composed_type}): Define these here to pimpl-ify
type_composition. The constructor now takes the enclosing
template decl.
(class function_tdecl::priv): Define new type.
(function_tdecl::{function_tdecl, set_pattern, get_pattern,
get_binding}): Define this here to pimpl-ify function_tdecl.
(class class_tdecl::priv): Define this new type.
(class_tdecl::class_tdecl): Define this here to pimpl-ify
class_tdecl.
(class_tdecl::set_pattern): Adjust to pimpl-ify.
(class_tdecl::get_pattern): Define new pimpl-ified getter.
* src/abg-reader.cc (build_function_tdecl, build_class_tdecl):
Cleanup. Pass the enclosing template to the template parameters
that are built.
(build_type_tparameter, build_type_composition)
(build_non_type_tparameter, build_template_tparameter)
(build_template_parameter): Take the enclosing template
declaration and pass it to the template parameter being created.
* tests/data/test-read-write/test12.xml: Fix and Adjust.
* tests/data/test-read-write/test13.xml: Likewise.
Dodji Seketeli [Thu, 6 Nov 2014 10:27:14 +0000 (11:27 +0100)]
Style fix
* include/abg-ir.h (class location): Remove useless white space.
* src/abg-writer.cc (type_has_existing_id): Use type_base_sptr
rather than shared_ptr<type_base>.
(write_template_tparameter): Use template_tparameter_sptr rather
than shared_ptr<template_tparameter>.
Dodji Seketeli [Wed, 5 Nov 2014 09:08:33 +0000 (10:08 +0100)]
Make the use of a C++-11 compiler optional
* configure.ac: Define a new --enable-cxx11 switch to control the
use of the C++-11 compiler. Define a WITH_CXX11 C macro and an
automake ENABLE_CXX11 variable.
* config.h.in: Initialize the new WITH_CXX11 C macro.
* src/Makefile.am: Include the files coded in C++-11 only if the
ENABLE_CXX11 automake variable is defined.
* tests/Makefile.am: Likewise, build the runtestsvg test program
only if C++-11 usage is enabled.
* include/abg-diff-utils.h (class d_path_vec): Remove useless
usage of the 'typename' keyword.
* include/abg-fwd.h (is_enum_type): Renamed is_enum into this,
because of a name clash with a tr1 function when not using C++-11.
(is_pointer_type): Likewise, renamed is_pointer into this because
of a name clash with a tr1 function when not using C++-11.
* src/abg-comp-filter.cc (has_harmless_name_change): Adjust for
the is_enum -> is_enum_type change.
* src/abg-comparison.cc (type_suppression::suppresses_diff):
Likewise.
(class function_suppression::priv): Add a missing "class" keyword
in friend declaration.
(diff_context::diff_has_been_traversed)
(diff_context::mark_diff_as_traversed): Do not use the C++-11
specific type uintptr_t.
* src/abg-dwarf-reader.cc (create_default_dwfl): Do not use
designated initializers. Sigh. This is handy though.
(expr_result::abs): Cast the argument of std::abs to avoid
ambiguous call.
(finish_member_function_reading): Adjust for the is_pointer ->
is_pointer_type renaming.
* src/abg-hash.cc (scope_decl::hash::operator)
(class_decl::base_spec::hash::operator)
(type_composition::hash::operator): Use std::tr1::hash string,
rather than the C++-11 specific std::hash function.
* src/abg-ini.cc (read_sections, write_sections): Make
std::ifstream constructor take a const char* rather than a string.
* src/abg-ir.cc (is_enum_type, is_pointer_type): Renamed is_enum
into is_enum_type and is_pointer into is_pointer_type.
* src/abg-writer.cc (write_translation_unit): Remove useless
typename keyword. Make ofstream take a const char* rather than a
string.
(write_namespace_decl): Remove useless typename keyword.
(write_corpus_to_native_xml_file): Make ofstream take a const
char* rather than a string.
* tests/test-abidiff.cc (main): Make ofstream take a const char*
rather than a string.
* tests/test-diff-dwarf.cc (main): Likewise.
Dodji Seketeli [Sat, 1 Nov 2014 10:55:14 +0000 (11:55 +0100)]
Initial support for variable suppressions
* include/abg-comparison.h (variable_suppression_sptr)
(variable_suppressions_type): New convenience typedefs.
(class variable_suppression): Declare new type.
* src/abg-comparison.cc (is_var_diff): New predicate.
(read_variable_suppression): Define new static function.
(class variable_suppression::priv): Define type for the private
data of the variable_suppression type.
(variable_suppression::{variable_suppression,
~variable_suppression, get_name, set_name, get_name_regex_str,
set_name_regex_str, get_symbol_name, set_symbol_name,
get_symbol_name_regex_str, set_symbol_name_regex_str,
get_symbol_version, set_symbol_version,
get_symbol_version_regex_str, set_symbol_version_regex_str,
get_type_name, set_type_name, get_type_name_regex_str,
set_type_name_regex_str, suppresses_diff}): Define new member
functions for the variable_suppression type.
* tests/data/test-diff-suppr/libtest7-var-suppr-v0.so: Add new
test input.
* tests/data/test-diff-suppr/libtest7-var-suppr-v1.so: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-1.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-2.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-3.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-4.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-5.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-6.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-7.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-8.suppr: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-6.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt:
Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-version-script: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-v0.cc: Source code
for the librairie above.
* tests/data/test-diff-suppr/test7-var-suppr-v1.cc: Source code
for the librairie above.
* tests/Makefile.am: Add the new test input data to the source
distribution.
* tests/test-diff-suppr.cc: Update to make this harness to run
over the new test input above.
Dodji Seketeli [Sat, 1 Nov 2014 10:50:10 +0000 (11:50 +0100)]
Make var_diff and function_decl_diff extend decl_diff_base
* include/abg-comparison.h (class var_diff, class
function_decl_diff): Make these types inherit the decl_diff_base
class. This is like the fact that all kinds of diff inherit the
type_diff_base class.
* src/abg-comparison.cc (var_diff::var_diff)
(function_decl_diff::function_decl_diff): Adjust to initialize the
sub-object of decl_diff_base;
(is_decl_diff): New predicate to know if a diff is about decls.
(is_function_decl): New predicate to know if a diff is about
function decls.
(function_suppression::suppresses_diff): Adjust to use the new
is_function_decl.
Dodji Seketeli [Sat, 1 Nov 2014 10:31:11 +0000 (11:31 +0100)]
Remove useless functions from the comparison engine
* include/abg-comparison.h (read_type_suppression): Remove this
function declaration.
* src/abg-comparison.cc (read_type_suppressions): Remove this
static function definition.
(read_function_suppressions): Remove this static function
declaration.
Dodji Seketeli [Sat, 1 Nov 2014 10:15:37 +0000 (11:15 +0100)]
Spit and polish variables presentation in diff report
* src/abg-comparison.cc (corpus_diff::report): Show the full
representation of the variable, rather than just its name. Also,
show the new representation of the variable only if it has
changed.
* tests/data/test-diff-dwarf/test9-report.txt: Adjust test.
* tests/data/test-diff-filter/test15-0-report.txt: Likewise.
* tests/data/test-diff-filter/test15-1-report.txt: Likewise.
Dodji Seketeli [Wed, 29 Oct 2014 21:56:08 +0000 (22:56 +0100)]
Separate alias targets with a comma
* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Separate
alias targets by a comma.
* tests/data/test-diff-dwarf/test18-alias-sym-v1.cc: Update test
to add more than one alias to a given symbol.
Dodji Seketeli [Tue, 28 Oct 2014 10:32:15 +0000 (11:32 +0100)]
Initial support for function suppressions
* include/abg-comparison.h (enum visiting_kind): Change the
meaning of this. It was to determine if traversal was to be done
in a pre or post manner. But with the recent addition of
diff_node_visitor::visit_{begin,end}() notifiers, the pre/post
handling is taken care of in a different way. So now the meaning
of this enum is changed to handle whether diff node children
should be visited or not. So the enumerators are now
DEFAULT_VISITING_KIND, and SKIP_CHILDREN_VISITING_KIND. And it's
a bit-field.
(operator{&,~}): Declare more bit manipulation operators for the
enum visiting_kind.
(function_suppression_sptr, function_suppressions_type): New
typedefs.
(function_suppression, function_suppression::parameter_spec):
Declare new types.
(read_function_suppressions): Declare new function.
(diff_node_visitor::diff_node_visitor): Adjust for the enum
visiting_kind change. Value-initialize the visiting_kind_ data
member.
* src/abg-comparison.cc (operator{&,~}): Define these operators
for enum visiting_kind.
(read_type_suppressions): Forward declare this static function.
(read_function_suppression, read_parameter_spec_from_string):
Define new static functions.
(read_suppressions): Update to read function suppressions too,
using the new read_function_suppression function above.
(class function_suppression::parameter_spec::priv): Define new
type.
(function_suppression::parameter_spec::*): Define the member
functions of the new function_suppression::parameter_spec type.
(class function_suppression::priv): Define new type.
(function_suppression::*): Define the member functions of the new
function_suppression type.
(diff::traverse): There is no more {PRE,POST}_VISITING_KIND
enumerator. So nuke the code that was dealing with it.
(redundancy_marking_visitor::skip_children_nodes_): New data
member flag.
(redundancy_marking_visitor::visit_begin): If the current diff
node is not be reported (is filtered out), do not bother visit its
children nodes for the purpose of marking redundant nodes. So use
the new skip_children_nodes_ flag above to know we are in that case.
(redundancy_marking_visitor::visit_end): Unset the new
skip_children_nodes_ flag above when appropriate.
* include/abg-fwd.h (is_function_decl): Declare new function.
* include/abg-ir.h
(function_type::get_parm_at_index_from_first_non_implicit_parm):
Declare new member function.
* src/abg-ir.cc (is_function_decl): Define new function.
(function_type::get_parm_at_index_from_first_non_implicit_parm):
Define new member function.
* src/abg-comp-filter.cc (apply_filter): Adjust for the enum
visiting_kind change. No need to set it for filters anymore
* doc/suppr-doc.txt: Update examples of function suppression.
* doc/manuals/libabigail-concepts.rst: Update the manual for the
function suppression addition.
* tests/data/test-diff-suppr/libtest5-fn-suppr-v0.so: New test input.
* tests/data/test-diff-suppr/libtest5-fn-suppr-v1.so: New test input.
* tests/data/test-diff-suppr/libtest6-fn-suppr-v0.so: New test input.
* tests/data/test-diff-suppr/libtest6-fn-suppr-v1.so: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-0.suppr: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-1.suppr: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-2.suppr: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-3.suppr: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-4.suppr: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: New test input.
* tests/data/test-diff-suppr/test5-fn-suppr-v0.cc: Source code for
new test input.
* tests/data/test-diff-suppr/test5-fn-suppr-v1.cc: Source code for
new test input.
* tests/data/test-diff-suppr/test6-fn-suppr-0.suppr: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-1.suppr: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-2.suppr: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-3.suppr: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: New test input.
* tests/data/test-diff-suppr/test6-fn-suppr-v0.cc: Source code for
new test input.
* tests/data/test-diff-suppr/test6-fn-suppr-v1.cc: Source code for
new test input.
* tests/data/test-diff-suppr/test6-fn-suppr-version-script: New
test input.
* tests/Makefile.am: Add the new files above to source
the distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the test inputs
above to the list of tests to be run by this harness.
Dodji Seketeli [Mon, 27 Oct 2014 20:07:35 +0000 (21:07 +0100)]
Pimplify abigail::ir::function_type
* include/abg-ir.h (function_type::priv_): Declare new data
member.
(function_type::<all the methods>): Move the inline methods out of
line in src/abg-ir.cc.
(function_type::{return_type_, parms_}): Move these ...
* src/abg-ir.cc (function_type::priv::{return_type_, parms_}):
... Here.
(struct function_type::priv): New type for the private data of
function_type.
(function_type::<all the methods>): Move the previously inline
methods of function_type here. Adjust them to tap into priv_->*
to get the private data members.