]> sourceware.org Git - libabigail.git/log
libabigail.git
10 years agoFactorize a no-op deleter for shared pointer
Dodji Seketeli [Tue, 30 Sep 2014 16:04:14 +0000 (18:04 +0200)]
Factorize a no-op deleter for shared pointer

* include/abg-sptr-utils.h (struct noop_deleter): Move this here
from ...
* src/abg-comparison.cc (struct noop_deleter): ... here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoLink manuals from the main web page
Dodji Seketeli [Tue, 30 Sep 2014 15:53:35 +0000 (17:53 +0200)]
Link manuals from the main web page

* doc/website/mainpage.txt: Add a link to the manuals.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoInitial documentation for libabigail
Dodji Seketeli [Fri, 26 Sep 2014 15:02:46 +0000 (17:02 +0200)]
Initial documentation for libabigail

* doc/manuals/Makefile: New file, generated by sphinx-quickstart.
* doc/manuals/abidiff.rst: New manual for abidiff.
* doc/manuals/abidw.rst: New manual for abidw.
* doc/manuals/abilint.rst: New manual for abilint.
* doc/manuals/conf.py: New configuration file generated by sphinx-quickstart.
* doc/manuals/index.rst: The root of the this documentation.
* doc/manuals/libabigail-overview.rst: The overview of libabigail.
* doc/manuals/tools.rst: The root of the tools manuals.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoDo not install the abisym program
Dodji Seketeli [Fri, 26 Sep 2014 14:14:18 +0000 (16:14 +0200)]
Do not install the abisym program

* tools/Makefile.am: Do not install abisym.  It's really there
just for testing purposes and is of almost no use for generic
users.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoRename bi* tools to abi* tools
Dodji Seketeli [Fri, 26 Sep 2014 08:58:16 +0000 (10:58 +0200)]
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>
10 years agoLight cleanup in abg-corpus.cc
Dodji Seketeli [Fri, 19 Sep 2014 09:36:37 +0000 (11:36 +0200)]
Light cleanup in abg-corpus.cc

* src/abg-corpus.cc
(symtab_build_visitor_type::regex_fns_suppress): use
sptr_utils::build_sptr, rather than building the shared_ptr of
regex_t by hand.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoPimplify abigail::comparison::diff type
Dodji Seketeli [Thu, 18 Sep 2014 13:43:03 +0000 (15:43 +0200)]
Pimplify abigail::comparison::diff type

* include/abg-comparison.h (diff::{priv, sptr}): New types.
(diff::priv_): New member.
(diff::*): Remove all the other previous data members and
transform the inline member function definition into declarations
only.
* src/abg-comparison.cc (class diff::priv): New private data type.
(diff::*): Define the previous inline member functions as
out-of-line here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoRename shared_ptr<regex_t> into regex_t_sptr
Dodji Seketeli [Thu, 18 Sep 2014 20:45:18 +0000 (22:45 +0200)]
Rename shared_ptr<regex_t> into regex_t_sptr

* include/abg-sptr-utils.h (build_sptr()): Rename the return type
from shared_ptr<regex_t> to regex_t_sptr.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoFix a comment in abg-comparison.h
Dodji Seketeli [Fri, 19 Sep 2014 09:35:05 +0000 (11:35 +0200)]
Fix a comment in abg-comparison.h

* include/abg-comparison.h (class base_diff): Fix comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoLight style cleanup in tools/bidiff.cc
Dodji Seketeli [Fri, 5 Sep 2014 14:34:05 +0000 (16:34 +0200)]
Light style cleanup in tools/bidiff.cc

* tools/bidiff.cc (display_usage): Remove useless space before '&'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agosrc/Makefile.am cleanup
Dodji Seketeli [Fri, 5 Sep 2014 14:33:27 +0000 (16:33 +0200)]
src/Makefile.am cleanup

* src/Makefile.am: Remove the unused 'headers' variable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoEmit reports about not-yet categorized diff nodes
Dodji Seketeli [Tue, 16 Sep 2014 13:14:35 +0000 (15:14 +0200)]
Emit reports about not-yet categorized diff nodes

* include/abg-comparison.h (NO_CHANGE_CATEGORY): Better comment
this enumerator.
* src/abg-comparison.cc (diff::is_filtered_out): Not-yet
categorized changes are not filtered out anymore.
(distinct_diff::report): Avoid extraneous new line here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoBetter support for inline related diffs
Dodji Seketeli [Tue, 16 Sep 2014 12:53:30 +0000 (14:53 +0200)]
Better support for inline related diffs

* include/abg-comparison.h
(diff_category::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY): New
enumerator.
(diff_category::EVERYTHING_CATEGORY): Adjust.
* include/abg-ir.h (elf_symbol::get_aliases_id_string)
(elf_symbol::does_alias, elf_symbols_alias)
(compute_aliases_for_elf_symbol): Declare new functions ...
* src/abg-ir.cc (elf_symbol::get_aliases_id_string)
(elf_symbol::does_alias, elf_symbols_alias)
(compute_aliases_for_elf_symbol): ... and define them.
(function_decl::operator==): Take in account elf symbol aliases.
* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
Define new static functions.
(harmless_filter::visit): Categorize function name changes that
n doesn't impact underlying elf symbols (or the fact that two
symbols were aliases and are not anymore) as harmless.
* src/abg-comparison.cc (function_decl_diff::report): Properly
report function name changes, or symbol aliases changes for that
matter.  Also report inline-ness declaration changes.
* src/abg-dwarf-reader.cc (die_is_declared_inline): New static
function.
(build_function_decl): Use the above.
* tools/bidiff.cc (set_diff_context_from_opts): Add
abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY into the
harmless change camp.
* tests/data/test-diff-dwarf/test14-inline-report.txt: New test
input.
* tests/data/test-diff-dwarf/test14-inline-v0.o: Likewise.
* tests/data/test-diff-dwarf/test14-inline-v1.o: Likewise.
* tests/data/test-diff-dwarf/test14-inline-v0.cc: Source code for
test input.
* tests/data/test-diff-dwarf/test14-inline-v1.cc: Source code for
test input.
* tests/test-diff-dwarf.cc: Run this test harness over the new
input above.
* tests/data/test-diff-filter/test20-inline-report-0.txt: Likewise.
* tests/data/test-diff-filter/test20-inline-report-1.txt:
Likewise.
* tests/data/test-diff-filter/test20-inline-v0.o: New test input.
* tests/data/test-diff-filter/test20-inline-v1.o: New test input.
* tests/data/test-diff-filter/test20-inline-v0.cc: Source code for
test input.
* tests/data/test-diff-filter/test20-inline-v1.cc: Likewise.
* tests/test-diff-filter.cc: Run this test harness over the new
input above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoBetter support for enum diffs
Dodji Seketeli [Tue, 16 Sep 2014 11:40:35 +0000 (13:40 +0200)]
Better support for enum diffs

