Commit Graph

11 Commits

Author SHA1 Message Date
Dodji Seketeli
a5e879e339 test-annotate: Don't emit architecture data
When running runtestannotate on different architectures, some spurious
test failures can happen because the resulting abixml contains the
architecture of the original binary.  This can be a problem for tests
where the binary is compiled on the fly.  We don't yet have those, but
I was playing with some of these while debugging something else and
stumbled across that issue.

This patch thus removes mentions of the architecture of the binary,
just like what runtestreaddwarf does.

	* tests/test-annotate.cc (main): Add the --no-architecture option
	to abidw.
	* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi:
	Adjust.
	* tests/data/test-annotate/libtest23.so.abi: Likewise.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-annotate/test-anonymous-members-0.o.abi:
	Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test1.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
	* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test2.so.abi: Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-annotate/test3.so.abi: Likewise.
	* tests/data/test-annotate/test4.so.abi: Likewise.
	* tests/data/test-annotate/test5.o.abi: Likewise.
	* tests/data/test-annotate/test6.so.abi: Likewise.
	* tests/data/test-annotate/test7.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2022-09-20 08:58:09 +02:00
Dodji Seketeli
6de60eb70e Bug PR29443 - Global variables not emitted to abixml in some cases
When a global variable named V has the same name as member variable
that appears in an anonymous scope and if the the abixml writer emits
the member variable V first, it gets confused when comes the time to
emit the global V as it wrongly thinks it's been already emitted.

This is because when emitting the "internal" pretty representation of
the member variable, libabigail fails to consider printing a qualified
name.  So the two 'V' wrongly have names that can't be told apart.

For instance consider the testcase example:

struct A {
  struct {
    int xx; // #0
  };
};

The qualified name of xx, for internal purposes (to name things
internally for the purpose of book keeping) would be:
    'A::__anonymous_struct__::xx'.

Libabigail wrongly names it 'xx', hence the confusion with the global variable.

Fixed thus.

	* src/abg-ir.cc (var_decl::get_pretty_representation): Always use
	qualified name of vars in an anonymous scope for internal
	purposes.
	* tests/data/test-annotate/PR29443-missing-xx.o.annotated.abi: New
	reference test output.
	* tests/test-annotate.cc (in_out_specs): Add the above to the test
	harness.
	* tests/data/test-read-dwarf/PR29443-missing-xx.cc: New source
	code for the test.
	* tests/data/test-read-dwarf/PR29443-missing-xx.o: New test input
	binary.
	* tests/data/test-read-dwarf/PR29443-missing-xx.o.abi: New test
	reference output.
	* tests/data/Makefile.am: Add the new test material to source
	distribution.
	* tests/test-read-dwarf.cc (in_out_specs): Add the above to the
	test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2022-09-20 08:55:59 +02:00
Giuliano Procida
431998a892 test-annotate.cc: ignore whitespace during diff
The LLVM C++ demangler is being updated to remove the extra space
delimiter added between consecutive template closings. This change
ensures tests pass with both old and new versions.

	* tests/test-annotate.cc (main): Pass diff -w option.

