Commit Graph

6 Commits

Author SHA1 Message Date
Dodji Seketeli
5b09ea77e2 Handle the life time of the map of canonical types
While working on something else, it turned out that we need to cleanup
(de-allocate) the map of canonical types when all the translation
units that own types are de-allocated.  Otherwise, when new
translation units are created later, the types in the canonical types
map become unrelated to the types in these new translation units,
leading to memory management issues.

This patch introduces a "usage watchdog" which detects when no
translation unit uses the type system anymore.  That usage watchdog is
then used in the destructor of the translation_unit type to
de-allocate the global data that is logically owned by by the type
system.

The patch also changes the API to read translation units and corpora
in a way that forces users to get a handle on the resulting shared
pointer.

	* include/abg-ir.h (type_base::canonical_types_map_type): Move
	this typedef into abg-ir.cc and out of the type_base namespace.
	(type_base::get_canonical_types_map): Likewise.
	* src/abg-ir.cc (canonical_types_map_type): New typedef that got
	moved here from type_base::canonical_types_map_type.
	(get_canonical_types_map): Likewise got moved here from
	type_base::get_canonical_types_map.  Made static in the process.
	(class usage_watchdog): New type.
	(usage_watchdog_sptr, usage_watchdog_wptr): New typedefs.
	(get_usage_watchdog, get_usage_watchdog_wptr, ref_usage_watchdog)
	(maybe_cleanup_type_system_data): New static functions.
	(translation_unit::priv::usage_watchdog_): Add new data member.
	(translation_unit::priv::priv): Get a reference on the usage
	watchdog.
	(translation_unit::priv::~priv): If the usage watchdog says that
	the type system is not used, then cleanup the global data
	logically owned by the type system.

	* include/abg-dwarf-reader.h (read_corpus_from_elf): Make this
	return a corpus and set the status by reference using a parameter.
	* src/abg-dwarf-reader.cc (read_corpus_from_elf): Implement the
	above.
	* include/abg-reader.h (read_translation_unit_from_file)
	(read_translation_unit_from_buffer)
	(read_translation_unit_from_istream): Remove the overloads that do
	not return a translation_unit_sptr and that pass it as a
	parameter.  Only keep the overloads that return a
	translation_unit_sptr, forcing users of the API to own a proper
	reference on the resulting translation_unit pointer.  That is
	important to handle the life time of the global data of the type
	system that need to be cleared when the last translation unit is
	de-allocated.
	* src/abg-reader.cc (read_translation_unit_from_input): Make this
	return a translation_unit_sptr.
	(read_translation_unit_from_file)
	(read_translation_unit_from_buffer)
	(read_translation_unit_from_istream): Remove the overloads that do
	not return a translation_unit_sptr and that pass it as a
	parameter.  Only keep the overloads that return a
	translation_unit_sptr.
	(read_to_translation_unit): Make this return a
	translation_unit_sptr.
	* tests/print-diff-tree.cc (main): Adjust.
	* tests/test-diff-dwarf.cc (main): Likewise.
	* tests/test-ir-walker.cc (main): Likewise.
	* tests/test-read-dwarf.cc (main): Likewise.
	* tests/test-read-write.cc (main): Likewise.
	* tools/abicompat.cc (main): Likewise.
	* tools/abidiff.cc (main): Likewise.
	* tools/abidw.cc (main): Likewise.
	* tools/abilint.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-09 11:12:40 +02:00
Dodji Seketeli
a102a2f032 Add support for abicompat weak mode
This patch implements the weak mode of abicompat.  In this mode, just
the application and the new version of the library are provided.  The
types of functions and variables of the library that are consumed by
the application are compared to the types of the functions and
variables expected by the application.  The goal is to check if the
types of the declarations consumed by the application and provided by
the library are compatible with what the application expects.

The abicompat first gets the set of symbols undefined in the
application and exported by the library.  It then builds the set of
declarations exported by the library that have those symbols.  We call
these the set of declarations of the library that are consumed by the
application.

