When a binary cannot be analyzed by abipkgdiff, silently skip it
unless --verbose is used, in which case, display a message saying
that it couldn't be analyzed.
* tools/abipkgdiff.cc (compare): In the elf_file overload, do not
emit an error message when a binary could not be analyzed unless
--verbose was provided.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/abipkgdiff.cc (compare): In the overload for packages,
indent the content of the "Removed binaries" and "Added binaries"
paragraphs.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Just like what abidiff does, this patch avoids emitting redundant diff
report messages unless the user provides the --redundant switch.
* tools/abipkgdiff.cc (options::show_redundant_changes): New data
member.
(options::options): Initialize it.
(display_usage): Add a help string for the --redundant command
Line option.
(set_diff_context_from_opts): New static function.
(compare): Take the options variable. Set the diff context from
the options, especially if we should show redundant changes or
not. Use that diff context when comparing ABIs.
(parse_command_line): Parse the new --redundant command line
switch.
* doc/manuals/abipkgdiff.rst: Document the new --redundant option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turned out on some packages we are interested on comparing shared
libraries only. This patch adds that functionality by adding a new
--dso-only command line option to abipkgdiff.
* tools/abipkgdiff.cc (options::compare_dso_only): New data
member.
(options::options): Initialize it.
(display_usage): Display a little help string for it.
(create_maps_of_package_content): Take the option variable. Do
not compare non-dso files if the --dso-only option was provided.
(extract_package_and_map_its_content, prepare_packages, compare):
Take the option variable.
(parse_command_line): Parse the new --dso-only option.
* doc/manuals/abipkgdiff.rst: Add documentation for the new
--dso-only option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (get_soname_of_elf_file): Better wording
of the apidoc of this function.
* tools/abipkgdiff.cc (verbose, elf_file_paths): Add apidoc for
these global variables.
(struct options, ): Add apidoc for these types.
(options::{erase_extraction_directory,
erase_extraction_directories}, display_usage, extract_rpm)
(erase_created_temporary_directories, extract_package)
(file_tree_walker_callback_fn, compare)
(create_maps_of_package_content)
(extract_package_and_map_its_content, prepare_packages, compare)
(parse_command_line): Add apidoc for these functions.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Add tests for the abipkgdiff tool. The tests runs abipkgdiff on RPM
packages. RPMs for test data are taken from Fedora koji build with
build id - 106158 and 648058
* tests/Makefile.am: Build new runtestdiffpkg regression test
* tests/data/Makefile.am: Add new test files to source
* tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm:
Test data for abipkgdiff tool
* tests/data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm: Likewise
* tests/data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm:
Likewise
* tests/data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm:
Likewise
* tests/data/test-diff-pkg/test-rpm-report-0.txt: Expected test output
* tests/data/test-diff-pkg/test-rpm-report-1.txt: Likewise
* tests/data/test-diff-pkg/test-rpm-report-2.txt: Likewise
* tests/data/test-diff-pkg/test-rpm-report-3.txt: Likewise
* tests/data/test-diff-pkg/test-rpm-report-4.txt: Likewise
* tests/test-diff-pkg.cc: New file
Signed-off-by: Sinny Kumari <sinny@redhat.com>
* doc/manuals/abipkgdiff.rst: New manual file.
* doc/manuals/libabigail-tools.rst: Refer to the manual for
abipkgdiff.
* doc/manuals/Makefile.am: Add the new manual file to source
distribution.
* doc/manuals/conf.py: Add the manual for abipkgdiff to section 1.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-dwarf-reader.cc (get_soname_of_elf_file): Better wording
of the apidoc of this function.
* tools/abipkgdiff.cc (verbose, elf_file_paths): Add apidoc for
these global variables.
(struct options, ): Add apidoc for these types.
(options::{erase_extraction_directory,
erase_extraction_directories}, display_usage, extract_rpm)
(erase_created_temporary_directories, extract_package)
(file_tree_walker_callback_fn, compare)
(create_maps_of_package_content)
(extract_package_and_map_its_content, prepare_packages, compare)
(parse_command_line): Add apidoc for these functions.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* abipkgdiff.cc (get_soname_of_elf_file): Fix spacing.
* tools/abipkgdiff.cc (elf_file_paths): Make this global variable
static.
(extract_rpm): Rename parameter pkg_path name into package_path.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Directly using elfutils from abipkgdiff.cc feels like a taping into
the wrong abstraction layer from this level. So this patch moves the
determination of the type of elf file into abg-dwarf-reader.cc and
uses it from there. The patch also simplifies the instantiation of
types elf_file and package, from abipkgdiff.cc.
* abg-dwarf-reader.h (enum elf_type): Move this declaration here
from abipkgdiff.cc to here.
(get_type_of_elf_file): Declare this new function.
(get_soname_from_elf): Change this to take a path to the elf file
rather than a Elf* handler. So now to use this, the user doesn't
have to get her hand dirty with elfutils.
* src/abg-dwarf-reader.cc (get_soname_from_elf): Change this to
take a path to the elf file rather than a Elf* handler.
(elf_file_type): Move this static function here, from
abipkgdiff.cc.
(get_type_of_elf_file): New function. This has been factorized
out of create_maps_of_package_content() in abipkgdiff.cc.
* tools/abipkgdiff.cc (class elf_file): Changed struct elf_file
into this. Make the default constructor private.
(elf_file::elf_file): Change the constructor to just take the path
to the elf_file. The base name, soname and elf file type are now
computed from the path file, in the constructor. This makes
instantiation much much easier from the point of view of the user
of the type.
(struct abi_diff): Renamed struct abi_changes into this.
(abi_diff::has_changes): Define new member function.
(abi_diffs): Remove this global variable.
(package::package): Remove the elf file type from the set of
parameters of this constructor. Rather, compute that elf file
type from the path to the elf file, in the constructor. Again,
this eases the use of the type.
(elf_file_type): Remove this from here, as it got moved to
abg-dwarf-reader.cc.
(compare): In the elf_file overload, return true if the comparison
yields ABI changes.
(create_maps_of_package_content): Do not fiddle with elfutils
stuff here. Rather, just instantiate elf_file and the analyzing
of the file magically happens.
(compare): Make the package overload take an abi_diff as output
parameter, rather than populating a global variable in return.
(compare): Add an other overload for package that doesn't take the
abi_diff as output parameter and write it in terms of the previous
one.
(main): Adjust as the instantiation of package is now simpler.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turned out it's important to be able to see what abipkgdiff is
actually doing. This patch adds a --verbose option that emits many
useful information about the tool's progress.
* tools/abipkgdiff.cc (verbose): Add a new global variable.
(package::erase_extraction_directory, extract_rpm, compare)
(create_maps_of_package_content): Emit verbose information.
(parse_command_line): Parse the --verbose option.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Until now, abipkgdiff was spawning a process running the 'abidiff'
command line tool to perform ABI comparison on binaries. This helped
in sketching what was possible with this tool. However, it's
sub-optimal in a final setup so this patch uses the libabigail library
to perform that comparison.
* tools/abipkgdiff.cc (compare): In the overload for elf_file, use
abigail::comparison::compute_diff() to compare the ABI of two
corpora. The corpora themselves is read using
abigail::dwarf_reader::read_corpus_from_elf(). This cleans up the
output of the tool because nothing is emitted to standard output
if the two ABI corpora compares equal.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
A number of functions have string parameters passed by value. Ooops.
They must be passed by reference.
Fixed thus.
* tools/abipkgdiff.cc (elf_file::elf_file): Pass the strings by
reference. Also, change the order of the parameters; all the
strings are passed first, then the elf_type is passed last.
(package::package): Likewise, pass the strings by reference, not
by value.
(create_maps_of_package_content): Adjust for the change in
parameters order of elf_file::elf_file.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/abipkgdiff.cc (compare): In the overload for packages,
only compare binaries that are DSO or executable.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Initially, fetching SONAME from a given DSO file was done in
abipkgdiff.cc. But, this function fits better when defined in
abg-dwarf-reader.cc in order to make it usable by other tools if
needed. For consistancy, get_soname() function has been renamed to
get_soname_from_elf().
* include/abg-dwarf-reader.h (get_soname_from_elf): Declare
new function
* src/abg-dwarf-reader.cc (get_soname_from_elf): Define new
function
* tools/abipkgdiff.cc (get_soname): Remove function
(pkg_diff): Call get_soname_from_elf() instead of get_soname()
Signed-off-by: Sinny Kumari <sinny@redhat.com>
This patch introduces many changes that should hopefully improve
legibility and ease of maintenance. Here is a list of the topic of
the changes:
* Avoid using shortened names when the line is not too long.
* Use shared_ptr when possible.
* When a function parameter is not meant to be nil, do not pass it
as a pointer; rather, pass it as a reference.
* Avoid doing things that can "fail" in a destructor; e.g, spawning
a process. Also, it's not common practise to cleanup a resource in a
type destructor, when that resource has not been created in one of the
member functions of the type. It eases maintenance when resource
creation and cleanup is performed at the same logical level.
* tools/abipkgdiff.cc (option::package{1,2}): Rename
option::pkg{1,2} into this, to increase legibility.
(option::debug_package{1,2}): Likewise, rename
option::debug_pkg{1,2} into this.
(elf_file::~elf_file): Do not "delete this" in a destructor. This
leads to double free. It's when someone invokes the "delete"
operator on a pointer to the object that the destructor of the
object is executed automatically; so if in the destructor the
delete operator is called again, bad things are going to happen.
As the destructor is now empty, remove it altogether.
(elf_file_sptr): New typedef for shared_ptr<elf_file>.
(package::path): Rename package::pkg_path into this, for better
legibility.
(package::extracted_package_dir_path): Rename
package::extracted_pkg_dir_path into this.
(package::type): Rename package::pkg_type into this.
(package::is_debug_info): Rename package::is_debuginfo_pkg into
this.
(package::path_elf_file_sptr_map): Rename
package::dir_elf_files_map into this because this is a map of
path -> elf_file_sptr. Also, now the value of the map element is
a elf_file_sptr, no more an elf_file*.
(package::debug_info_package): Rename package::debuginfo_pkg into
this.
(package::package): Adjust for the changes above.
(package::{erase_extraction_directory,
erase_extraction_directories}): New member functions.
(elf_file_paths): Renamed dir_elf_files_path into this.
(erase_created_temporary_directories)
(create_maps_of_package_content)
(extract_package_and_map_its_content, prepare_packages): New
static functions.
(get_soname, elf_file_type, extract_rpm): Make this static.
(extract_package): Take a const package& rather than a
package_sptr to express that the function really expects a non-nil
object by reference (not by copy) and that the object won't be
modified. Using a reference removes the possibility that the
pointer could be nil, causing crashes in the code where
parameter->something was used. Now only parameter.something can
be used, so no crash possible there. This is more solid code.
(file_tree_walker_callback_fn): Rename callback() into this. It
makes the code more legible and kind of 'self-documented'. At
least you get the hint that this is a callback function for some
file tree walking (ftw) function. Adjust for the relevant names
renaming above.
(compare): Rename compute_abidiff into this; again, this increases
legibility; at least at the point of use of this function. Rename
compare_package() into a an overload of compare() as well.
compare_package() used to take a vector of packages. It was hard
to guess by reading the signature of the function, which element
of the vector is expected to be the first vector of the
comparison, which one is to be the second, etc. Now, this
function takes two packages, named first_package and
second_package. That is more "typed"; that is, the signature is
more meaningful. Greater legibility, hopefully. And in the body
of the function, the debug information packages are now accessed
using the package::debug_info_package data member. Again, this is
less surprising, I believe. Also, explicitly erase the temporary
files that were created during this comparison. All this
simplifies the logic of this function, hopefully.
(parse_command_line): Make this static. Add new --d1 and --d2
command line switches that are shortcuts of --debug-info-pkg1 and
--debug-info-pkg2. Adjust this function for the relevant name
changes above. Make lines be shorter than 80 characters.
(main): Do not create any vector of parameters anymore as the
compare_packages() function don't take any vector of parameter
anymore. Just instantiate first_package and second_package now.
Adjust for the relevant name changes above. This hopefully
simplifies the logic of this function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Through the libabigail project, we try to:
1/ make function names start with a verb
2/ avoid shortening function names, *unless* longer names make the
current line exceed 80 characters per line.
We believe these rules improve legibility for people reading the code.
This patch slightly changes abipkgdiff.cc file to comply with the
above.
* tools/abipkgdiff.cc (extract_package): Renamed extract_pkg into
this because shortening 'package' into 'pkg' provides no
legibility improvement.
(compare_packages): Renamed pkg_diff() into this, so that the name
of the function starts with a verb, and the shortened 'pkg' word
is renamed back to the 'package' word. This way, the code almost
reads like normal English sentences with verbs and complement,
thus enhancing legibility and easing latter maintenance.
(main): Adjust for the changes above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While reading the source code, I realized parts of it where not yet
following the GNU-style indentation of the rest of the project files.
So I thought I'd do this early now, so that other changes happen on
top of the properly indented file.
Fixed thus.
* tools/abipkgdiff.cc: Re-indent the file properly and fix some
white spacing here and there.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/abipkgdiff.cc (display_usage): Fixed the typo in
'bi-pacakge.' Also, refer to 'package', not to 'bi-package' that
is surprising to the user at first.
(compute_abidiff): Shorten the size of the introductory line.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The compiler complains that in function callback(), parameters st and
flag are unused. In that case, C++ allows the name of the parameter
to be omitted; that makes the compiler complaint go away.
* tools/abipkgdiff.cc (callback): Remove the name of parameters st
and flag.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In this declaration:
const bool
extract_rpm(const string& pkg_path, const string &extracted_pkg_dir_path)
the compiler rightfully complains that the const qualifier on the
return type is useless. This is because the value is returned by copy
so the const-ness is not relevant.
Fixed thus.
* tools/abipkgdiff.cc (extract_rpm): Remove useless const qualifier.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The compiler complains that there are some branches in the
get_soname() function that don't end up with a return statement. For
instance, there is no return statement right before the end of the
function, in case the outermost for loop is not taken.
This patch fixes that by having just one return statement at the end
of the function.
* tools/abipkgdiff.cc (get_soname): Have just one return statement
at the end of this function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The compiler rightfully complains that data members should be
initialized in the other in which they are declared.
Fixed thus.
* tools/abipkgdiff.cc (elf_file::elf_file): Initialize data member
in the same order as they were declared.
(package::package): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Removed binaries can also lead to ABI breakage if an applicating was using
it previously. So, display it in ABI change report. Also, looking for
ABI change in symbolic link files doesn't make sense. Now, we are not
looking into ABI changes in symlink binaries.
* tools/abipkgdiff.cc (abi_changes): Declare new struct
(callback): Exclude symbloic link file for durther processing
(compute_abidiff): Consider SONAME if exists as key in map instead
of binary name, else binary as key. Also, print if removed/added
binaries exist between packages
Now, abipkgdiff can take two rpm packages and optional corresponding
debug-info pacakges. It look for same binary in both rpm directory and
if found calls abdiff along with debug-info options to get ABI changes
between them.
* tools/abipkgdiff.cc (compute_abidiff): New function
tools/abipkgdiff.cc (pkg_diff): Iterate through list of binaries
in both package directory and call compute_diff function if
same binary found in both file.
tools/abipkgdiff.cc (main): Also consider debug-info directories
avilable in debu-info packages.
Signed-off-by: Sinny Kumari <sinny@redhat.com>
An RPM package may conatins binaries, source/header files, config files,
etc. For abi check we are interested only in ELF binary files. This commit
stores binary files from extracted RPM in a map whose key is
binary file basename and value is struct elf_file with memeber variable
name, path, soname, type
* tools/abipkgdiff.cc (elf_type): Declare new enum
(elf_file): Declare new struct
(package): Add member variable dir_elf_files_map
(get_soname): Define new function
(elf_file_type): Define new function
(extract_rpm): Iterate over extracted directory files
and filter ELF binary files along with their information
like name, soname, elf_type and save in dir_elf_files_map
Input pacakges need to extracted for further processing which includes
fecthing all files in extracted rpms and look for ELF files aginst
which abi diff is required. Pacakges will be extracted in system tmp
directory.
* tools/abipkgdiff.cc (struct package): Declare new struct
(package_sptr): Declare shared_ptr for struct package
(extract_rpm): Define new fuction to extract rpm package
(extract_pkg): Define new function to extract pacakge
(pkg_diff): Define new function to get ABI diff between
two packages
(main): Create new object of type pacakge for each binary
and debuginfo pacakge passed in commandline options
Signed-off-by: Sinny Kumari <sinny@redhat.com>
To run abipkgdiff between two pacakges, it should know whether
input files are valid pacakge file or not. This patch detects RPM and SRPM
pacakge file type. abipkgdiff uses it to know whether input files are
valid RPM pacakge file or not.
* include/abg-tools-utils.h (file_type): Added member
FILE_TYPE_RPM and FILE_TYPE_SRPM
(operator<<): New function declaration.
* src/abg-tools-utils.cc (file_type): Detect RPM and
SRPM file type
(operator<<): New function definition
* tools/abidiff.cc (main): Check for RPM and SRPM
file type as well.
* tools/abilint.cci (main): Check for RPM and SRPM file
type as well.
* tools/abipkgdiff.cc (main): Check whether input files
to abipkgdiff are valid RPM files or not.
Signed-off-by: Sinny Kumari <sinny@redhat.com>
Motive of abipkgdiff tool is to provide abi changes between two
pacakges. Packages can be .rpm, .deb or archives. It also takes
optional debug-info package to support pacakges shipping separate
debug-info.
This commit set-up initial skeleton of abipkgdif tool consisting of
help and usage otions. It ensures pkgdiff tool compiles and run when
libabigail gets compiled as whole. Initially, we will add support for
ABI changes for two rpm packages. Further, support for other pacakging
format can be added.
* tools/Makefile.am: Include abipkgdiff.cc in compilation and
generate abipkgdiff binary.
* tools/abipkgdiff.cc: New file
Signed-off-by: Sinny Kumari <sinny@redhat.com>
* src/abg-dwarf-reader.cc
(read_context::find_symbol_table_section): Allow returning a nil
pointer to symbol table.
(read_context::lookup_elf_symbol_from_index): Return an empty elf
symbol if we got a nil pointer to symbol table.
(read_context::load_symbol_maps): If no symbol table is found then
consider that the symbol maps loading failed.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-comparison.cc (class_diff::report): Do not emit new line
unless the diff is to be reported.
* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Adjust.
* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt: Adjust.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt:
: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turned out we need to read all XML ABI files that were still
emitting empty types (nothing) to represent void types, e.g, for
function returning void. So the type comparison code needs to accept
nil types again.
* src/abg-comparison.cc (compute_diff): In the overload of
type_base_sptr accept nil types.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
While working on something else, it turned out that we need to cleanup
(de-allocate) the map of canonical types when all the translation
units that own types are de-allocated. Otherwise, when new
translation units are created later, the types in the canonical types
map become unrelated to the types in these new translation units,
leading to memory management issues.
This patch introduces a "usage watchdog" which detects when no
translation unit uses the type system anymore. That usage watchdog is
then used in the destructor of the translation_unit type to
de-allocate the global data that is logically owned by by the type
system.
The patch also changes the API to read translation units and corpora
in a way that forces users to get a handle on the resulting shared
pointer.
* include/abg-ir.h (type_base::canonical_types_map_type): Move
this typedef into abg-ir.cc and out of the type_base namespace.
(type_base::get_canonical_types_map): Likewise.
* src/abg-ir.cc (canonical_types_map_type): New typedef that got
moved here from type_base::canonical_types_map_type.
(get_canonical_types_map): Likewise got moved here from
type_base::get_canonical_types_map. Made static in the process.
(class usage_watchdog): New type.
(usage_watchdog_sptr, usage_watchdog_wptr): New typedefs.
(get_usage_watchdog, get_usage_watchdog_wptr, ref_usage_watchdog)
(maybe_cleanup_type_system_data): New static functions.
(translation_unit::priv::usage_watchdog_): Add new data member.
(translation_unit::priv::priv): Get a reference on the usage
watchdog.
(translation_unit::priv::~priv): If the usage watchdog says that
the type system is not used, then cleanup the global data
logically owned by the type system.
* include/abg-dwarf-reader.h (read_corpus_from_elf): Make this
return a corpus and set the status by reference using a parameter.
* src/abg-dwarf-reader.cc (read_corpus_from_elf): Implement the
above.
* include/abg-reader.h (read_translation_unit_from_file)
(read_translation_unit_from_buffer)
(read_translation_unit_from_istream): Remove the overloads that do
not return a translation_unit_sptr and that pass it as a
parameter. Only keep the overloads that return a
translation_unit_sptr, forcing users of the API to own a proper
reference on the resulting translation_unit pointer. That is
important to handle the life time of the global data of the type
system that need to be cleared when the last translation unit is
de-allocated.
* src/abg-reader.cc (read_translation_unit_from_input): Make this
return a translation_unit_sptr.
(read_translation_unit_from_file)
(read_translation_unit_from_buffer)
(read_translation_unit_from_istream): Remove the overloads that do
not return a translation_unit_sptr and that pass it as a
parameter. Only keep the overloads that return a
translation_unit_sptr.
(read_to_translation_unit): Make this return a
translation_unit_sptr.
* tests/print-diff-tree.cc (main): Adjust.
* tests/test-diff-dwarf.cc (main): Likewise.
* tests/test-ir-walker.cc (main): Likewise.
* tests/test-read-dwarf.cc (main): Likewise.
* tests/test-read-write.cc (main): Likewise.
* tools/abicompat.cc (main): Likewise.
* tools/abidiff.cc (main): Likewise.
* tools/abidw.cc (main): Likewise.
* tools/abilint.cc (main): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It turned out typing --debug-info-dir{1,2} is a tad cumbersome. So this
patch adds --d1 and --d2 shortcut for these options.
* tools/abidiff.cc (display_usage): Add the --d{1,2} to the help
strings.
(parse_command_line): Parse the new --d1 and --d2 options.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In abg-comparison.h, there is no function to test if a given
corpus_diff carries incompatible or subtype (after having applied
suppression specifications) ABI changes. So this patch factorizes the
code of abidiff.cc to provide these features to corpus_diff.
* include/abg-comparison.h (corpus_diff::{has_incompatible_changes,
has_net_subtype_changes}): Declare new member functions.
* src/abg-comparison.cc (corpus_diff::{has_incompatible_changes,
has_net_subtype_changes}): Define them.
* abidiff.cc (main): Use the new member functions above.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
It appears there are some missing new lines in the diff report.
Fixed thus.
* src/abg-comparison.cc (class_diff::report): The overload of
represent() for instances of var_decl does not emit new lines. So
the caller must ensure a new line is emitted.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Suppose a function private_foo() has a symbol private_foo and also a
another one (an alias) named public_foo. Then suppose we want to
filter out sub-type changes to private_foo(). But then we still want
to see changes to public_foo.
This patch does add this feature. The [suppress_function] directive
now has a new (hidden) boolean 'allow_other_aliases' property. When
set to 'yes' or 'true', if the function being looked at has an alias
symbol that does *NOT* match the other properties of the directive,
then the directive doesn't suppress reports for the function. This
new property is set to yes by default.
This means that when a function has got multiple aliases, to suppress
the function, one needs to write a regular expression that matches the
names of aliases. Otherwise the function will not be suppressed.
* include/abg-comparison.h (function_suppression::{get,
set}_allow_other_aliases): Declare new member functions.
* src/abg-comparison.cc
(function_suppression::priv::allow_other_aliases_): New data
member.
(function_suppression::priv::priv): Initialize it to 'true'.
(function_suppression::{get, set}_allow_other_aliases): Define new
member functions.
(read_function_suppression): Parse the new "allow_other_aliases"
property.
(function_suppression::suppresses_function): Update to evaluate
the new 'allow_other_aliases' property when there is a property to
match against some a symbol name of the function.
(corpus_diff::report): Fix the printing of function aliases when
printing sub-type changes to properly emit the plural of the word
'symbol' when the function has several aliases.
* include/abg-ir.h (elf_symbol::get_number_of_aliases): Declare
new member function.
* src/abg-ir.cc (elf_symbol::get_number_of_aliases): Define new
member function.
* doc/manuals/libabigail-concepts.rst: Update manual.
* tests/data/test-diff-dwarf/test5-report.txt: Adjust.
* tests/data/test-diff-suppr/libtest23-alias-filter-v0.so: New
test input.
* tests/data/test-diff-suppr/libtest23-alias-filter-v1.so: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-0.suppr: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-1.suppr: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-2.suppr: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-3.suppr: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-4.suppr: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-v0.c: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-v1.c: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-version-script: Likewise.
* tests/data/Makefile.am: Add the new test stuff to source
distribution.
* tests/test-diff-suppr.cc (in_out_spec): Add the tests inputs
above to the list of input to run over.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Finish the
incomplete apidoc for this member function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The report emitted by abidiff now tells the user about the aliases of
the current function, when that function has some sub-type changes.
* include/abg-ir.h (elf_symbol::get_aliases_id_string): Declare
new overload.
* src/abg-ir.cc (elf_symbol::get_aliases_id_string): Define new
overload.
* src/abg-comparison.cc (corpus_diff::report): For functions with
sub-type changes report their aliases. Do not do this if the
function is a constructor or destructor because these almost
always have aliases, at least with GCC and the developer most
certainly has not done anything special for that; she would thus
be uselessly surprised by that remote implementation detail.
* tests/data/test-diff-dwarf/test5-report.txt: Adjust test.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The comparison code was too eager in comparing class types because it
was comparing static data members in the process. This was causing
some spurious false positives about functions or variables sub-type
changes. This patch fixes that by not comparing static data members
when comparing class types.
* include/abg-ir.h (class_decl::get_non_static_data_members):
Declare new data members.
* src/abg-comparison.cc
(class_diff::ensure_lookup_tables_populated): Only look at
non-static data members.
(compute_diff): In the overload for class_decl, only compare
non-static data members.
* src/abg-hash.cc (class_decl:#️⃣:operator()): Do not hash
static data members members hashing a class_decl.
* src/abg-ir.cc (class_decl::priv::data_members_): New data
member.
(class_decl::priv::priv): When initializing data members, store
the non-static data members on the side, in the new
class_decl::priv::non_static_data_members_ data member.
(class_decl::get_non_static_data_members): Define member function.
(class_decl::add_data_member): Store the non-static data members
on the side in class_decl::priv::non_static_data_members_.
(equals): In the overload for class_decl, do not take in account
static data members when running the comparison.
* tests/data/test-diff-dwarf/test7-report.txt: Adjust.
* tests/data/test-diff-filter/test12-report.txt: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
* tools/abidiff.cc (display_usage): Add a help string for the new
--suppr option.
(parse_command_line): Support the --suppr option which is an alias
for --suppressions.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Mattias Klose reported that building libabigail in the Debian build
system raised an error because the libabigail binaries were built
without the Large File Support (LFS), as described by
https://lintian.debian.org/tags/binary-file-built-without-LFS-support.html.
This just calls the configure macro AC_SYS_LARGEFILE for that.
* configure.ac: Call the AC_SYS_LARGEFILE autoconf macro.
* config.h.in: Update.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Until now, the zip archive support was automatically built if the
libzip dependent library was installed on the system at configure
time. As we are planning to remove the zip support, let's first
disable the support by default, even if libzip is installed at
configure time.
* configure.ac: By default, unconditionally disable the
zip-archive support.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
I was clueless about the right sections for the man pages of the parts
of the libabigail. But then Matthias Klose of Debian and Ubuntu fame
rightfully suggested that the man pages of the binaries should be in
section 1 (user commands) and the man page of the library should be in
section 7 (Miscellaneous).
This patch does that.
* doc/manuals/Makefile.am(section1_manpages, section7_manpages):
Two new variables to contain the man page names per section.
(manpages): Set this variable to $section1_manpages and $section7_manpages.
(install-man-and-info-doc): In this rule, create the destination
directories for section 1 and 7 and copy the right man pages in
their right directory.
* doc/manuals/conf.py (man_pages): Generate the binary man pages
into section 1 and the libabigail man page into section 7.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>