Suggested-by: Bogdan Graur <bgraur@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2022-05-30 12:10:26 +02:00
Guillermo E. Martinez via Libabigail
f76484cc9d Add regression tests for ctf reading
This patch implements some regression tests for ctf reading.
Since the code shares a lot of functionalities already used
in the readi-dwarf test, a library was built and test common
harness were moved to a common location. So input files for
test-read-{dwarf,ctf}.cc now are located in:
tests/data/test-read-common directory, ABIs description are
stored in the same location but in a separate file, one for
each binary debugging information: (e.g, test4-ctf.so.abi
and test4-dwarf.so.abi)

	* tests/test-read-ctf.cc: New ctf reading regression test.
	* tests/test-read-common.cc: New library to be used with
	test-read-{ctf,dwarf}.cc.
	* tests/test-read-common.h: Likewise.
	* tests/test-annotate.cc (in_out_specs): Adjust path for input files.
	* tests/Makefile.am: Build new tests/test-read-ctf.cc file.
	* tests/data/Makefile.am: Add test inputs and expected files.
	Add libtestreadcommon.a test library and use it for test-read-{ctf,dwarf}.
	* tests/test-read-dwarf.cc: Adapt test to use libtestreadcommon.a in
	test-read-common.{cc,h}.
	* tests/data/test-annotate/test3.so.abi: Adjust ELF input path file
	location to ./tests/data/test-read-common.
	* tests/data/test-annotate/test4.so.abi: Likewise.
	* tests/data/test-read-common/PR26261: Move test harness to
	test-read-common directory.
	* tests/data/test-read-common/PR27700: Likewise.
	* tests/data/test-read-common/test-PR26568-*: Likewise.
	* tests/data/test-read-common/test3.{c,so}: Likewise.
	* tests/data/test-read-common/test4.{c,so}: Likewise.
	* tests/data/test-read-common/crti*: Helper object to export
	_init and _fini sysmbols.
	* tests/data/test-read-ctf/test-ambiguous-struct-A.c: New testcase.
	* tests/data/test-read-ctf/test-ambiguous-struct-B.c: Likewise.
	* tests/data/test-read-ctf/test-conflicting-type-syms-a.c: Likewise.
	* tests/data/test-read-ctf/test-conflicting-type-syms-b.c: Likewise.
	* tests/data/test-read-ctf/test-enum.c: Likewise.
	* tests/data/test-read-ctf/test-enum-many.c: Likewise.
	* tests/data/test-read-ctf/test-enum-symbol.c: Likewise.
	* tests/data/test-read-ctf/test-struct-iteration.c: Likewise.
	* tests/data/test-read-ctf/test-dynamic-array.c: Likewise.
	* tests/data/test-read-ctf/test0.c: Likewise.
	* tests/data/test-read-ctf/test1.c: Likewise.
	* tests/data/test-read-ctf/test2.c: Likewise.
	* tests/data/test-read-ctf/test5.c: Likewise.
	* tests/data/test-read-ctf/test7.{c,h}: Likewise.
	* tests/data/test-read-ctf/test8.c: Likewise.
	* tests/data/test-read-ctf/test9.c: Likewise.
	* tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi: Testcase
	expected result.
	* tests/data/test-read-ctf/PR26261/PR26261-exe.abi: Likewise.
	* tests/data/test-read-ctf/PR27700/test-PR27700.abi: Likewise.
	* tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-enum.o.abi: Likewise.
	* tests/data/test-read-ctf/test-enum-many.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-enum-symbol.o.hash.abi: Likewise.
	* tests/data/test-read-ctf/test-struct-iteration.o.abi: Likewise.
	* tests/data/test-read-ctf/test-dynamic-array.o.abi: Likewise.
	* tests/data/test-read-ctf/test0: Likewise.
	* tests/data/test-read-ctf/test0*.abi: Likewise.
	* tests/data/test-read-ctf/test1.so: Likewise.
	* tests/data/test-read-ctf/test1*.abi: Likewise.
	* tests/data/test-read-ctf/test2.so: Likewise.
	* tests/data/test-read-ctf/test2*.abi: Likewise.
	* tests/data/test-read-ctf/test3.so.abi: Likewise.
	* tests/data/test-read-ctf/test4*.abi: Likewise.
	* tests/data/test-read-ctf/test5.o.abi: Likewise.
	* tests/data/test-read-ctf/test7.o.abi: Likewise.
	* tests/data/test-read-ctf/test8.o.abi: Likewise.
	* tests/data/test-read-ctf/test9.o.abi: Likewise.
	* tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Update
	expected abixml file.
	* tests/data/test-read-dwarf/PR27700/test-PR27700.abi: Likewise.
	* tests/data/test-read-dwarf/test-PR26568-1.*.abi: Likewise.
	* tests/data/test-read-dwarf/test3*.abi: Likewise.
	* tests/data/test-read-dwarf/test4*.abi: Likewise.
	* doc/api/libabigail.doxy: Add tests/test-read-common.{cc,h} to
	doxygen.

Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-12-14 16:45:58 +01:00
tangmeng
eea4e92b2d Standardize and improve the output of several tests
This patch updates several test harnesses to make their output show
the command line of the failing tests, a brief informative summary
about the number of unit tests executed, failed and executed with
success.