Note that the debug information for the application does not contain
the declarations of the functions/variables whose symbols are
undefined.  So we can not just read them to compare them to
declarations exported by the library.

But the *types* of the variables and the *sub-types* of the functions
whose symbols are undefined in the application are present in the
debug information of the application.

So in the weak mode, abicompat compare the *types* of the declarations
consumed by the application as expected by the application (described
by the debug information of the application) with the types of the
declarations exported by the library.

To do this a number of changes were necessary.

The patch builds a representation of all the types found in the
application's debug info.  Before that, only the types that are
reachable from exported declarations were represented.

The abidw tool got a new --load-all-types to test this new ability of
loading all types.

The patch also adds support for looking a type, not by name, but by
its internal representation.

In the comparison engine, function_type_diff is introduced to
represent changes between two function types.  For this, a new class
type_or_decl_base has been introduced in the IR.  It's now the base
class for both decl_base and type_base.  And abigail::comparison::diff
now takes two pointers of type_or_decl, not decl_base anymore.  So
function_type_diff can take two function_type now; not that a
function_type has no declaration so it doesn't inherit decl_base.  A
bunch of changes got made just to adjust to this modification.

A number of fixes were made too, to make this work, like adding
missing comparison operators, removing asserts that too strong, etc..

The patch also adjust the test suite as well as the documentation.

	* include/abg-fwd.h (class type_or_decl_base): Forward declare
	this.
	(is_decl, is_type, is_function_type, get_name, get_type_name)
	(get_function_type_name, get_pretty_representation)
	(lookup_function_type_in_corpus, lookup_type_in_translation_unit)
	(lookup_function_type_in_translation_unit)
	(synthesize_function_type_from_translation_unit)
	(hash_type_or_decl): New function declarations.
	* src/abg-corpus.cc (lookup_type_in_corpus)
	(lookup_function_type_in_corpus): Define new functions.
	* include/abg-ir.h
	(translation_unit::lookup_function_type_in_translation_unit):
	Declare new friend function.
	(class type_or_decl_base): Declare this.
	(operator==(const type_or_decl_base&, const type_or_decl_base&)):
	Declare new operator.
	(operator==(const type_or_decl_base_sptr&, const
	type_or_decl_base_sptr&)): Likewise.
	(class {decl_base, type_base}): Make these class inherit
	type_or_decl_base.
	(decl_base::get_member_scopes): New const overload.
	(bool operator==(const function_decl::parameter_sptr&,
	                 const function_decl::parameter_sptr&)): New operator.
	(function_type::get_parameters): Remove the non-const overload.
	(function_type::get_pretty_representation): Declare new member
	function.
	(method_type::get_pretty_representation): Likewise.
	* src/abg-ir.cc (bool operator==(const type_or_decl_base&, const
	type_or_decl_base&)): Define new equality operator.
	(bool operator==(const type_or_decl_base_sptr&, const
	type_or_decl_base_sptr&)): Likewise.
	(strip_typedef): Do not expect canonicalized types anymore.  Now
	the system accepts (and expects) canonicalized types in certain
	cases.  For instance, non-complete types and aggregated types that
	contain non-complete sub-types.
	(get_name, get_function_type_name, get_type_name)
	(get_pretty_representation, is_decl, is_type, is_function_type)
	(lookup_function_type_in_translation_unit)
	(synthesize_function_type_from_translation_unit)
	(lookup_type_in_scope, lookup_type_in_translation_unit): Define
	new functions or new overloads.
	(bool operator==(const function_decl::parameter_sptr&,
	                 const function_decl::parameter_sptr& r)): Define
	new operator.
	(function_type::get_parameters): Remove non-const overload.
	(function_type::get_pretty_representation): Define new function.
	(function_type::traverse): Adjust.
	(method_type::get_pretty_representation): Likewise.
	(function_decl::get_pretty_representation): Avoid emitting the
	type of cdtors.
	(hash_type_or_decl): Define new function.
	* include/abg-dwarf-reader.h (create_read_context)
	(read_corpus_from_elf): Take a new 'read_all_types' flag.
	* src/abg-dwarf-reader.cc (read_context::load_all_types_): New
	flag.
	(read_context::read_context): Initialize it.
	(read_context::canonical_types_scheduled): If some types still
	have non-canonicalized sub-types, then do not canonicalize them.
	(read_context::load_all_types): New member functions.
	(build_function_decl): Do not represent void return type like
	empty type anymore, rather, represent it like a void type node.
	(build_ir_node_from_die): When asked, load all types
	including those that are not reachable from an exported
	declaration.
	(create_read_context, read_corpus_from_elf): Take a new
	'load_all_types' flag and honour it.
	* src/abg-reader.cc (read_context::type_is_from_translation_unit):
	Support looking up function types in the current translation unit,
	now that we now how to lookup function types.
	* include/abg-comparison.h (diff_context::{has_diff_for, add_diff,
	set_canonical_diff_for, set_or_get_canonical_diff_for,
	get_canonical_diff_for}): Make these take instances of
	type_or_decl_base_sptr, instead of decl_base_sptr.
	(diff::diff): Likewise.
	(diff::{first_subject, second_subject}): Make these return
	type_or_decl_base_sptr instead of decl_base_sptr.
	(type_diff_base::type_diff_base): Make these take instances of
	type_or_decl_base_sptr instead of decl_base_sptr.
	(distinct_diff::distinct_diff): Likewise.
	(distinct_diff::{first, second}): Make these return
	type_or_decl_base_sptr instead of decl_base_sptr.
	(distinct_diff::entities_are_of_distinct_kinds): Make these take
	instances of type_or_decl_base_sptr instead of decl_base_sptr.
	(class function_type_diff): Create this new type.  It's a
	factorization of the function_decl_diff type.
	* src/abg-comparison.cc ():
	* src/abg-comp-filter.cc ({harmless, harmful}_filter::visit):
	Adjust as diff::{first,second}_subject() now returns a
	type_or_decl_base_sptr, no more a decl_base_sptr.
	(decls_type, decls_diff_map_type): Remove these typedefs and replace it with ...
	(types_or_decls_type, types_or_decls_diff_map_type): ... these.
	(struct {decls_hash, decls_equals): Remove these type sand replace them with ...
	(struct {types_or_decls_hash, types_or_decls_equals}): ... these.
	({type_suppression, variable_suppression}::suppresses_diff):
	Adjust.
	(diff_context::priv::decls_diff_map): Replace this with ...
	(diff_context::priv::types_or_decls_diff_map): ... this.
	(diff_context::{has_diff_for, add_diff, get_canonical_diff_for,
	set_canonical_diff_for, set_or_get_canonical_diff_for}): Take
	type_or_decl_base_sptr instead of decl_base_sptr.
	(diff::priv::{first, second}_subject): Make the type of these be
	type_or_decl_base_sptr, no more decl_base_sptr.
	(diff::priv::priv): Adjust for the subjects of the diff being of
	type type_or_decl_sptr now, no more decl_base_sptr.
	(diff_less_than_functor::operator()(const diff_sptr, const
	diff_sptr) const): Adjust.
	(diff::diff): djust for the subjects of the diff being of type
	type_or_decl_sptr now, no more decl_base_sptr.
	(diff::{first,second}_subject): Make the type of these be
	type_or_decl_base_sptr, no more decl_base_sptr.
	(report_size_and_alignment_changes): Likewise.
	(type_diff_base::type_diff_base): Make the type of this be
	type_or_decl_base_sptr instead of type_base_sptr.
	(distinct_diff::distinct_diff): Make this take instances of
	type_or_decl_base_sptr instead of decl_base_sptr.
	(distinct_diff::{first, second, entities_are_of_distinct_kinds}):
	Likewise.
	(distinct_diff::has_changes): Simplify logic.
	(distinct_diff::report): Adjust.
	(compute_diff_for_types): Add an additional case to support the
	new function_type.
	(report_size_and_alignment_changes): Make this take instances of
	type_or_decl_base_sptr instead of decl_base_sptr.
	(class_diff::priv::member_type_has_changed): Return an instance of
	type_or_decl_base_sptr rather than a decl_base_sptr.
	(class_diff::report): Adjust.
	(diff_comp::operator()(const diff&, diff&) const): Adjust.
	(enum function_decl_diff::priv::Flags): Remove.
	(function_decl_diff::priv::{first_fn_flags_, second_fn_flags_,
	fn_flags_changes_}): Remove.
	(function_decl_diff::priv::{fn_is_declared_inline_to_flag,
	fn_binding_to_flag}): Remove.
	(function_decl_diff::{deleted_parameter_at,
	inserted_parameter_at}): Remove.
	(function_decl_diff::ensure_lookup_tables_populated): Empty this.
	(function_decl_diff::chain_into_hierarchy): Adjust.
	(function_decl_diff::function_decl_diff): This now only takes the
	subjects.  It's body is now empty.
	(function_decl_diff::{return_type_diff, subtype_changed_parms,
	removed_parms, added_parms, type_diff}): Remove these member
	functions.
	(function_decl_diff::type_diff): Define new member function.
	(function_decl_diff::report): Simplify logic by using the
	reporting of the child type diff node.
	(compute_diff): Likewise, in the overload for function_decl_sptr
	simplify logic by using the child type diff object.
	(function_type_diff::priv): Define new type.
	(function_type_diff::{function_type_diff,
	ensure_lookup_tables_populated, deleted_parameter_at,
	inserted_parameter_at, finish_diff_type, first_function_type,
	second_function_type, return_type_diff, subtype_changed_parms,
	removed_parms, added_parms, get_pretty_representation,
	has_changes, has_local_changes, report, chain_into_hierarchy}):
	Define new functions.
	(compute_diff): Define new overload for function_type_sptr.
	* tools/abicompat.cc (options::weak_mode): New data member.
	(options::options): Initialize it.
	(enum abicompat_status): New enum
	(abicompat_status operator|(abicompat_status, abicompat_status))
	(abicompat_status& operator|=(abicompat_status &, abicompat_status))
	(abicompat_status operator&(abicompat_status, abicompat_status)):
	New operators to manipulate the abicompat_status enum.
	(display_usage): Add help string for the new --weak-mode option.
	(parse_command_line): Add the new --weak-mode command line
	argument.  If the tool is called with just the application and one
	library then assume that we are in the weak mode.
	(perform_compat_check_in_normal_mode): Define new function, factorized
	from what was in the main function.
	(perform_compat_check_in_weak_mode): Define new function.
	(struct {fn,var}_change): Define new types.
	(main): Use perform_compat_check_in_weak_mode() and
	perform_compat_check_in_normal_mode().
	* tools/abidiff.cc (main): Adjust.
	* tools/abidw.cc: (options::load_all_types): Add new data member.
	(options::options): Initialize it.
	(display_usage): New help string for --load-all-types.
	(parse_command_line): Support the new --load-all-types option.
	(main): Adjust and honour the --load-all-types option.
	* tools/abilint.cc (main): Adjust.
	* doc/manuals/abicompat.rst: Update documentation for the new weak
	mode.  Also provide stuff that was missing from the examples
	provided.
	* doc/manuals/abidw.rst: Update documentation for the new
	--load-all-types option.
	* tests/print-diff-tree.cc (main): Adjust.
	* tests/test-diff-dwarf.cc (main): Likewise.
	* tests/test-read-dwarf.cc (main): Likewise.
	* tests/data/test-abicompat/test0-fn-changed-app: Recompile this.
	* tests/data/test-abicompat/libtest5-fn-changed-libapp-v{0,1}.so:
	New new test input binaries
	* tests/data/test-abicompat/test5-fn-changed-app: Likewise.
	* tests/data/test-abicompat/test6-var-changed-app: Likewise.
	* tests/data/test-abicompat/libtest6-var-changed-libapp-v{0,1}.so:
	Likewise.
	* tests/data/test-abicompat/test5-fn-changed-report-0.txt:
	Reference output for one test above.
	* tests/data/test-abicompat/test6-var-changed-report-0.txt:
	Likewise.
	* tests/data/test-abicompat/test5-fn-changed-app.cc: Source file
	for a binary above.
	* tests/data/test-abicompat/test5-fn-changed-libapp-v{0,1}.{h,cc}:
	Likewise.
	* tests/data/test-abicompat/test6-var-changed-libapp-v{0,1}.{cc,h}:
	Likewise.
	* tests/data/test-abicompat/test6-var-changed-app.cc: Likewise.
	* tests/data/Makefile.am: Add the test related files above to the
	source distribution.
	* tests/test-abicompat.cc (in_out_spec): Add the new test input
	above to the list of inputs to feed to this test harness.
	(main): Support taking just the app and one library.
	* tests/data/test-read-dwarf/test{0, 1, 2.so, 3.so, 5.o,
	8-qualified-this-pointer.so,}.abi: Adjust for void type being
	really emitted now, as opposed to just being an empty type.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-03 22:45:41 +02:00
Dodji Seketeli
322b0e7769 Expose a new libabigail::tools_utils namespace
The utilities present in this namespace were previously living in
tools/abg-tools-utils.h and tools/abg-tools-utils.cc.  They were not
exported and were meant to be useful to the tools writting in the
tools/ directory.  I realized that these utilities might be useful to
clients of the libabigail library in general so I am making them
available generally.  Note that the initial name of the namespace was
libabigail::tools; so renaming it to libabigail::tools_utils required
that I adjust some client code.  I have also cleaned up the code,
interfaces and their apidoc a little bit.

	* include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in
	here.  Renamed the namespace tools into tools_utils.  Inject
	std::ostream, std::istream, std::ifstream, and std::string types
	into the tools_utils namespace.  Adjust the function declarations
	accordingly.  Remove the useless dirname() function declaration.
	* include/Makefile.am: Add abg-tools-utils.h to the list of
	exported headers.
	* src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here.
	Renamed the namespace tools into tools_utils.
	(get_stat): Add apidoc.
	(is_dir): Cleanup apidoc.
	(dir_name); Cleanup parameter name.
	(guess_file_type): Cleanup parameter type.
	* src/Makefile.am: Add abg-tools-utils.cc to the list of exported
	headers.
	* tools/Makefile.am: Do not build the temporary library
	libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out
	of this directory.
	* tools/abicompat.cc (parse_command_line, main): Adjust for tools
	-> tools_utils namespace change.
	* tools/abidiff.cc (parse_command_line, main): Likewise.
	* tools/abidw.cc (parse_command_line, main): Likewise.
	* tools/abilint.cc (parse_command_line, main): Likewise.
	* tests/test-abicompat.cc (main): Adjust for tools -> tools_utils
	namespace change.
	* tests/test-abidiff.cc (main): Likewise.
	* tests/test-alt-dwarf-file.cc (main): Likewise.
	* tests/test-core-diff.cc (main): Likewise.
	* tests/test-diff-dwarf.cc (main): Likewise.
	* tests/test-diff-filter.cc (main): Likewise.
	* tests/test-diff-suppr.cc (main): Likewise.
	* tests/test-lookup-syms.cc (main): Likewise.
	* tests/test-read-dwarf.cc (main): Likewise.
	* tests/test-read-write.cc (main): Likewise.
	* tests/Makefile.am: Do not reference the libtoolsutils.la private
	library anymore.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-08 12:28:14 +01:00
Dodji Seketeli
76837d1cbf Update copyright years
* include/abg-comp-filter.h: Update copyright years.
	* include/abg-comparison.h: Likewise.
	* include/abg-config.h: Likewise.
	* include/abg-corpus.h: Likewise.
	* include/abg-diff-utils.h: Likewise.
	* include/abg-dwarf-reader.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-hash.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-reader.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-traverse.h: Likewise.
	* include/abg-viz-common.h: Likewise.
	* include/abg-viz-dot.h: Likewise.
	* include/abg-viz-svg.h: Likewise.
	* include/abg-writer.h: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/print-diff-tree.cc: Likewise.
	* tests/test-abidiff.cc: Likewise.
	* tests/test-alt-dwarf-file.cc: Likewise.
	* tests/test-core-diff.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-diff2.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
	* tests/test-lookup-syms.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-utils.cc: Likewise.
	* tests/test-utils.h: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tools/abg-tools-utils.cc: Likewise.
	* tools/abg-tools-utils.h: Likewise.
	* tools/abiar.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abisym.cc: Likewise.
	* tools/binilint.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-07 17:52:10 +01:00
Dodji Seketeli
f44110b326 Support comparing symbols not referenced by debug info
* doc/manuals/abidiff.rst: Adjust intro to mention that w/o debug
	info, abidiff now works but just report about added/removed
	symbols.  Add documentation about the new
	--no-unreferenced-symbols option.
	* include/abg-comparison.h (string_elf_symbol_map): New typedef.
	(diff_context::show_symbols_unreferenced_by_debug_info): Declare
	new accessors.
	* src/abg-comparison.cc
	(diff_context::priv::show_syms_unreferenced_by_di_): New data
	member.
	(diff_context::priv::priv): Adjust.
	(diff_context::show_symbols_unreferenced_by_debug_info): Implement
	these accessors.
	(corpus_diff::priv::{unrefed_fn_syms_edit_script_,
	unrefed_var_syms_edit_script_, added_unrefed_fn_syms_,
	deleted_unrefed_fn_syms_, added_unrefed_var_syms_,
	deleted_unrefed_var_syms_}): New data members.
	(corpus_diff::priv::diff_stats::{num_func_syms_removed,
	num_func_syms_added, num_var_syms_removed, num_var_syms_added}):
	New data members.
	(corpus_diff::priv::diff_stats::diff_stats): Adjust.
	(corpus_diff::ensure_lookup_tables_populated): Populate lookup
	tables for added/removed symbols that are not referenced by any
	debug info.
	(corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute
	stats for the added/removed symbols not referenced by any debug
	info.
	(corpus_diff::priv::emit_diff_stats): Emit stats about
	added/removed symbols that are not referenced by any debug info.
	(corpus_diff::length): Adjust to take in account added/removed
	symbols not referenced by any debug info.
	(show_linkage_name_and_aliases): New static function.
	(corpus_diff::report): When emitting a symbol name, emit its
	version too, and tell if it aliases other symbols.  Avoid emitted
	extra new lines.  Report added/removed symbols not referenced by
	any debug info.
	(compute_diff): In the overload for corpus_sptr, compute the diffs
	for symbols not referenced by debug info.
	* include/abg-corpus.h
	(corpus::get_unreferenced_{function,variable}_symbols): Declare
	new member functions.
	* src/abg-corpus.cc (corpus_priv::{unrefed_fun_symbols,
	unrefed_var_symbols}): New data members.
	(corpus_priv::build_unreferenced_symbols_tables): Define new
	member function.
	(struct comp_elf_symbols_functor): New functor.
	(corpus::is_empty): Adjust to take in account added/removed
	symbols not referenced by debug info.
	(corpus::{get_unreferenced_function_symbols,
	corpus::get_unreferenced_variable_symbols}): Define these
	accessors.
	* include/abg-dwarf-reader.h (enum status): Transform this into
	bitfields.  Add a STATUS_UNKNOWN value that has the value 0.
	(operator|(status, status), operator&(status, status))
	(operator|=(status&, status), operator&=(status, status)): New
	bit-wise operators to manipulate instances of the status bit-field.
	* src/abg-dwarf-reader.cc (get_version_for_symbol): Fix this to
	avoid returning garbage version sometimes.
	(read_debug_info_into_corpus): Fix this to return a non-null but
	empty corpus_sptr when there is no debug info available.
	(operator|(status, status), operator&(status, status))
	(operator|=(status&, status), operator&=(status, status)): Define
	these new bitwise operators to manipulate instances of the status
	bit-field.
	(read_corpus_from_elf): Now that the abigail::dwarf_reader::status
	is a bit-field, set it to reflect if debug info and/or symbol
	tables have been found.  Do not bail out if debug info hasn't been
	found.  Rather, keep going, and go look for symbols-only; this is
	a kind of operating in degraded mode.
	* include/abg-ir.h (elf_symbol::get_aliases_id_string): Add a flag
	that says if the current instance of elf_symbol should be included
	in the list of aliases or not.
	* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define it.
	* tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.o: New test
	input.
	* tools/abidiff.cc
	(options::show_symbols_not_referenced_by_debug_info): New data
	member.
	(options:options): Adjust.
	(display_usage): Add an info string for the new
	--no-unreferenced-symbols command line option.
	(parse_command_line): Parse the new --no-unreferenced-symbols
	command line.
	(set_diff_context_from_opts): Set the diff_context according to
	the presence of --no-unreferenced-symbols.
	(main): Adjust for the fact that abigail::dwarf_reader::status is
	now a bit-field.
	* tools/abilint.cc (main): Adjust for the fact that
	abigail::dwarf_reader::status is now a bit-field..
	():
	* tests/data/test-diff-dwarf/test16-syms-only-report.txt: New test
	reference output.
	* tests/data/test-diff-dwarf/test16-syms-only-v{0,1}.cc: Source code
	for new test input.
	* tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.o: New
	test input.
	* tests/data/test-diff-dwarf/test17-non-refed-syms-v{0,1}.cc: New
	source code for test input.
	* tests/data/test-diff-dwarf/libtest18-alias-sym-v{0,1}.so: New
	test input.
	* tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt:
	Reference output for new test input.
	* tests/data/test-diff-dwarf/test18-alias-sym-v{0,1}.cc: Source
	code for new test input.
	* tests/data/test-diff-dwarf/test18-alias-sym-version-script:
	Source code for new test input.
	* tests/Makefile.am: Add the new test materials to the source
	distribution.
	* tests/test-diff-dwarf.cc(in_out_specs): Add the new input tests
	above to the array of tests to run by this harness.
	(main): Emit empty reports for empty resulting diffs.
	* tests/data/test-diff-dwarf/test{0,8,9,12,14-inline-report,}-report.txt:
	Adjust.
	* tests/data/test-diff-filter/test{0,01,2,4,5,7,8,9,10,12,13,15-0,15-1}-report.txt:
	Likewise.
	* tests/data/test-diff-filter/test{19-enum,20-inline,}-report-0.txt:
	Likewise.
	* tests/data/test-diff-suppr/test0-type-suppr-report-{1,2}.txt:
	Likewise.
	* tests/data/test-diff-suppr/test{1,2}-typedef-suppr-report-1.txt:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-22 23:04:40 +02:00
Dodji Seketeli
d041c1f5dd Rename bi* tools to abi* tools
* tests/data/test-bidiff: Rename this directory to
	tests/data/test-abidiff.
	* tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc.
	* tools/biar.cc: Renamed to tools/abiar.cc
	* tools/bidiff.cc: Renamed to tools/abidiff.cc
	* tools/bidw.cc: Renamed to tools/abidw.cc
	* tools/bilint.cc: Renamed to tools/abilint.cc
	* tools/bisym.cc: Renamed to tools/abisym.cc
	* tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*.
	* tests/test-diff-filter.cc: Renamed references to bidiff to abidiff.
	* tests/test-lookup-syms.cc: Renamed references to bisym to abisym.
	* tools/Makefile.am: Adjust.
	* tests/Makefile.am: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-26 10:58:16 +02:00