* include/abg-comparison.h (changed_enumerator_type): New typedef.
(diff_category::{HARMLESS_ENUM_CHANGE_CATEGORY}): New enumerator.
* src/abg-comp-filter.cc (has_type_size_change)
(has_enumerator_insertion, has_enumerator_removal_or_change)
(has_harmful_enum_change): New functions.
(harmless_filter::visit): Categorize enumerator insertions that
don't change the size of the type into HARMLESS_ENUM_CHANGE_CATEGORY.
(harmful_filter::visit): Categorize enumerator removal or any enum
change that changes the size of the type into
SIZE_OR_OFFSET_CHANGE_CATEGORY.
* src/abg-comparison.cc (enumerator_value_comp)
(changed_enumerator_comp): New types.
(sort_enumerators, sort_changed_enumerators): New static
functions.
(enum_diff::report): Sort enum related reports by the value of the
enumerators.
* src/abg-dwarf-reader.cc (build_enum_type): Name anonymous enums
as __anonymous_enum__.
  * tools/bidiff.cc (set_diff_context_from_opts): Add
abigail::comparison::HARMLESS_ENUM_CHANGE_CATEGORY into the harmless
stuff camp.
* tests/data/test-diff-dwarf/test15-enum-report.txt: New test
input.
* tests/data/test-diff-dwarf/test15-enum-v1.o: Likewise.
* tests/data/test-diff-dwarf/test15-enum-v0.o: Likewise.
* tests/data/test-diff-dwarf/test15-enum-v0.cc: Source code for
test input.
* tests/data/test-diff-dwarf/test15-enum-v1.cc: Likewise.

* tests/data/test-diff-filter/test19-enum-report-0.txt: New test input.
* tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise.
* tests/data/test-diff-filter/test19-enum-v0.o: Likewise.
* tests/data/test-diff-filter/test19-enum-v1.o: Likewise.
* tests/data/test-diff-filter/test19-enum-v0.cc: Source code for
test input.
* tests/data/test-diff-filter/test19-enum-v1.cc: Likewise.
* tests/test-diff-dwarf.cc: Run this test harness on the new test
inputs above.
* tests/test-diff-filter.cc: Likewise.
* tests/Makefile.am: Add the new files above to the source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoAdd constness to elf_symbol::operator==
Dodji Seketeli [Tue, 16 Sep 2014 09:21:47 +0000 (11:21 +0200)]
Add constness to elf_symbol::operator==

* include/abg-ir.h (elf_symbol::operator==): Add a const to the
declaration ...
* src/abg-ir.cc (elf_symbol::operator==): ... and to the definition.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoMisc style cleanups
Dodji Seketeli [Mon, 15 Sep 2014 10:48:52 +0000 (12:48 +0200)]
Misc style cleanups

* src/abg-comparison.cc (ChangedDataMemberComp): Rename this to
changed_data_member_comp
(sort_changed_data_members): Adjust.
(DataMemberComp): Rename this to data_member_comp.
(sort_data_members): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoConstify some function parameters in abg-comp-filter.cc
Dodji Seketeli [Mon, 15 Sep 2014 10:44:24 +0000 (12:44 +0200)]
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>
10 years agoAdd .gitignore files.
Jan Engelhardt [Tue, 9 Sep 2014 10:40:57 +0000 (12:40 +0200)]
Add .gitignore files.