These tests now used the
abigail::tests::emit_test_{summary,status_and_update_counters}
functions provided in tests/test-utils.cc.

	* tests/test-abidiff-exit.cc (main): Use
	abigail::tests::emit_test_{summary, status_and_update_counters}
	functions to ameliorate and standardize test output.
	* tests/test-alt-dwarf-file.cc (main): Likewise.
	* tests/test-annotate.cc (main): Likewise.
	* tests/test-diff-dwarf-abixml.cc (main): Likewise.
	* tests/test-ini.cc (main): Likewise.
	* tests/test-lookup-syms.cc (main): Likewise.

Signed-off-by: tangmeng <tangmeng@uniontech.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-11-17 12:44:16 +01:00
Dodji Seketeli
c80f79271a Re-license the project to Apache v2 With LLVM Exception
Thanks to the previous work done, changing the license is just a
matter of changing the SPDX identifer from "LGPL-3.0-or-later" to
"Apache-2.0 WITH LLVM-exception".  Note that for the abigail.m4,
tests/test-dot.cc and tests/test-svg.cc the change was from
"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
LLVM-exception".  include/abg-cxx-compat.h was changed from
"LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception".  Source code
of programs (as opposed to source code of the library) where generally
licensed under GPL-3.0-or-later; they are also now licensed
"Apache-2.0 WITH LLVM-exception".

