Commit Graph

571 Commits

Author SHA1 Message Date
Dodji Seketeli
85dd6d116b Constify some function parameters in abg-comp-filter.cc
* src/abg-comp-filter.cc (type_size_changed): Now take const
          parameters.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-15 12:44:24 +02:00
Jan Engelhardt
650c77bb7e Add .gitignore files.
* .gitignore: Add new file.
	* m4/.gitignore: Likewise.
	* tools/.gitignore: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:05:01 +02:00
Jan Engelhardt
4e32504064 Place -L/-l flags into *_LIBADD/*_LDADD
* src/Makefile.am: -L and -l ought to be in LIBADD/LDADD because
	that is the only place guaranteed to be in the right spot.  So add
	Them to libabigail_la_LIBADD.
	* tools/Makefile.am: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:59 +02:00
Jan Engelhardt
f505d05b3c Add libelf to libabigail.la's linker line
* configure.ac: Check for the existence of libelf at configure
	time by looking at the presence of the elf_end symbol.  Add the
	libelf to the link command line.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:57 +02:00
Jan Engelhardt
b24a8127cb Drop hardcoded substitutions
* doc/Makefile.am: Do not use @docdir@.  It's indeed replaced at
	configure time. But there is no need for this limitation with
	automake, as $(docdir) is available and replaceable anytime.
	* src/Makefile.am: Likewise for @DEPS_LIBS@ and @DEPS_CFLAGS@.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:56 +02:00
Jan Engelhardt
1708e39fe7 Replace indirect variable assignments
* configure.ac(DEVEL_CFLAGS, DEVEL_CXXFLAGS):  Remove these
	useless variables.
	(CFLAGS, CXXFLAGS): Set these variables directly.
	* include/Makefile.am (pkginclude_HEADERS): Use this predefined
	variable.
	(publicheaders_DATA, publicheadersdir): Remove these.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:54 +02:00
Jan Engelhardt
e66eda9fe7 Remove empty and autogenerated files from git repository
* ChangeLog: Remove this empty file for now.  It'll be added back
	right before the first release by automatic generation from the
	commit logs.
	* INSTALL: Remove this empty file for now.
	* NEWS: Remove this empty file for now.  It'll be added back right
	before the first release.
	* configure.ac (AM_INIT_AUTOMAKE): As the mandatory but empty
	files above are being removed for now, let's put in the 'foreign'
	mode of automake for the moment.  We'll likely remove it at
	release time.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:48 +02:00
Jan Engelhardt
aa7fc67119 Set automake options globally
* configure.ac(AM_INIT_AUTOMAKE): Set the subdir-object option
	here ..
	* src/Makefile.am: ... not here.
	* tests/Makefile.am: Likewise.
	* tools/Makefile.am: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:45 +02:00
Jan Engelhardt
0b1224faf1 Stash some autogenerated tools in build-aux/
* configure.ac: Reduce the pollution in the top-level directory a
	bit.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2014-09-12 11:04:42 +02:00
Dodji Seketeli
5f9a3bf4dd Fix memory leaks due to cycles in types ownership
* include/abg-fwd.h (std::tr1::weak_ptr): Inject this type in the
	abigail namespace.
	* include/abg-ir.h: Write a memory management guideline for the IR
	artifacts.
	(Type_base_wptr, function_type_wptr)
	(class_decl_wptr): New typedefs.
	(translation_unit::get_canonical_function_type): Declare new
	member function.
	(qualified_type_def::underlying_type_)
	(reference_type_def::pointed_to_type_)
	(typedef_decl::underlying_type_, function_decl::parameter::type_)
	(function_type::return_type_, method_type::class_type_)
	(non_type_tparameter::type_, type_composition::type_): Make this a
	weak pointer.
	(qualified_type_def::get_pointed_to_type)
	(reference_type_def::get_pointed_to_type)
	(array_type::get_element_type, typedef_decl::get_underlying_type)
	(var_decl::get_type, function_decl::parameter::get_type)
	(function_type::get_return_type, method_type::get_class_type)
	(non_type_tparameter::get_type)
	(type_composition::get_composed_type): Adjust to make this return
	a shared pointer initialized with the content of the weak pointer.
	(function_decl::function_decl, method_decl::method_decl): Remove
	the overload that doesn't take a type.  This is because now,
	function types need to be registered to their containing
	translation unit.
	(struct function_type::hash): Declare here.
	* src/abg-hash.cc (struct function_type::hash): Declare this in
	abg-ir.h and just define the methods here.
	* src/abg-ir.cc (fn_type_ptr_map): New typedef.
	(translation_unit::priv::canonical_types_): Remove this unused
	member.
	(translation_unit::priv::canonical_function_types_): New member.
	(translation_unit::get_canonical_function_type): Define this
	function.
	(array_type_def::priv::element_type_, var_decl::priv::type_)
	(function_decl::priv::type_): Make this a weak pointer.
	(qualified_type_def::get_underlying_type)
	(pointer_type_def::get_pointed_to_type)
	(reference_type_def::get_pointed_to_type)
	(array_type_def::get_element_type)
	(typedef_decl::get_underlying_type, var_decl::get_type)
	(function_decl::get_type): Adjust to make this return a shared
	pointer initialized with the content of the weak pointer.
	(qualified_type_def::build_name)
	(pointer_type_def::get_qualified_name)
	(reference_type_def::get_qualified_name): Adjust.
	(method_type::set_class_type): Cleanup the logic.
	(function_decl::priv::priv): Remove the overload that takes a bare
	pointer to a type.  This should not be used now that we need the
	function type to registered with the translation unit.
	(function_decl::function_decl): Remove the overload that doesn't
	take a type.  This is because now, function types need to be
	registered to their containing translation unit.
	* src/abg-dwarf-reader.cc (build_function_decl): Register the
	function type within its translation type and use its canonical
	version.  This complies with the new memory management rules.
	* src/abg-reader.cc (build_function_decl): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 18:08:41 +02:00
Dodji Seketeli
bcbb58d53a Compare class names when comparing methods
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 18:08:41 +02:00
Dodji Seketeli
8f6ef2e763 Slight white space fix
* src/abg-hash.cc (method_type:#️⃣:operator()(const
	method_type&)): White space fix.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 18:08:41 +02:00
Dodji Seketeli
a2f1adb617 Update copyright notice
* include/abg-ir.h: Update year of copyright notice.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-10 17:19:36 +02:00
Ondrej Oprala
bdac9d6631 Unite help output for tools
* tools/biar.cc (std::ostream): Add a using directive.
	(display_usage): Make it take a string reference and an ostream
	as parameters. Use the ostream argument as an output stream
	instead of a hard-coded cout.
	Prettify output.
	(main): Call display_usage with new parameters.
	* tools/bidiff.cc (display_usage): Declare it static.
	Prettify output.
	* tools/bidw.cc (display_usage): Prettify output.
	* tools/bilint.cc (display_usage): Declare it static.
	Prettify output.
	* tools/bisym.cc (std::cerr): Add a using directive.
	(prog_name): Rename progname into this.
	(display_usage): Rename show_help into this.
	Add an ostream as a parameter. Use the ostream argument
	as output stream insted of a hard-coded cout.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-09 18:14:35 +02:00
Dodji Seketeli
b7030c5511 Adjust copyright year
* tests/test-diff-dwarf.cc: Adjust year in copyright notice.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-03 09:59:03 +02:00
Dodji Seketeli
d38b2216a4 Sort reported changed data members by increasing offset
* include/abg-comparison.h (changed_type_or_decl_vector): New
	typedef.
	* include/abg-fwd.h (is_data_member): Change the overload that
	takes a decl_base_sptr to make it return the real var_decl_sptr
	rather than just a bool.
	* src/abg-comparison.cc (ChangedDataMemberComp, DataMemberComp):
	New comparison functors.
	(sort_changed_data_members, sort_data_members): Sorting functions
	for changed data members and data members.
	(class_diff::report): Sort reports for deleted, inserted and
	change data members by the increasing value of the offsets of said
	data members.
	* src/abg-ir.cc (is_data_member): Change the overload that takes a
	decl_base_sptr to make it return the real var_decl_sptr rather
	than just a bool.
	* tests/data/test-bidiff/test-struct1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test13-report.txt: New test input.
	* tests/data/test-diff-dwarf/test13-v0.cc: Source code for new
	test input.
	* tests/data/test-diff-dwarf/test13-v0.o: New test input.
	* tests/data/test-diff-dwarf/test13-v1.cc: Source code for new
	test input.
	* tests/data/test-diff-dwarf/test13-v1.o: New test input.
	* tests/Makefile.am: Add the new test inputs above to the source
	distribution.
	* tests/test-diff-dwarf.cc: Run this test harness on the new test
	input.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-03 09:59:03 +02:00
Dodji Seketeli
b75a020fb1 Do not filter out diff nodes that are only in NOT_REDUNDANT_CATEGORY
* src/abg-comparison.cc (diff::is_filtered_out): If a diff not is
	only in the NOT_REDUNDANT_CATEGORY category consider it as not
	being filtered.
	* tests/data/test-diff-filter/test18-report.txt: New test input.
	* tests/data/test-diff-filter/test18-v0.cc: Source code for new
	test input.
	* tests/data/test-diff-filter/test18-v0.o: New test input.
	* tests/data/test-diff-filter/test18-v1.cc: Source code for new
	test input.
	* tests/data/test-diff-filter/test18-v1.o: New test input.
	* tests/Makefile.am: Add the new test inputs to the source distribution.
	* tests/test-diff-filter.cc: Run this test harness on the new test
	input above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-03 09:59:03 +02:00
Dodji Seketeli
9936b7852b White space cleanup
* src/abg-ir.cc (get_data_member_offset): Remove useless
	horizontal white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-03 09:59:03 +02:00
Dodji Seketeli
8d41a18cf7 Add some comments in the comparison engine
* src/abg-comparison.cc: Add a comment for the file.
	(struct class_diff::priv::{subtype_changed_dm_,changed_dm_}): Add
	comment for these data members.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-03 09:59:03 +02:00
Dodji Seketeli
8aa76764ec Remove useless new line from comparison engine's report
* src/abg-comparison.cc (class_diff::report):  Do not emit new
	lines after reporting about inserted data members.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Adjust.
	* tests/data/test-bidiff/test-struct0-report.txt: Adjust.
	* tests/data/test-bidiff/test-struct1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test3-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
	* tests/data/test-diff-filter/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test01-report.txt: Adjust.
	* tests/data/test-diff-filter/test1-report.txt: Adjust.
	* tests/data/test-diff-filter/test11-report.txt: Adjust.
	* tests/data/test-diff-filter/test14-0-report.txt: Adjust.
	* tests/data/test-diff-filter/test14-1-report.txt: Adjust.
	* tests/data/test-diff-filter/test15-0-report.txt: Adjust.
	* tests/data/test-diff-filter/test15-1-report.txt: Adjust.
	* tests/data/test-diff-filter/test16-report.txt: Adjust.
	* tests/data/test-diff-filter/test17-0-report.txt: Adjust.
	* tests/data/test-diff-filter/test17-1-report.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.
	* tests/data/test-diff-filter/test3-report.txt: Adjust.
	* tests/data/test-diff-filter/test9-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-03 09:59:03 +02:00
Dodji Seketeli
b34f513889 Adjust copyright years
* src/abg-corpus.cc: Adjust copyright years.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-writer.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-01 15:15:47 +02:00
Dodji Seketeli
f1e79c86fe Factorize basic redundancy detection in diff report
* src/abg-comparison.cc
	(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER)
	(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER{2,3}): New
	macros.
	({pointer_diff, array_diff, reference_diff, qualified_type_diff,
	class_diff, typedef_diff}::report): Use the new macros above.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Adjust
	because type pretty representation are now always quoted.
	* tests/data/test-bidiff/test-struct1-report.txt: Adjust likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-09-01 15:04:37 +02:00
Dodji Seketeli
e6e7680113 Display package configuration at the end of configure
* configure.ac: Display the configure of the package at the end of
	the configure script.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-31 11:28:42 +02:00
Dodji Seketeli
36ed6e0583 Make zip archive support optional
* configure.ac: Support a new --enable-zip-archive option.  By
	default its value is set to the 'auto', meaning that if libzip is
	installed, that turns the option on -- just like if
	--enable-zip-archive was called with the value 'yes'; if libzip is
	not installed, that turns the option off -- just like if
	--enable-zip-archive was called with the value 'no'.  If libzip is
	detected, the pre-processor macro HAVE_LIBZIP is set to 1.  If
	--enable-zip-archive is turned on, the pre-processor macro
	WITH_ZIP_ARCHIVE is set to 1.
	* config.h.in (HAVE_LIBZIP, WITH_ZIP): New define.
	* src/abg-corpus.cc: Include config.h.  Guard the inclusion of
	abg-libzip-utils.h with the WITH_ZIP_ARCHIVE macro.  Likewise for
	the use of declarations coming from abg-libzip-utils.h.
	* src/abg-libzip-utils.cc: Include config.h.  Guard the file's
	content with the WITH_ZIP_ARCHIVE macro.
	* src/abg-reader.cc: Include config.h.  Guard the inclusion of
	abg-libzip-utils.h with the WITH_ZIP_ARCHIVE.  Likewise for the
	use of declarations coming from abg-libzip-utils.h.
	* src/abg-writer.cc: Likewise.
	* tests/Makefile.am: Build runtestwritereadarchive and runtestdot
	only if zip archives are supported.
	* tools/Makefile.am: The biar program is built only if
	zip archives are supported.
	* tools/bidiff.cc: Handle zip archives only if the
	WITH_ZIP_ARCHIVE macros is defined.
	* tools/bilint.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-31 11:28:42 +02:00
Dodji Seketeli
89564d516a Tell bidiff --help, wrong options and missing argument apart
* tools/bidiff.cc (options::{display_usage,missing_operand}): New
	data members.
	(options::options): Initialize them.
	(parse_command_line):  Flag missing operands.  Return false only
	when an option could not be parsed.  Flag when the user wants us
	to display help.
	(main): Tell --help, wrong options and missing argument apart and
	give an appropriate message on stderr.  The help string goes to
	stdout though.  Just like what GNU diff does.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-29 10:27:43 +02:00
Dodji Seketeli
fbbc89bad8 In bidiff, don't emit a report when the binaries have the same ABI
* tools/bidiff.cc (main): For differences of zero length, do not
	emit any report.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-29 10:27:43 +02:00
Dodji Seketeli
926ea2811e Take variables in account in corpus changes detection
* src/abg-comparison.cc (corpus_diff::length): Take changes about
	variables into account.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-29 10:27:43 +02:00
Dodji Seketeli
bc7694e14c During redundancy marking start with the current node as non redundant
* src/abg-comparison.cc (ENSURE_DIFF_NODE_TRAVERSED_ONCE):  If the
	diff node is being traversed for the first time, mark it as being
	in the NOT_REDUNDANT_CATEGORY.  I don't know why I was doing this
	only for classes and basic types.  Update comments.
	* tests/data/test-diff-filter/test16-report.txt: New test input.
	* tests/data/test-diff-filter/test16-v0.cc: Source code of new
	test input.
	* tests/data/test-diff-filter/test16-v0.o: New test input.
	* tests/data/test-diff-filter/test16-v1.cc: Source code of new
	test input.
	* tests/data/test-diff-filter/test16-v1.o: New test input.
	* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
	* tests/data/test-diff-filter/test17-1-report.txt: Likewise.
	* tests/data/test-diff-filter/test17-v0.cc: Source code of new
	test input.
	* tests/data/test-diff-filter/test17-v0.o: Likewise.
	* tests/data/test-diff-filter/test17-v1.cc: Source code of new
	test input.
	* tests/data/test-diff-filter/test17-v1.o: Likewise.
	* tests/Makefile.am: Add the new files to the source distribution.
	* tests/test-diff-filter.cc (in_out_spec): Run this test harness
	over the new test inputs.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-28 16:27:38 +02:00
Dodji Seketeli
408d0f17bf Give anonymous struct the name "__anonymous_struct__"
* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Set
	the name of anonymous structs to '__anonymous_struct_'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-28 10:09:28 +02:00
Dodji Seketeli
378f47e283 Style fix in the comparison engine
* src/abg-comparison.cc (represent): Remove useless white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-28 10:01:57 +02:00
Dodji Seketeli
83ed508010 In bidiff, change --no-linkage-names to --no-linkage-name
* tools/bidiff.cc (display_usage): Change--no-linkage-names -o
	--no-linkage-name in the help string.
	(parse_command_line): Adjust the command line parsing accordingly.
	* tests/test-diff-filter.cc (in_out_specs): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-27 15:16:53 +02:00
Dodji Seketeli
b0ced3261e In diff reports, show symbol version info in linkage names
* src/abg-comparison.cc (represent, corpus_diff::report): show
	symbol version info in linkage name info.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-27 15:12:44 +02:00
Dodji Seketeli
97cabc1248 In diff reports, fns & members add/remove at the top, changes later.
* src/abg-comparison.cc (class_diff::report): Put virtual member
	function adding/removal/change first, then data members
	add/removal, then the rest (including data members changes).
	(corpus_diff::report): Put function adding/removal first, then
	function changes.  Likewise for variables.
	* tests/data/test-bidiff/test-struct0-report.txt: Adjust.
	* tests/data/test-bidiff/test-struct1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test0-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test1-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test12-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test8-report.txt: Adjust.
	* tests/data/test-diff-dwarf/test9-report.txt: Adjust.
	* tests/data/test-diff-filter/test0-report.txt: Adjust.
	* tests/data/test-diff-filter/test01-report.txt: Adjust.
	* tests/data/test-diff-filter/test1-report.txt: Adjust.
	* tests/data/test-diff-filter/test13-report.txt: Adjust.
	* tests/data/test-diff-filter/test2-report.txt: Adjust.
	* tests/data/test-diff-filter/test3-report.txt: Adjust.
	* tests/data/test-diff-filter/test9-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-27 14:53:34 +02:00
Dodji Seketeli
06f9ed88f5 Consider symbol versions' public-ness during comparison
* src/abg-ir.cc (elf_symbol::operator==): Rather than comparing
	bindings, compare public-ness here.  That is, if two symbol
	versions' differ because one is GLOBAL and the other one is WEAK,
	they should still be considered equal, from an ABI standpoint.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-27 11:53:16 +02:00
Dodji Seketeli
495a1dba55 Lookup proper names of symbol during determination of deleted/added decls
* src/abg-comparison.cc
	({class,corpus}_diff::ensure_lookup_tables_populated):  Now that in the
	intermediate maps we store symbol *ids* rather than symbol names,
	make sure to really refer to symbol names for symbol lookups,
	rather than (wrongly) referring to symbol ids.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-27 11:37:50 +02:00
Dodji Seketeli
e5490e206b Cleanup bidiff help string some more
* tools/bidiff.cc (display_usage): Add help strings for --harmless
	and --no-harmful.
	(main): Emit the help string to stdout, not stderr.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-26 16:29:53 +02:00
Dodji Seketeli
a5350a23d6 bidiff --no-harmless is no more
* tools/bidiff.cc (display_usage): Remove the help string for the
	--no-harmless option that doesn't exist anymore, as it's on by
	default.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-26 15:51:44 +02:00
Dodji Seketeli
30b7fb8e5a During comparison use symbol name + version as decl ID
* include/abg-ir.h ({var,function}_decl::get_id): New member
	function declarations.
	* src/abg-ir.cc ({var,function}_decl::get_id): New member function
	definitions.
	* src/abg-comparison.cc
	(corpus_diff::priv::ensure_lookup_tables_populated): Use the
	::get_id() function to get an identifier for the function or
	variable.
	* src/abg-corpus.cc (symtab_build_visitor_type::build_id): Use the
	get_id of the function/variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-26 14:37:14 +02:00
Dodji Seketeli
73ffa4f562 Fix access to alternate die -> decl map
* src/abg-dwarf-reader.cc (read_context::alternate_die_decl_map):
	Return the real alternate die decl map, rather than what we was
	doing previously b/c of a stupid copy/paste.  Oh well.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-26 14:28:42 +02:00
Dodji Seketeli
b13345fd86 Take symbol versions in account when computing added/removed decls
* include/abg-corpus.h
	(corpus::lookup_{function,variable}_symbol): Add an overload
	declaration that takes the version of the symbol to lookup.
	* src/abg-comparison.cc
	(corpus_diff::priv::ensure_lookup_tables_populated): So when looking
	up the corpora for symbols, take their versions in account.
	* src/abg-corpus.cc (corpus::lookup_{function,variable}_symbol):
	Add an overload definition that takes the version of the symbol to
	lookup.
	(symtab_build_visitor_type::build_id): New
	member functions.
	(corpus::priv::build_public_decl_table): Use the new member
	functions above.
	* src/abg-ir.cc (elf_symbol::version::operator==): Do not take the
	is_default flag in account when comparing two symbol versions.
	* libtest12-v{0,1}.so: New test input files.
	* libtest12-v{0,1}.c: Source code for the test input files.
	* test12-version-script: Version script to build the files above.
	* test12-report.txt: Test input file.
	* tests/Makefile.am: Add the new test input files above to the
	source distribution.
	* tests/test-diff-dwarf.cc (in_out_specs[]): Add an entry to this
	table for the new test input files.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-25 23:16:50 +02:00
Dodji Seketeli
5c493339c6 Misc style cleanups
* include/abg-corpus.h (corpus::lookup_function_symbol)
	(corpus::lookup_variable_symbol): Add the name of the function
	parameter in the declaration.
	* include/abg-ir.h (elf_symbol::version::version): Properly indent
	this constructor declaration.
	* src/abg-corpus.cc
	(symtab_build_visitor_type::symtab_build_visitor_type): Properly
	indent constructor parameters.
	* src/abg-ir.cc (function_decl::operator==): Fix typo in
	comments.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-25 23:04:53 +02:00
Dodji Seketeli
e6b39a7813 bidiff --harmful is not supported anymore
* tools/bidiff.cc (display_usage): remove the '--harmful' line
	from the help string as this option is now activated by default.
	It's --harmless that exists now.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-25 10:45:40 +02:00
Dodji Seketeli
b6d7fcc515 A builtin type name change is not harmless - fix that
* include/abg-comp-filter.h (has_harmless_name_change): New
	function declaration.
	* include/abg-comparison.h
	(diff_category::DECL_NAME_CHANGE_CATEGORY): Renamed this into
	HARMLESS_DECL_NAME_CHANGE_CATEGORY.
	(diff_category::EVERYTHING_CATEGORY): Update.
	* include/abg-fwd.h (is_enum): New function declaration.
	(is_var_decl): Return the shared_ptr<var_decl> rather than a bool.
	(is_data_member): New overload that takes a shared_ptr<decl_base>.
	* src/abg-comp-filter.cc (decl_name_changed): Consider the
	qualified name here.
	(has_harmless_name_change): Define new function declaration.
	(harmless_filter::visit): Use the new has_harmless_name_change
	function.
	* src/abg-comparison.cc (represent)
	(report_name_size_and_alignment_changes, enum_diff::report)
	(typedef_diff::report, is_data_member): Use the new
	filtering::has_harmless_name_change function to simplify logic of
	emitting the name change related diff
	* tools/bidiff.cc (set_diff_context_from_opts): Adjust
	DECL_NAME_CHANGE_CATEGORY -> HARMLESS_DECL_NAME_CHANGE_CATEGORY.
	* src/abg-ir.cc (is_data_member, is_enum): New function definitions.
	(is_var_decl): Return the var_decl_sptr rather than just a bool.
	* tests/data/test-diff-filter/test13-report.txt: Adjust.
	* tests/data/test-diff-filter/test6-report.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-22 17:19:27 +02:00
Ondrej Oprala
055a789abe Support C and C++ array type.
* include/abg-comparison.h (array_diff): Declare new class.
	(array_diff_sptr): Shared pointer to type array_diff.
	(compute_diff): Overload the function to take type
	array_diff_sptr as the first two arguments.
	* include/abg-fwd.h (array_type_def): Declare new class.
	(subrange_type): Likewise.
	(is_array_def): Declare new function.
	* include/abg-ir.h (array_type_def_sptr): Shared pointer
	to type array_type_def.
	(array_type_def): Declare new class.
	(ir_node_visitor::visit): Declare a new virtual function
	taking a pointer to type array_type_def as an argument.
	* src/abg-comparison.cc (compute_diff_for_types): Add
	try_to_diff for two instances of type array_type_def.
	(array_diff::priv): declare struct for holding private members
	of type array_diff.
	(array_diff::array_diff): Define constructor.
	(array_diff::{first,second}_array):Define new
	member functions.
	(array_diff::element_type_diff): Likewise.
	(array_diff::{length,report,traverse}): Likewise.
	(compute_diff): Define function overloaded in
	include/abg-comparison.h.
	* src/abg-dwarf-reader.cc (build_array_type): Define new
	function. Handle DW_TAG_array_type and DW_TAG_subrange type.
	(build_ir_node_from_die): Amend case DW_TAG_array_type with
	a call to build_array_type.
	* src/abg-hash.cc (array_type_def::hash): Declare new struct.
	(type_base::dynamic_hash::operator()): Attempt to dynamic_cast
	the argument to type array_type_def as well.
	(array_type_def::hash): Declare new struct.
	* src/abg-ir.cc (array_type_def::array_type_def): Define
	constructors.
	(array_type_def::priv): declare struct for holding private members
	of type array_type_def.
	(array_type_def::operator==(const decl_base&):
	Define new operator.
	(array_type_def::operator==(const type_base&):
	Likewise.
	(array_type_def::append_subrange{,s}): Define
	new functions.
	(array_type_def::{set,get}_size_in_bits): Likewise.
	(array_type_def::get_dimension_count): Likewise.
	(array_type_def::get_qualified_name): Likewise.
	(array_type_def::get_pretty_representation): Likewise.
	(array_type_def::get_subrange_representation): Likewise.
	(array_type_def::traverse): Likewise.
	(array_type_def::get_{element_type,location,subranges}): Likewise.
	(array_type_def::is_infinite): Likewise.
	(array_type_def::~array_type_def): Define destructor.
	(ir_node_visitor::visit): Define function, taking
	pointer to array_type_def as an argument.
	* src/abg-reader.cc (map_id_and_node): Check if node
	is an array.
	(is_array_def): Check if object is an array.
	(handle_element_node): Handle array_type_def as well.
	(build_subrange_type): Define new function.
	(build_array_type_def): Likewise.
	(build_type): Build type array_type_def as well.
	(build_type_composition): Likewise.
	(handle_array_type_def): Define new function.
	* src/abg-writer.cc: (write_decl): Output arrays
	as well.
	(write_member_type): Likewise.
	(write_type_composition): Likewise.
	(write_array_type_def): Define new function.
	* tests/data/test-diff-dwarf/test{10,11}-v{0,1}.{cc,o}: New test source
	files
	* tests/data/test-diff-dwarf/test{10,11}-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test10-report.txt: New test input.
	* tests/data/test-read-dwarf/test7.cc: New test source
	file.
	* tests/data/test-read-dwarf/test7.so: New input binary
	to read.
	* tests/data/test-read-dwarf/test7.so.abi: New reference
	test to compare against.
	* tests/data/test-read-write/test25.xml: New test source
	file.
	* tests/test-diff-dwarf.cc: Adjust to launch the new test.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* test/Makefile.am: Add the new test inputs to the source
	distribution.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-22 13:07:41 +02:00
Dodji Seketeli
edb50beeed Ignore variables which type couldn't be read from DWARF
* src/abg-dwarf-reader.cc (build_var_decl): Drop the var on the
	floor if its type couldn't be built.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-19 15:13:14 +02:00
Dodji Seketeli
d08e5181f2 Support TLS variables
* src/abg-ir.cc (elf_symbol::is_variable): Accept TLS objects as
	variables too.
	* src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr)
	(die_location_address): Add an output parameter to say if the
	resulting constant value is a tls address or not.
	(lookup_public_variable_symbol_from_elf): Use the proper
	elf_symbol::is_variable() method, rather than trying to figure out
	the low levels of what a variable is here.  Also, cleanup the
	condition.
	(read_context::load_symbol_maps): Consider symbols of type
	STT_TLS, when loading symbols for variables.  Also, to avoir
	symbols that are for versions, filter out symbols of type
	STT_OBJECT and with a SHN_ABS section index.
	(read_context::get_variable_address): If the address is for a tls
	variable, do no try to adjust the address to arrange for things
	like prelink.  As that doesn't seem to affect TLS variables.
	(dwarf_expr_eval_context::set_tls_addr): New data member.
	(dwarf_expr_eval_context::dwarf_expr_eval_context): Initialize it.
	(dwarf_expr_eval_context::set_tls_address): New accessors.
	(dwarf_expr_eval_context::op_manipulates_stack): Handle
	DW_OP_GNU_push_tls_address, a bit like DW_OP_form_tls_address, but
	then, its result is a constant.  Set the
	dwarf_expr_eval_context::set_tls_addr flag when these two OPs are
	run.
	(die_member_offset): Adjust to the new signature of
	eval_last_constant_dwarf_sub_expr.
	* tests/data/test-diff-dwarf/libtest9-v0.so: New test input.
	* tests/data/test-diff-dwarf/libtest9-v1.so: Likewise.
	* tests/data/test-diff-dwarf/test9-report.txt: Likewise
	* tests/data/test-diff-dwarf/test9-v0.cc: Source code for the
	first input.
	* tests/data/test-diff-dwarf/test9-v1.cc: Source code for the
	second input.
	* tests/test-diff-dwarf.cc: Run this harness on the two new inputs
	above.
	* tests/Makefile.am: Add the new inputs to the source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-19 13:50:23 +02:00
Dodji Seketeli
d8ff78240a Update copyright for abg-dwarf-reader.cc
* src/abg-dwarf-reader.cc: Update copyright year.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-19 13:50:23 +02:00
Dodji Seketeli
1bd8dcf173 Make the link to the alt debug info file relative
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug:
	Make this link be relative.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-18 23:45:42 +02:00
Dodji Seketeli
da4f096bb9 White space fix
* tests/test-lookup-syms.cc: Remove useless white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-15 18:28:22 +02:00
Dodji Seketeli
7fa9c3ca04 Update copyright notice
* tests/test-lookup-syms.cc: Update year in copyright notice.
	* tools/bidw.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-15 18:27:34 +02:00