* .gitignore: Add new file.
* m4/.gitignore: Likewise.
* tools/.gitignore: Likewise.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
10 years agoPlace -L/-l flags into *_LIBADD/*_LDADD
Jan Engelhardt [Tue, 9 Sep 2014 11:05:52 +0000 (13:05 +0200)]
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>
10 years agoAdd libelf to libabigail.la's linker line
Jan Engelhardt [Tue, 9 Sep 2014 12:53:41 +0000 (14:53 +0200)]
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>
10 years agoDrop hardcoded substitutions
Jan Engelhardt [Tue, 9 Sep 2014 11:04:45 +0000 (13:04 +0200)]
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>
10 years agoReplace indirect variable assignments
Jan Engelhardt [Tue, 9 Sep 2014 10:52:07 +0000 (12:52 +0200)]
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>
10 years agoRemove empty and autogenerated files from git repository
Jan Engelhardt [Tue, 9 Sep 2014 10:48:39 +0000 (12:48 +0200)]
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>
10 years agoSet automake options globally
Jan Engelhardt [Tue, 9 Sep 2014 10:48:02 +0000 (12:48 +0200)]
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>
10 years agoStash some autogenerated tools in build-aux/
Jan Engelhardt [Tue, 9 Sep 2014 10:36:24 +0000 (12:36 +0200)]
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>
10 years agoFix memory leaks due to cycles in types ownership
Dodji Seketeli [Wed, 10 Sep 2014 15:09:47 +0000 (17:09 +0200)]
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>
10 years agoCompare class names when comparing methods
Dodji Seketeli [Wed, 10 Sep 2014 16:07:11 +0000 (18:07 +0200)]
Compare class names when comparing methods

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoSlight white space fix
Dodji Seketeli [Wed, 10 Sep 2014 16:07:33 +0000 (18:07 +0200)]
Slight white space fix

* src/abg-hash.cc (method_type::hash::operator()(const
method_type&)): White space fix.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoUpdate copyright notice
Dodji Seketeli [Wed, 10 Sep 2014 12:00:46 +0000 (14:00 +0200)]
Update copyright notice

* include/abg-ir.h: Update year of copyright notice.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoUnite help output for tools
Ondrej Oprala [Sat, 5 Jul 2014 20:17:01 +0000 (22:17 +0200)]
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>
10 years agoAdjust copyright year
Dodji Seketeli [Wed, 3 Sep 2014 07:25:54 +0000 (09:25 +0200)]
Adjust copyright year

* tests/test-diff-dwarf.cc: Adjust year in copyright notice.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoSort reported changed data members by increasing offset
Dodji Seketeli [Wed, 3 Sep 2014 06:46:58 +0000 (08:46 +0200)]
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>
10 years agoDo not filter out diff nodes that are only in NOT_REDUNDANT_CATEGORY
Dodji Seketeli [Tue, 2 Sep 2014 22:13:46 +0000 (00:13 +0200)]
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>
10 years agoWhite space cleanup
Dodji Seketeli [Tue, 2 Sep 2014 22:05:31 +0000 (00:05 +0200)]
White space cleanup

* src/abg-ir.cc (get_data_member_offset): Remove useless
horizontal white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoAdd some comments in the comparison engine
Dodji Seketeli [Tue, 2 Sep 2014 22:02:44 +0000 (00:02 +0200)]
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>
10 years agoRemove useless new line from comparison engine's report
Dodji Seketeli [Tue, 2 Sep 2014 21:50:20 +0000 (23:50 +0200)]
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>
10 years agoAdjust copyright years
Dodji Seketeli [Mon, 1 Sep 2014 13:15:47 +0000 (15:15 +0200)]
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>
10 years agoFactorize basic redundancy detection in diff report
Dodji Seketeli [Mon, 1 Sep 2014 13:04:37 +0000 (15:04 +0200)]
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>
10 years agoDisplay package configuration at the end of configure
Dodji Seketeli [Sun, 31 Aug 2014 09:17:03 +0000 (11:17 +0200)]
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>
10 years agoMake zip archive support optional
Dodji Seketeli [Sun, 31 Aug 2014 08:34:11 +0000 (10:34 +0200)]
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>
10 years agoTell bidiff --help, wrong options and missing argument apart
Dodji Seketeli [Thu, 28 Aug 2014 15:54:36 +0000 (17:54 +0200)]
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>
10 years agoIn bidiff, don't emit a report when the binaries have the same ABI
Dodji Seketeli [Thu, 28 Aug 2014 15:52:12 +0000 (17:52 +0200)]
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>
10 years agoTake variables in account in corpus changes detection
Dodji Seketeli [Fri, 29 Aug 2014 07:45:27 +0000 (09:45 +0200)]
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>
10 years agoDuring redundancy marking start with the current node as non redundant
Dodji Seketeli [Thu, 28 Aug 2014 14:12:16 +0000 (16:12 +0200)]
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>
10 years agoGive anonymous struct the name "__anonymous_struct__"
Dodji Seketeli [Thu, 28 Aug 2014 08:09:28 +0000 (10:09 +0200)]
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>
10 years agoStyle fix in the comparison engine
Dodji Seketeli [Thu, 28 Aug 2014 08:01:57 +0000 (10:01 +0200)]
Style fix in the comparison engine

* src/abg-comparison.cc (represent): Remove useless white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoIn bidiff, change --no-linkage-names to --no-linkage-name
Dodji Seketeli [Wed, 27 Aug 2014 13:16:53 +0000 (15:16 +0200)]
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>
10 years agoIn diff reports, show symbol version info in linkage names
Dodji Seketeli [Wed, 27 Aug 2014 13:12:44 +0000 (15:12 +0200)]
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>
10 years agoIn diff reports, fns & members add/remove at the top, changes later.
Dodji Seketeli [Wed, 27 Aug 2014 12:53:34 +0000 (14:53 +0200)]
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>
10 years agoConsider symbol versions' public-ness during comparison
Dodji Seketeli [Wed, 27 Aug 2014 09:53:16 +0000 (11:53 +0200)]
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>
10 years agoLookup proper names of symbol during determination of deleted/added decls
Dodji Seketeli [Wed, 27 Aug 2014 09:37:50 +0000 (11:37 +0200)]
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>
10 years agoCleanup bidiff help string some more
Dodji Seketeli [Tue, 26 Aug 2014 14:29:53 +0000 (16:29 +0200)]
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>
10 years agobidiff --no-harmless is no more
Dodji Seketeli [Tue, 26 Aug 2014 13:51:44 +0000 (15:51 +0200)]
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>
10 years agoDuring comparison use symbol name + version as decl ID
Dodji Seketeli [Tue, 26 Aug 2014 12:37:14 +0000 (14:37 +0200)]
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>
10 years agoFix access to alternate die -> decl map
Dodji Seketeli [Tue, 26 Aug 2014 12:28:42 +0000 (14:28 +0200)]
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>
10 years agoTake symbol versions in account when computing added/removed decls
Dodji Seketeli [Mon, 25 Aug 2014 21:06:18 +0000 (23:06 +0200)]
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>
10 years agoMisc style cleanups
Dodji Seketeli [Mon, 25 Aug 2014 21:04:53 +0000 (23:04 +0200)]
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>
10 years agobidiff --harmful is not supported anymore
Dodji Seketeli [Mon, 25 Aug 2014 08:45:40 +0000 (10:45 +0200)]
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>
10 years agoA builtin type name change is not harmless - fix that
Dodji Seketeli [Fri, 22 Aug 2014 15:19:27 +0000 (17:19 +0200)]
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>
10 years agoSupport C and C++ array type.
Ondrej Oprala [Mon, 18 Aug 2014 09:56:43 +0000 (11:56 +0200)]
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>
10 years agoIgnore variables which type couldn't be read from DWARF
Dodji Seketeli [Tue, 19 Aug 2014 13:13:14 +0000 (15:13 +0200)]
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>
10 years agoSupport TLS variables
Dodji Seketeli [Tue, 19 Aug 2014 09:08:36 +0000 (11:08 +0200)]
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>
10 years agoUpdate copyright for abg-dwarf-reader.cc
Dodji Seketeli [Mon, 18 Aug 2014 21:55:36 +0000 (23:55 +0200)]
Update copyright for abg-dwarf-reader.cc

* src/abg-dwarf-reader.cc: Update copyright year.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoMake the link to the alt debug info file relative
Dodji Seketeli [Mon, 18 Aug 2014 21:45:42 +0000 (23:45 +0200)]
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>
10 years agoWhite space fix
Dodji Seketeli [Fri, 15 Aug 2014 16:28:22 +0000 (18:28 +0200)]
White space fix

* tests/test-lookup-syms.cc: Remove useless white space.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoUpdate copyright notice
Dodji Seketeli [Fri, 15 Aug 2014 16:27:34 +0000 (18:27 +0200)]
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>
10 years agoSupport alternate debug info sections
Dodji Seketeli [Fri, 15 Aug 2014 16:11:49 +0000 (18:11 +0200)]
Support alternate debug info sections

ABGBZ#17193
* include/abg-dwarf-reader.h (class read_context)
(typedef read_context_sptr, create_read_context)
(has_alt_debug_info): Declare these.
(read_corpus_from_elf): Declare new overload.
* src/abg-dwarf-reader.cc (find_alt_debug_info)
(is_die_attribute_resolved_through_gnu_ref_alt)
(build_primary_die_parent_relations_under)
(build_alternate_die_parent_relations_under):
Define new static functions.
(read_context::{alt_dwarf_,
alt_debug_info_path_, alternate_die_decl_map_,
alternate_die_parent_map_}): New data members.
(read_context::{alt_dwarf, alt_debug_info_path,
alternate_die_decl_map, associate_die_to_decl_primary,
associate_die_to_decl_alternate, associate_die_to_decl,
lookup_decl_from_die_offset_primary,
lookup_decl_from_die_offset_alternate,
lookup_decl_from_die_offset, alternate_die_parent_map}): New
member functions.
(read_context::load_debug_info): Painfully Get a handle on the
alternate debug info section too.  We shouldn't have to do all
this work; we could use the new dwarf_getalt() function from
libdw, but we cannot as we want to support supports that predate
that api.  When a version of elfutils gets released with that api
though, we should conditionally use that instead.
(build_ir_node_from_die, get_parent_die, get_scope_for_die)
(build_namespace_decl_and_add_to_ir)
(build_class_type_and_add_to_ir, build_qualified_type)
(build_pointer_type_def, build_reference_type, build_typedef_type)
(build_var_decl, build_function_decl): Take a new parameter that
tells if the input DIE is from alternate debug info.  Adjust their
code accordingly.
(die_die_attribute): Take a new output parameter that tells if the
resolved DIE is from alternate debug info.  Also take a new
parameter that tells if the input DIE is from alternate debug info
sections.
(build_die_parent_relations_under): Take the DIE -> parent map to
act upon.  Also, add a new overload that takes a flag saying if
the DIE is from alternate debug info or not, and act upon that.
(build_die_parent_maps): Renamed build_die_parent_map into this
and make it build DIE -> parent DIE relationship for the alternate
debug info file as well.
(find_last_import_unit_point_before_die, ): Adjust to use the
information about if the relevant DIEs are in alternate debug info
or not.
(build_translation_unit_and_add_to_ir): Clear the alternate DIE ->
decl map, that is per TU just as the primary DIE -> decl map.
Adjust to use the information about if the relevant DIEs are in
alternate debug info or not.
(read_debug_info_into_corpus): Build the two DIE -> DIE parent
maps (one for the primary debug info and one for the alternate
debug info).
(create_read_context, has_alt_debug_info): Define new public entry
points.
(read_corpus_from_elf): New entry point overload that takes a
read_context.
* tools/bidw.cc (options::{check_alt_debug_info_path,
show_base_name_alt_debug_info_path}): New data members.
(display_usage): Update for the two new options
--check-alternate-debug-info and
check-alternate-debug-info-base-name.
(parse_command_line): Parse the two options above.
(main) Handle the two new options above.
* tests/Makefile.am: Build the new runtestaltdwarf test.  Add the
new data/test-alt-dwarf-file/* files to the build system.
* tests/test-alt-dwarf-file.cc: New test driver.
* tests/data/test-alt-dwarf-file/test0-common.cc: New test input
files.
* tests/data/test-alt-dwarf-file/libtest0-common.so: Likewise.
* tests/data/test-alt-dwarf-file/test0.cc: Likewise.
* tests/data/test-alt-dwarf-file/libtest0.so: Likewise.
* tests/data/test-alt-dwarf-file/test0.h: Likewise.
* tests/data/test-alt-dwarf-file/test0-common-dwz.debug: Likewise.
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug:
Likewise.
* tests/data/test-alt-dwarf-file/test0-debug-dir/test0-common-dwz.debug:
Likewise.
* tests/data/test-read-dwarf/test1.abi: Adjust. bidw doesn't emit
an abstract constructor/destructor anymore. It emits just the
functions matching the cdtor symbols found in the binary.
* tests/data/test-read-dwarf/test2.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoBetter handle corner cases of void* DWARF parsing
Dodji Seketeli [Sat, 26 Jul 2014 08:07:36 +0000 (10:07 +0200)]
Better handle corner cases of void* DWARF parsing

* src/abg-dwarf-reader.cc (build_pointer_type_def):  Better
support cases where the underlying type of the pointer is not
know.  In that case, the pointer should not be created.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoSupport finding symbols with bias wrt DWARF references
Dodji Seketeli [Sun, 20 Jul 2014 08:44:14 +0000 (10:44 +0200)]
Support finding symbols with bias wrt DWARF references

* src/abg-dwarf-reader.cc (get_binary_load_address): New function
definition.
(read_context::elf_handle): Add comment.
(read_context::{dwarf_elf_handle, dwarf_is_splitted,
maybe_adjust_address_for_exec_or_dyn}): New method definitions.
(maybe_adjust_fn_sym_address)
(maybe_adjust_var_sym_address): Move these so they become members
of read_context.  Also, For shared libraries and executable (that
could have been e.g prelinked), consider their loading address
when trying to find which symbol resides at a given place in
memory.
(read_context::{get_function_address, get_variable_address):
Adjust.
(build_translation_unit_and_add_to_ir): Fix comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoReset the scope of void_type_decl for each new translation unit
Dodji Seketeli [Sun, 20 Jul 2014 08:29:55 +0000 (10:29 +0200)]
Reset the scope of void_type_decl for each new translation unit

* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
Clear the void_type_decl on new translation units.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoUpdate INSTALL file
Dodji Seketeli [Fri, 18 Jul 2014 17:01:43 +0000 (19:01 +0200)]
Update INSTALL file

* INSTALL: Adjust the copyright year information because autotools
2.69 did.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoCorrectly write the name of a const reference type
Dodji Seketeli [Fri, 18 Jul 2014 16:55:23 +0000 (18:55 +0200)]
Correctly write the name of a const reference type

* src/abg-dwarf-reader.cc (maybe_strip_qualification): Define new
function.
(build_ir_node_from_die): Use the maybe_strip_qualification when
building a qualified type.
* src/abg-ir.cc (qualified_type_def::build_name): Fix the
representation of the name of a reference that is const.
* tests/data/test-read-dwarf/test1.abi: Adjust.
* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
* tests/data/test-diff-dwarf/test1-report.txt: Likewise.
* tests/data/test-diff-dwarf/test6-report.txt: Likewise.
* tests/data/test-diff-dwarf/test7-report.txt: Likewise.
* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
* tests/data/test-diff-filter/test0-report.txt: Likewise.
* tests/data/test-diff-filter/test01-report.txt: Likewise.
* tests/data/test-diff-filter/test2-report.txt: Likewise.
* tests/data/test-diff-filter/test3-report.txt: Likewise.
* tests/data/test-diff-filter/test9-report.txt: Likewise.
* tests/data/test-diff-filter/test10-report.txt: Likewise.
* tests/data/test-diff-filter/test13-report.txt: Likewise.
* tests/data/test-diff-filter/test14-0-report.txt: Likewise.
* tests/data/test-diff-filter/test14-1-report.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoConsider symbols with STB_GNU_UNIQUE binding as public
Sinny Kumari [Tue, 1 Jul 2014 11:57:00 +0000 (18:27 +0630)]
Consider symbols with STB_GNU_UNIQUE binding as public

* src/abg-ir.cc (is_public): Change in function to consider
symbols with STB_GNU_UNIQUE binding as public
* tests/data/test-read-dwarf/test6.cc: Test file to generate
STB_GNU_UNIQUE binding symbols
* tests/data/test-read-dwarf/test6.so: Test shared library having
STB_GNU_UNIQUE binding symbols
* tests/data/test-read-dwarf/test6.so.abi: XML file containing
dwarf information from test6.so
* tests/test-read-dwarf.cc (in_out_specs): Add the new test above
* tests/Makefile.am: Add tests/data/test-read-dwarf/test6.cc,
tests/data/test-read-dwarf/test6.so and
tests/data/test-read-dwarf/test6.so.abi to the distribution

Signed-off-by: Sinny Kumari <skumari@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoAdd comment to test-read-write.cc
Dodji Seketeli [Tue, 1 Jul 2014 07:42:25 +0000 (09:42 +0200)]
Add comment to test-read-write.cc

* tests/test-read-write.cc: Update copyright notice and add a
meaningful comment for the file.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoSupport reading void* type from DWARF
Dodji Seketeli [Mon, 23 Jun 2014 15:24:54 +0000 (17:24 +0200)]
Support reading void* type from DWARF

* include/abg-ir.h (type_decl::get_void_type_decl): Declare new
static method.
* src/abg-ir.cc (type_decl::get_void_type_decl): Define it.
* src/abg-dwarf-reader.cc (build_ir_node_for_void_type): Define
new static function.
(build_pointer_type_def): Support void* type nodes here.
* tests/data/test-read-dwarf/test5.cc: Source code for new test
input.
* tests/data/test-read-dwarf/test5.o: New test input.
* tests/data/test-read-dwarf/test5.o.abi: Likewise.
* tests/Makefile.am: Add the above to the source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoUpdate a comment in abg-dwarf-reader.cc
Dodji Seketeli [Mon, 23 Jun 2014 15:22:05 +0000 (17:22 +0200)]
Update a comment in abg-dwarf-reader.cc

* src/abg-dwarf-reader.cc (build_ir_node_from_die): Update a
comment here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoHandle C99 restrict qualifier and DWARFv3 DW_TAG_restrict_type.
Mark Wielaard [Sun, 22 Jun 2014 22:31:19 +0000 (00:31 +0200)]
Handle C99 restrict qualifier and DWARFv3 DW_TAG_restrict_type.

* src/abg-dwarf-reader.cc (build_qualified_type): Handle
DW_TAG_restrict_type by adding CV_RESTRICT.
(build_ir_node_from_die): Call build_qualified_type for
DW_TAG_restrict_type.
* src/abg-reader.cc (build_qualified_type_decl): Handle
"restrict" attribute by adding CV_RESTRICT.
* src/abg-writer.cc (write_qualified_type_def): Output
"restrict" attribute for CV_RESTRICT.
* tests/data/test-read-dwarf/test4.c: New test file.
* tests/data/test-read-dwarf/test4.so: Likewise.
* tests/data/test-read-dwarf/test4.so.abi: Likewise.
* tests/data/test-read-write/test24.xml: Likewise.
* tests/test-read-dwarf.cc (in_out_specs): Add test4.
* tests/test-read-write.cc (in_out_specs): Add test24.xml.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
10 years agoAdd subdir-objects automake option where it is needed
Dodji Seketeli [Mon, 23 Jun 2014 12:23:04 +0000 (14:23 +0200)]
Add subdir-objects automake option where it is needed

* src/Makefile.am: Add the subdir-object automake option here.
Do not specify absolute paths for the input files as Automake now
takes care of that just fine.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
10 years agoRemove autotools artifacts from the repository
Dodji Seketeli [Mon, 23 Jun 2014 12:20:46 +0000 (14:20 +0200)]
Remove autotools artifacts from the repository

* config.guess: Remove from revision control system.
* config.sub: Likewise.
* depcomp: Likewise.
* m4/libtool.m4: Likewise.
* missing: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoAvoid reporting diff nodes that have already been reported
Dodji Seketeli [Mon, 23 Jun 2014 10:05:20 +0000 (12:05 +0200)]
Avoid reporting diff nodes that have already been reported

* include/abg-comp-filter.h (class harmful_filter): Update
comment.
(class redundant_filter): Declare new filter.
* include/abg-comparison.h (enum
diff_category::NOT_REDUNDANT_CATEGORY): New category.  Update the
values of the other enumerators.
(diff_context::{add_diff, diff_has_been_traversed}): New overloads.
(diff_context::{categorizing_redundancy, show_redundant_changes}):
Declare new methods.
(diff_context::remove_from_category): Define new inline method.
* src/abg-comparison.cc (noop_deleter::operator()): Constify the
parameter.
(CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE)
(UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE): New macros.
(TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY): Use the new
CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE and
UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE macros above.
(ENSURE_DIFF_NODE_TRAVERSED_ONCE)
(ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): If the (type_decl or class)
node hasn't been yet traversed, mark it as non-redundant.
(diff_context::priv::categorizing_redundancy): New member.
(diff_context::priv::priv): Initialize it.
(diff_context::{add_diff, diff_has_been_traversed): Define new
overloads.
(diff_context::mark_diff_as_traversed): Intern a diff node that is
marked as being traversed.
(diff_context::{categorizing_redundancy, show_redundant_changes}):
Define new methods.
(diff::is_filtered_out): A redundant function or top-level
variable is considered filtered-out.  Otherwise, the new
NOT_REDUNDANT_CATEGORY doesn't play any role when comparing
allowed categories with the set of categories a diff node belongs
to.
(corpus::priv::categorize_redundant_changed_sub_nodes): Define
new member function.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Change
this to first walk the changed functions and variables to apply
filters, then categorize redundant changed functions, and then
walk the changed functions and variables again to count
filtered-out diff nodes.
(filtering::redundant_filter::visit): Define new member function.
* tools/bidiff.cc (options::show_redundant_changes): New data
member.
(options::options): Initialize it.
(display_usage): Add help string for the --redundant command line
option.
(parse_command_line): Add support for the --redundant command line
option.
(set_diff_context_from_opts): Take the --redundant command line
option in account.
* tests/test-diff-filter.cc: Update this to add new test inputs.
* tests/data/test-diff-filter/test14-0-report.txt: New test input.
* tests/data/test-diff-filter/test14-1-report.txt: Likewise.
* tests/data/test-diff-filter/test14-v0.cc: Likewise.
* tests/data/test-diff-filter/test14-v0.o: Likewise.
* tests/data/test-diff-filter/test14-v1.cc: Likewise.
* tests/data/test-diff-filter/test14-v1.o: Likewise.
* tests/data/test-diff-filter/test15-0-report.txt: Likewise.
* tests/data/test-diff-filter/test15-1-report.txt: Likewise.
* tests/data/test-diff-filter/test15-v0.cc: Likewise.
* tests/data/test-diff-filter/test15-v0.o: Likewise.
* tests/data/test-diff-filter/test15-v1.cc: Likewise.
* tests/data/test-diff-filter/test15-v1.o: Likewise.
* tests/Makefile.am: Add the above to the build system.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoA name that couldn't be demangled remains the same
Dodji Seketeli [Mon, 23 Jun 2014 08:24:13 +0000 (10:24 +0200)]
A name that couldn't be demangled remains the same

* src/abg-ir.cc (demangle_cplus_mangled_name): When the demangler
fails to demangle a name, just return the input name as-is.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoUpdate copyright notice for a bunch of files
Dodji Seketeli [Mon, 23 Jun 2014 08:17:50 +0000 (10:17 +0200)]
Update copyright notice for a bunch of files

* include/abg-comp-filter.h: Update copyright notice.
* include/abg-comparison.h: Likewise.
* src/abg-comparison.cc: Likewise.
* src/abg-ir.cc: Likewise.
* tools/bidiff.cc: Likewise.
* tests/test-diff-filter.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoKeep symbol's multiple aliases within single attribute separated by comma
Sinny Kumari [Thu, 19 Jun 2014 06:43:54 +0000 (12:13 +0530)]
Keep symbol's multiple aliases within single attribute separated by comma

* src/abg-writer.cc (write_elf_symbol_aliases): Changing function
to keep multiple symbol aliases within one alias attribute
* src/abg-reader.cc (build_elf_symbol_db): Changing function to read
symbol's alias attribute and split if multiple alias exist with comma(,)
asi a delimiter and add all aliases to main symbol
* tests/data/test-read-dwarf/test3.c: Test file to generate multiple aliases
* tests/data/test-read-dwarf/test3.so: Test shared library having multiple
aliases of a symbol
* tests/data/test-read-dwarf/test3.so.abi: XML file containing dwarf
information from test3.so
* tests/test-read-dwarf.cc (in_out_specs): Add the new test above
* tests/Makefile.am: Add tests/data/test-read-dwarf/test3.c,
tests/data/test-read-dwarf/test3.so and tests/data/test-read-dwarf/test3.so.abi
to the distribution

Signed-off-by: Sinny Kumari <skumari@redhat.com>
10 years agoDW_TAG_mutable_type doesn't exist.
Mark Wielaard [Wed, 18 Jun 2014 09:43:50 +0000 (11:43 +0200)]
DW_TAG_mutable_type doesn't exist.

DW_TAG_mutable_type was a mistake in an early DWARFv3 draft and was removed
in the final version. http://dwarfstd.org/ShowIssue.php?issue=050223.1

* src/abg-dwarf-reader.cc (is_type_tag): Remove DW_TAG_mutable_type.
(build_ir_node_from_die): Likewise.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
10 years agoLook at first parm type and artificial-ness to detect static-ness
Dodji Seketeli [Thu, 5 Jun 2014 13:13:32 +0000 (15:13 +0200)]
Look at first parm type and artificial-ness to detect static-ness

* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): To
tell if a member function is static, look if the first parm is a
pointer to the type of the enclosing class, and if it's
artificial.  Don't bother trying to be smart by looking at the
non-presence of DW_AT_object_pointer b/c that attribute wasn't
emitted by GCC 4_4.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoHarden debug info path management & better error reporting
Dodji Seketeli [Wed, 4 Jun 2014 14:30:18 +0000 (16:30 +0200)]
Harden debug info path management & better error reporting

* include/abg-dwarf-reader.h (enum status): New enum.
(read_corpus_from_elf): Return an instance of status above, and
return the corpus by parameter.
* src/abg-dwarf-reader.cc (create_default_dwfl): Add a comment
about elfutils wanting the Dwfl_Callbacks::debuginfo_path to be an
absolute path.
(read_corpus_from_elf): Return an instance of status above, and
return the corpus by parameter.
* tools/abg-tools-utils.h (make_path_absolute): Declare new function.
* tools/abg-tools-utils.cc (make_path_absolute): New
implementation.
* tools/bidiff.cc (options::di_root_path[12]): Make these be
shared pointers.
(parse_command_line): ensure the debug info root paths are
absolute.
(main): Adjust.  Give meaningful errors when the debug info or
symbol files couldn't be read.
* tools/bidw.cc (options::di_root_path): Make this be a shared
pointer.
(parse_command_line): Ensure the debug info root path is absolute.
(main): Adjust.  Give meaningful errors when the debug info or
symbol files couldn't be read.
* tools/bilint.cc (options::di_root_path): Make this be a shared
pointer.
(parse_command_line): Ensure the debug info root path is absolute.
(main): Adjust.  Give meaningful errors when the debug info or
symbol file couldn't be read.
* tests/test-diff-dwarf.cc (main): Adjust.
* tests/test-read-dwarf.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoDo not choke on AR archives
Dodji Seketeli [Mon, 2 Jun 2014 15:05:05 +0000 (17:05 +0200)]
Do not choke on AR archives

* tools/abg-tools-utils.h (file_type::FILE_TYPE_AR): New enumerator.
* tools/abg-tools-utils.cc (guess_file_type): Recognize AR archive
files.
* tools/bidiff.cc (main): Support AR archives.
* tools/bidw.cc (main): Likewise.
* tools/bilint.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoHonor linkage name showing when displaying added/removed member functions
Dodji Seketeli [Fri, 30 May 2014 07:46:43 +0000 (09:46 +0200)]
Honor linkage name showing when displaying added/removed member functions

* src/abg-comparison.cc (represent): Take a diff_context.  If
instructed to show linkage names, show the linkage name of the
member function.
(class_diff::report): Adjust for the new signature of represent().

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoMake bidiff filter output and display symbol names by default
Dodji Seketeli [Fri, 30 May 2014 07:17:17 +0000 (09:17 +0200)]
Make bidiff filter output and display symbol names by default

* tools/bidiff.cc (options::options): Initialize
options::show_linkage_names to true and
options::show_harmful_changes to false.
(parse_command_line): Change --linkage-names into
--no-linkage-names as the linkage names are now displayed by
default.  Change --no-harmless into --harmless as harmless changes
are now filtered by default.
(display_usage): Update help string for the --linkage-names ->
--no-linkage-names and --no-harmful -> --harmful change.
* tests/test-diff-filter.cc: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoEnsure added/removed member functions have their symbols added/removed
Dodji Seketeli [Thu, 29 May 2014 16:15:48 +0000 (18:15 +0200)]
Ensure added/removed member functions have their symbols added/removed

* include/abg-comparison.h (diff_context::{set_corpora,
get_first_corpus, get_second_corpus}): Declare new member
functions.
* src/abg-comparison.cc (diff_context::{set_corpora,
get_first_corpus, get_second_corpus}): Define them.
(compute_diff): In the overload for corpus_sptr stick the corpora
being compared, into the diff context.
(class_diff::ensure_lookup_tables_populated): If a member function
is allegedly removed, check that its underlying symbol is removed
from the corpus as well.  Otherwise, consider that the member
function hasn't been removed.  Likewise, if a member function is
allegedly added, check that its underlying symbol has been added
to the corpus as well.  Otherwise, consider that the member
function hasn't been added.  The symbols can now be accessed
through the two corpora that are now present in the diff context.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoFix scope for DIEs with specification or abstract_origin attributes
Dodji Seketeli [Thu, 29 May 2014 16:02:37 +0000 (18:02 +0200)]
Fix scope for DIEs with specification or abstract_origin attributes

* src/abg-dwarf-reader.cc (get_scope_for_die): If the DIE has a
DW_AT_specification or DW_AT_abstract_origin attribute, get the
scope of the referred-to DIE.
(build_ir_node_from_die): For a variable DIE that has a
DW_AT_{specification,abstract_origin} attribute, do not add the
built variable IR node to its scope because it is already in a
scope.  It's in a scope because that built variable is for the DIE
that is referred-to by the DW_AT_{specification,abstract_origin}
attribute.  Likewise for member functions.  Also, now,
get_scope_for_die can return a class for a function DIE because
get_scope_for_die now returns the *logical* scope of the DIE; that
is, it follows DW_AT_{specification,abstract_origin} attributes.
* tests/data/test-read-dwarf/test1.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoAdd a symbol database to the ABI Corpus & support symbol aliases
Dodji Seketeli [Wed, 28 May 2014 14:33:35 +0000 (16:33 +0200)]
Add a symbol database to the ABI Corpus & support symbol aliases

* include/abg-corpus.h (corpus::{g,s}et_{fun,var}_symbol_map{_sptr}):
Declare new accessors.
(corpus::lookup_{variable,function}_symbol): Declare new member
functions.
* src/abg-corpus.cc (corpus::{g,s}et_{fun,var}_symbol_map{_sptr}):
Define new accessors.
(corpus::lookup_{variable,function}_symbol): Define new member
functions.
* include/abg-ir.h (string_elf_symbol_sptr_map_type)
(string_elf_symbol_sptr_map_sptr, elf_symbols)
(string_elf_symbols_map_type, string_elf_symbols_map_sptr): New
convenience typedefs.
(elf_symbol::{get_main_symbol, is_main_symbol, get_next_alias,
has_aliases, add_alias, get_id_string,
get_name_and_version_from_id, operator=}): Declare new member
functions.
* src/abg-ir.cc (elf_symbol::{get_main_symbol, is_main_symbol,
get_next_alias, has_aliases, add_alias, get_id_string,
get_name_and_version_from_id, operator=}): Define new member
functions.
* include/abg-reader.h (read_corpus_from_file): Take a shared
pointer to corpus.
* src/abg-reader.cc (read_context::{g,s}et_corpus): Define these.
(build_elf_symbol_db, build_elf_symbol_from_reference)
(read_symbol_db_from_input): Define new functions.
(read_corpus_from_input): Adjust.  Make it read symbol databases.
(build_elf_symbol): Harden this.
(build_{var,function}_decl): Read the symbol reference.  Do not
read the local symbol serialization anymore.
(read_corpus_from_archive): Adjust.
(read_corpus_from_file): Take a reference to a shared pointer to
corpus, rather than a reference to the corpus.
(read_corpus_from_native_xml): Only keep the overload that returns
a corpus.  Set the current context with the corpus.
* src/abg-dwarf-reader.cc (addr_elf_symbol_sptr_map_type)
(addr_elf_symbol_sptr_map_sptr): New convenience typedefs.
(read_context::{fun_sym_addr_sym_index_map_,
var_sym_addr_sym_index_map_): Remove.
(read_context::{fun,var}_addr_sym_map_): New.  Replace the above
that got removed.
(read_context::{var,fun}_syms_): New.
(read_context::lookup_elf_{fn,var}_symbol_from_address): Adjust.
(read_context::{fun,var}_addr_sym_map{_sptr}): New.
(read_context::{fun,var}_syms{_sptr}): New.
(read_context::load_symbol_maps): Replace
read_context::load_symbol_addr_to_index_maps.  Adjust to load all
the new maps.
(read_context::maybe_load_symbol_maps): New.
(read_debug_info_into_corpus): Renamed build_corpus into this.
Update to load symbol maps and set it to the corpus.
* src/abg-writer.cc (write_context::get_fun_symbol_map): New
accessor.
(write_elf_symbol_aliases, write_elf_symbol_reference)
(write_elf_symbols_table): Define new static functions.
(write_var_decl): Write the reference to the underlying symbol of
the variable.  Do not write the full symbol here anymore.
(write_function_decl):  Likewise, write the reference to the
underlying symbol of the function.  Do not write the full symbol
here anymore.
(write_corpus_to_native_xml): Write the symbol databases at the
beginning of the corpus document.
* src/abg-comparison.cc
(corpus_diff::priv::ensure_lookup_tables_populated): Now that the
corpus has symbols, check if a the symbol of an allegedly deleted
function (resp. variable) is deleted; if not, then do not report
the function (resp. variable) as deleted.  Similarly, check if the
symbol of an allegedly added function (resp. variable) is added.
if not, the do not report the function (resp. variable) as added.
* tests/test-write-read-archive.cc (main): Adjust.
* tools/biar.cc (extract_tus_from_archive): Likewise.
* tests/data/test-diff-filter/test9-report.txt: Adjust.
* tests/data/test-read-dwarf/test0.abi: Likewise.
* tests/data/test-read-dwarf/test1.abi: Likewise.
* tests/data/test-read-dwarf/test2.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoRename 'symbol' in fn names to 'public decl' in abg-corpus.{cc,h}
Dodji Seketeli [Wed, 21 May 2014 12:29:18 +0000 (14:29 +0200)]
Rename 'symbol' in fn names to 'public decl' in abg-corpus.{cc,h}

* src/abg-corpus.cc (lots of places): Rename references to
'symbol' in function & variable names to 'public_decl'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoSupport debug info files being outside the expected system directories
Dodji Seketeli [Thu, 22 May 2014 11:14:44 +0000 (13:14 +0200)]
Support debug info files being outside the expected system directories

* include/abg-dwarf-reader.h (read_corpus_from_elf): Take a
debug_info_root_path parameter.
src/abg-dwarf-reader.cc (create_default_dwfl): Take a
debug_info_root_path.  Use that to initialize the Dwfl_Callbacks
structure used by dwfl_begin.
(create_default_dwfl_sptr, read_corpus_from_elf): Likewise, Take a
debug_info_root_path parameter.
* tests/test-diff-dwarf.cc (main): Adjust.
* tests/test-read-dwarf.cc (main): Likewise.
* tools/bidiff.cc (options::dir_root_path[12]): New member.
(options::options): Initialize it.
(display_usage): Add help string for the --debug-info-dir[12]
options.
(parse_command_line): Handle the new --debug-info-dir[12] options.
(main): Pass the debug info directories to read_corpus_from_elf.
* bidw.cc (options::::di_root_path): New member.
(options::options): Initialize it.
(display_usage): Add help string for the new --debug-info-dir
option.
(parse_command_line): Handle the new --debug-info-dir.
(main): Pass the debug info root path to read_corpus_from_elf.
* tools/bilint.cc (options::di_root_path): New member.
(options::options): Initialize it.
(display_usage): Add help string for the new --debug-info-dir.
(parse_command_line): Handle --debug-info-dir command line option.
(main): Pass the debug info root path to read_corpus_from_elf.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoFix detection of destructors
Dodji Seketeli [Wed, 21 May 2014 10:38:42 +0000 (12:38 +0200)]
Fix detection of destructors

* src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): Simply
detect that the destructor starts with a '~'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoAdd clone in the scope of the cloned decl they logically belong to
Dodji Seketeli [Wed, 21 May 2014 09:55:21 +0000 (11:55 +0200)]
Add clone in the scope of the cloned decl they logically belong to

* src/abg-dwarf-reader.cc (build_ir_node_from_die): Do not try to
add the cloned function/variable to the current scope because
cloning should have added the decl into the scope of the cloned
target.
* src/abg-ir.cc ({var,function}_decl::clone): Insert the clone
decl into the scope of the cloned decl.  My understanding is that
it's where they belong.
* tests/data/test-read-dwarf/test1.abi: Update this to incorporate
all the abstract constructors/destructors *and* their clones into
the classes where they belong.
* tests/data/test-read-dwarf/test1.abi: Adjust for the abstract
cdtor being added to the class, as well as their cloned concrete
instances.
* tests/data/test-read-dwarf/test2.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoSupport decl cloning when seeing DW_AT_abstract_origin
Dodji Seketeli [Tue, 20 May 2014 16:22:14 +0000 (18:22 +0200)]
Support decl cloning when seeing DW_AT_abstract_origin

* include/abg-ir.h ({var,function}_decl::clone): New method.
* src/abg-dwarf-reader.cc (die_die_attribute): Add a flag to avoid
looking through DW_AT_abstract_origin attribute here.
(build_function_decl): Set the linkage name from
DW_AT_linkage_name if it's not set yet.
(build_ir_node_from_die): For DW_TAG_{variable,subprogram}, when
we see DW_AT_abstract_origin, clone the decl they refer to.
Also, avoid dropping the DIE on the floor just because it doesn't
have die_is_artificial here.
* src/abg-ir.cc ({var,function}_decl::clone): Implement this.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoDon't share types across TUs when DW_TAG_partial_unit are involved
Dodji Seketeli [Mon, 19 May 2014 19:35:56 +0000 (21:35 +0200)]
Don't share types across TUs when DW_TAG_partial_unit are involved

* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
Clear the part of the context that needs to be per TU.
(build_ir_node_from_die): Assert that this should not be called
for partial and imported unit because for now our practical
assumption is that DIEs under partial unit are lazily read only
when referenced by DIEs that are under DW_TAG_compile_unit.
* tests/Makefile.am: Add the new test files to the build system.
* tests/data/test-read-dwarf/test2.so.abi: Fix the reference
output here to avoid sharing types across TUs, making the output
valid for bilint.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoInitial support for DW_TAG_partial_unit
Dodji Seketeli [Mon, 19 May 2014 15:26:40 +0000 (17:26 +0200)]
Initial support for DW_TAG_partial_unit

* src/abg-dwarf-reader.cc (read_context::cur_tu_die_): New member.
(read_context::read_context): Initialize the new member.
(read_context::cur_tu_die): New accessors.
(find_last_import_unit_point_before_die): New static function.
(get_parent_die): Take a logical current die offset parameter.  If
the die we want the parent for is a partial unit, then find the
last DW_TAG_imported_unit that imports that partial unit before
the logical current die and return the parent of that
DW_TAG_imported_unit die.
(get_scope_for_die): Take a logical current die offset parameter.
Adjust.
(build_translation_unit_and_add_to_ir): Set/unset the current
translation unit DIE in the context.  Adjust.
(build_namespace_decl_and_add_to_ir)
(build_class_type_and_add_to_ir, build_qualified_type)
(build_pointer_type_def, build_reference_type, build_typedef_type)
(build_var_decl, build_function_decl, build_ir_node_from_die):
Take a logical current die offset parameter.  Adjust.
(build_corpus): Accept that we can have DIE that are not
DW_TAG_compile_unit at the top level, because, well, we can now
have DW_TAG_partial_unit too.
* tests/data/test-read-dwarf/test2-{0,1}.cc: New test source
files.
* tests/data/test-read-dwarf/test2.h: Likewise.
* tests/data/test-read-dwarf/test2.so: New input binary to read.
* tests/data/test-read-dwarf/test2.so.abi: New reference test to
compare against.
* tests/test-read-dwarf.cc: Adjust to launch the new test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
10 years agoRe-build a test input file with debug info
Dodji Seketeli [Wed, 14 May 2014 09:32:06 +0000 (11:32 +0200)]
Re-build a test input file with debug info

* tests/data/test-lookup-syms/test1.so: Rebuild this with debug
info.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This page took 0.091368 seconds and 5 git commands to generate.