This is what this patch does.

	* abigail.m4: Change the SPDX identifier from "GPL-3.0-or-later
	WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception"
	* include/abg-cxx-compat.h: Change the SPDX identifier from
	"LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception".
	* .clang-format: Change the SPDX identifier from
	  "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception".
	* Makefile.am: Likewise.
	* bash-completion/Makefile.am: Likewise.
	* bash-completion/abicompat: Likewise.
	* bash-completion/abidiff: Likewise.
	* bash-completion/abidw: Likewise.
	* bash-completion/abilint: Likewise.
	* bash-completion/abinilint: Likewise.
	* bash-completion/abipkgdiff: Likewise.
	* bash-completion/abisym: Likewise.
	* bash-completion/fedabipkgdiff: Likewise.
	* configure.ac: Likewise.
	* default.abignore: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/api/libabigail.doxy: Likewise.
	* doc/manuals/Makefile.am: Likewise.
	* doc/website/libabigail-website.doxy: Likewise.
	* include/Makefile.am: Likewise.
	* include/abg-comp-filter.h: Likewise.
	* include/abg-comparison.h: Likewise.
	* include/abg-config.h: Likewise.
	* include/abg-corpus.h: Likewise.
	* include/abg-diff-utils.h: Likewise.
	* include/abg-dwarf-reader.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-hash.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-reader.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-traverse.h: Likewise.
	* include/abg-version.h.in: Likewise.
	* include/abg-viz-common.h: Likewise.
	* include/abg-viz-dot.h: Likewise.
	* include/abg-viz-svg.h: Likewise.
	* include/abg-workers.h: Likewise.
	* include/abg-writer.h: Likewise.
	* scripts/dot_to_png.sh: Likewise.
	* scripts/dot_to_svg.sh: Likewise.
	* scripts/make-verbose.sh: Likewise.
	* scripts/svg_to_plain_svg.sh: Likewise.
	* scripts/svg_to_png_and_pdf.sh: Likewise.
	* src/Makefile.am: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus-priv.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-default-reporter.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-elf-helpers.cc: Likewise.
	* src/abg-elf-helpers.h: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-internal.h: Likewise.
	* src/abg-ir-priv.h: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-leaf-reporter.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-regex.cc: Likewise.
	* src/abg-reporter-priv.cc: Likewise.
	* src/abg-reporter-priv.h: Likewise.
	* src/abg-suppression-priv.h: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-workers.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/Makefile.am: Likewise.
	* tests/data/Makefile.am: Likewise.
	* tests/lib/catch.cc: Likewise.
	* tests/mockfedabipkgdiff.in: Likewise.
	* tests/print-diff-tree.cc: Likewise.
	* tests/runtestcanonicalizetypes.sh.in: Likewise.
	* tests/runtestdefaultsupprs.py.in: Likewise.
	* tests/runtestdefaultsupprspy3.sh.in: Likewise.
	* tests/runtestfedabipkgdiff.py.in: Likewise.
	* tests/runtestfedabipkgdiffpy3.sh.in: Likewise.
	* tests/test-abicompat.cc: Likewise.
	* tests/test-abidiff-exit.cc: Likewise.
	* tests/test-abidiff.cc: Likewise.
	* tests/test-alt-dwarf-file.cc: Likewise.
	* tests/test-annotate.cc: Likewise.
	* tests/test-core-diff.cc: Likewise.
	* tests/test-cxx-compat.cc: Likewise.
	* tests/test-diff-dwarf-abixml.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-diff2.cc: Likewise.
	* tests/test-dot.cc: Change the SPDX identifier from
	"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
	LLVM-exception"
	* tests/test-elf-helpers.cc: Change the SPDX identifier from
	"LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception"
	* tests/test-ini.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
	* tests/test-kmi-whitelist.cc: Likewise.
	* tests/test-lookup-syms.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-svg.cc: Change the SPDX identifier from
	"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
	LLVM-exception".
	* tests/test-symtab.cc: Change the SPDX identifier from
	"LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception"
	* tests/test-tools-utils.cc: Likewise.
	* tests/test-types-stability.cc: Likewise.
	* tests/test-utils.cc: Likewise.
	* tests/test-utils.h: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tests/update-test-output.py: Likewise.
	* tools/Makefile.am: Likewise.
	* tools/abiar.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.
	* tools/abisym.cc: Likewise.
	* tools/binilint.cc: Likewise.
	* tools/fedabipkgdiff: Likewise.
	* tools/kmidiff.cc: Likewise.
	* update-copyright.sh: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2020-12-02 11:49:13 +01:00
Matthias Maennich
58488c5f31 Replace individual license references with SPDX Identifiers
This patch replaces license headers with SPDX identifiers in all files
containing license headers.  For each file, the SPDX identifier
formally represents its current license.  Note that the list of SPDX
identifiers is available on the SPDX web site at
https://spdx.org/licenses.

