mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-15 06:24:37 +00:00
186cc9ed3a
4 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
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> |
||
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> |
||
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> |
||
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> |