For autoconf-archive/ax_prog_python_version.m4 however, there is a
little catch.  Dodji Seketeli wrote this ax_check_python_modules.m4.
Just like the other autoconf-archive macros, it makes sense to have it
under the FSF All Permissive license.  Actually, the terms of that
license was already in the file but then the license header was
wrongly set to GPLv2 with autoconf exception.  So I fixed that in this
commit by setting the SPDX identifier to FSFAP.

	* abigail.m4: Replace the license header with the SPDX identifier
	GPL-3.0-or-later WITH GCC-exception-3.1
	* autoconf-archive/ax_check_python_modules.m4: Correctly set the
	SPDX identifier to FSFAP.
	* autoconf-archive/ax_compare_version.m4: Replace the license
	header with the SPDX identifier FSFAP.
	* autoconf-archive/ax_prog_python_version.m4: Likewise.
	header with the SPDX identifier FSFAP.
	* autoconf-archive/ax_valgrind_check.m4: Likewise.
	* gen-changelog.py: Replace the license header with the SPDX
	identifier LGPL-2.0-or-later.
	* include/abg-comp-filter.h: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later.
	* include/abg-comparison.h: Likewise.
	* include/abg-config.h: Likewise.
	* include/abg-corpus.h: Likewise.
	* include/abg-cxx-compat.h: Replace the license header with the
	SPDX identifier LGPL-2.0-or-later.
	* include/abg-diff-utils.h: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later
	* include/abg-dwarf-reader.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-hash.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-reader.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-traverse.h: Likewise.
	* include/abg-viz-common.h: Likewise.
	* include/abg-viz-dot.h: Likewise.
	* include/abg-viz-svg.h: Likewise.
	* include/abg-workers.h: Likewise.
	* include/abg-writer.h: Likewise.
	* install-sh: Replace the license header with the SPDX identifier MIT.
	* ltmain.sh: Replace the license header with the SPDX identifier
	GPL-2.0-or-later.  Note that this file has the libtool special
	exception which allows us to redistribute it under the general
	license of the project.
	* src/abg-comp-filter.cc: Replace the license header with the SPDX
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus-priv.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-default-reporter.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-elf-helpers.cc: Likewise.
	* src/abg-elf-helpers.h: Likewise.
	* src/abg-regex.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-internal.h: Likewise.
	* src/abg-ir-priv.h: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-leaf-reporter.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-reporter-priv.cc: Likewise.
	* src/abg-reporter-priv.h: Likewise.
	* src/abg-sptr-utils.cc: Likewise.
	* src/abg-suppression-priv.h: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-workers.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/lib/catch.cc: Likewise.
	* tests/lib/catch.hpp: Add an SPDX identifier BSL-1.0.
	* tests/mockfedabipkgdiff.in: Replace the license header with the
	SPDX identifier GPL-3.0-or-later.
	* tests/print-diff-tree.cc: Likewise.
	* tests/runtestfedabipkgdiff.py.in: Replaace the license header
	with the SPDW identifier GPL-3.0-or-later.
	* tests/test-abicompat.cc: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later.
	* tests/test-abidiff-exit.cc: Likewise.
	* tests/test-abidiff.cc: Likewise.
	* tests/test-alt-dwarf-file.cc: Likewise.
	* tests/test-annotate.cc: Likewise.
	* tests/test-cxx-compat.cc: Likewise.
	* tests/test-core-diff.cc: Likewise.
	* tests/test-diff-dwarf-abixml.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-diff2.cc: Likewise.
	* tests/test-dot.cc: Replace the license header with the
	SPDX identifier GPL-3.0-with-GCC-exception.
	* tests/test-elf-helpers.cc: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later.
	* tests/test-ini.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
	* tests/test-kmi-whitelist.cc: Likewise.
	* tests/test-lookup-syms.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-svg.cc: Replace the license header with the SPDX
	identifier GPL-3.0-with-GCC-exception.
	* tests/test-symtab.cc: Replace the license header with the SPDX
	identifier LGPL-3.0-or-later.
	* tests/test-tools-utils.cc: Likewise.
	* tests/test-types-stability.cc: Likewise.
	* tests/test-utils.cc: Likewise.
	* tests/test-utils.h: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tools/abiar.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.
	* tools/abisym.cc: Likewise.
	* tools/binilint.cc: Likewise.
	* tools/fedabipkgdiff: Replace the license header with the
	SPDX identifier GPL-3.0-or-later.
	* tools/kmidiff.cc: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2020-12-02 11:44:13 +01:00
Dodji Seketeli
43d56de89b Handle several member anonymous types of the same kind
When there are several anonymous types (e.g, anonymous classes, unions
or enums) in a given class or union, libabigail's internals do
struggle.

An anonymous class, for instance, is named __anonymous_struct__.  When
there are more than one of these inside a given class, then we can't
name and look them up, because they all have the same name.

Incidentally, when add_or_update_class_type completes a class type
that was initially constructed before, it fails to determine that an
anonymous member type of that class was already present in that
context.  It thus wrongly duplicates anonymous structs/unions/enums in
there and that leads to spurious textual (abixml) representation
differences later, where duplicated anonymous member types would
appear intermittently, depending on the order in which the class was
built.

This patch addresses this general issue by naming anonymous member
types in a way that allows several of them to exist. That is, if there
are two anonymous structs in a class, they are going to be named
__anonymous_struct__ and __anonymous_struct__1.  We do follow a
similar scheme for anonymous unions and enums. This is handled by the
DWARF reader that builds the internal representation.

While looking at this issue, I also fixed a tangent bug; some DWARF
emitters wrongly *define* types in the scope of a
DW_TAG_subroutine_type or DW_TAG_array_type.  We handle that by
actually defining those types in the scope of that subroutine or
array.  But then it appears that if that scope itself a class and if
the type defined is an anonymous type, then putting that anonymous
type in the class scope might interfere with the *naming* of the
existing legit anonymous types of that scope.  I decided to put those
anonymous types in the containing namespace instead.  We'll see how
that goes in real time use.

The patch also updates lots of existing tests and adds a new one.

	* include/abg-ir.h
	(class_or_union::get_num_anonymous_member_{classes, unions,
	enums}): Declare new member functions.
	* src/abg-dwarf-reader.cc (get_internal_anonynous_die_base_name)
	(build_internal_anonymous_die_name)
	(get_internal_anonymous_die_name, is_anonymous_type_die): Define
	new static functions.
	(die_qualified_type_name): Use the new
	get_internal_anonymous_die_name.
	(get_scope_for_die): Fix this to put anonymous types that were
	wrongly emitted into the scope of DW_TAG_subroutine_type or
	DW_TAG_array_type by buggy DWARF emitters into the enclosing
	namespace, rather than into the enclosing class/union.
	(build_enum_type): Take the scope of the enum to have a chance to
	properly name potential anonymous enums.
	(lookup_class_typedef_or_enum_type_from_corpus): Take an anonymous
	member type index for when the DIE we are lookup up represents an
	anonymous type.  Support proper building of the internal anonymous
	name of the anonymous type we are lookup up.
	(add_or_update_class_type): Use the new
	get_internal_anonynous_die_base_name and
	build_internal_anonymous_die_name functions.  Support making sure
	that the anonymous member type we are adding to the class wasn't
	already there, especially for cases where we are updating a class
	type.
	(add_or_update_union_type): Use the new
	get_internal_anonynous_die_base_name and
	build_internal_anonymous_die_name functions.
	(build_ir_node_from_die): Adjust the use of build_enum_type to
	pass it the scope of the enum type we are building.
	* src/abg-ir.cc	(lookup_union_type): Add a new overload.
	(lookup_class_or_typedef_type): Use the new overload of
	lookup_union_type above to support looking up union types too.
	(class_or_union::get_num_anonymous_member_{classes, unions,
	enums}): Define new member functions.
	* src/abg-reporter-priv.cc (represent): Detect when anonymous
	types of anonymous data members have their internal names change,
	probably because anonymous member types were inserted in the scope.
	* tests/data/Makefile.am: Add the new test-anonymous-members-0.*
	test input files to the source distribution.
	* tests/data/test-annotate/test-anonymous-members-0.cc: New test
	input file.
	* tests/data/test-annotate/test-anonymous-members-0.o: Likewise.
	* tests/data/test-annotate/test-anonymous-members-0.o.abi: Likewise.
	* tests/data/test-annotate/test17-pr19027.so.abi: Adjust.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.
	* tests/test-annotate.cc (int_out_specs): Add the new test inputs
	to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-05-07 14:31:16 +02:00
Dodji Seketeli
8c51a89525 Wire the --no-show-locs option to abidw
Up until now, the --no-show-locs option only had effect when abidiff
was used with the --abidiff option.  It had no effect on the ABIXML
output of abidw.

This patch changes that to make it so that --no-show-locs avoids
emitting source location to the ABIXML output.

	* doc/manuals/abidw.rst: Update the documentation.
	* tests/test-annotate.cc: Now that --no-show-locs has an effect on
	the ABIXML output, let's not use it here, because it changes the
	output and we don't want that.
	* tools/abidw.cc (display_usage): Fix a typo in the help string.
	(load_corpus_and_write_abixml): Set the "show-locs" option to the
	write_context object that we use.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-11-02 12:57:11 +01:00
Dodji Seketeli
d65585a772 Fix virtual members sorting to unbreak the build on EL6
When two virtual members functions have the same virtual index, the
same pretty representation, and one of them has no ELF symbols, then
they might be sorted in a way or in an other.  This sorting hazard
breaks the runtestreaddwarf test on EL6.

This patch addresses that to make the virtual member function that has
no ELF symbol to come before the one with an ELF symbol.

Also, it turned out that runtestannotate is broken on EL6 too because
we are trying to demangle c++11-mangled symbols in there, and the
demangler (which is C++<11 only) on that platform doesn't really like
that.  So this patch removes the tests in which there are c++11 symbols
that we try to demangle.

	* src/abg-ir.cc (virtual_member_function_less_than::operator()):
	Update comment.  When two virtual functions have the same virtual
	index and one of them has no ELF symbol, then that function is
	less than the one with an ELF symbol.
	* tests/data/Makefile.am: Remove
	test-annotate/{test9-pr18818-clang.so.abi, test11-pr18828.so.abi,
	test12-pr18844.so.abi, test16-pr18904.so.abi,
	test22-pr19097-libstdc++.so.6.0.17.so.abi}.
	* tests/data/test-annotate/test10-pr18818-gcc.so.abi: Remove.
	* tests/data/test-annotate/test11-pr18828.so.abi: Likewise.
	* tests/data/test-annotate/test12-pr18844.so.abi: Likewise.
	* tests/data/test-annotate/test16-pr18904.so.abi: Likewise.
	* tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.
	* tests/test-annotate.cc (in_out_specs):  Remove those tests above
	which input files have been removed.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-03-03 12:56:44 +01:00
Ondrej Oprala
aba99e5106 Bug 20970 - Add a --annotate option to abidw
This option annotates (read "pretty-prints") the types and elf symbols
in the form of XML comments in the ABIXML output emitted by the abidw
command.

Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>

	* doc/manuals/abidiff.rst: Document the '--no-corpus-path'
	option.
	* doc/manuals/abidw.rst: Document the '--no-corpus-path'
	and '--annotate' options.
	* include/abg-libxml-utils.h ({un,}escape_xml_comment): Add
	new function declarations.
	* include/abg-writer.h: Add new annotate functions
	(write_{translation_unit,corpus_to_{archive,native_xml_file}}):
	Add an optional "annotate" parameter defaulting to "false".
	* src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add
	new function definitions.
	* src/abg-writer.cc (annotate): Define new templatized function
	and specialize it for necessary cases.
	* tests/Makefile.am: Add runtestannotate as a new test.
	* tests/data/Makefile.am: Add paths to below reference test
	outputs.
	* tests/data/test-annotate/libtest23.so.abi: New reference test
	output.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test1.abi: Likewise.
	* tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-annotate/test11-pr18828.so.abi: Likewise.
	* tests/data/test-annotate/test12-pr18844.so.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
	* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
	* tests/data/test-annotate/test16-pr18904.so.abi: Likewise.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
	* tests/data/test-annotate/test2.so.abi: Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
	* tests/data/test-annotate/test3.so.abi: Likewise.
	* tests/data/test-annotate/test4.so.abi: Likewise.
	* tests/data/test-annotate/test5.o.abi: Likewise.
	* tests/data/test-annotate/test6.so.abi: Likewise.
	* tests/data/test-annotate/test7.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise.
	* tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise.
	* tests/test-annotate.cc: New test for ABIXML annotations.
	* tools/abidiff.cc: Add the new option '--no-corpus-path'.
	* tools/abidw.cc: Likewise. Also add the '--annotate' option.

reviews round 1

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-24 15:41:37 +01:00