mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-08 17:47:13 +00:00
90eff56227
64 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
ee2b54ddd9 |
Make abidiff and abidw support several --headers-dir{1,2} options
When handling a binary with abidiff or abidw it can be useful to provide several different header files directories, for the cases where the header files of the binary are scathered in several different directories. It thus becomes possible to invoke abidiff like this: abidiff --headers-dir1 first-header-dir1 \ --headers-dir1 second-header-dir1 \ --headers-dir2 first-header-dir2 \ --headers-dir2 second-header-dir2 \ binary1 binary2 This patch adds support for that. It also modifies the tests/test-abidiff-exit.cc test harness to make it take header directories. With that modification done, a new test is added in that harness to exercise this new feature. This should close the feature request over at https://sourceware.org/bugzilla/show_bug.cgi?id=26565. * doc/manuals/abidiff.rst: Update documentation for the --headers-dir{1,2} options. * doc/manuals/abidw.rst: Likewise for the --header-dir option. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Add new overload that takes a vector of headers root dirs. * src/abg-tools-utils.cc (gen_suppr_spec_from_headers_root_dir): Define new function. (gen_suppr_spec_from_headers): Define a new overload that takes a vector of head_root_dir strings; it uses the new gen_suppr_spec_from_headers function. Use the new overload in the previous one that takes just one head_root_dir string. * tools/abidiff.cc (options::headers_dirs{1,2}): Rename option::headers_dir{1,2} into this one and make it be a vector of strings rather than just a string. (parse_command_line): Support several --headers-dir{1,2} on the command line. (set_diff_context_from_opts, set_suppressions): Adjust. * tools/abidw.cc (options::headers_dirs): Renamed options::headers_dir into this and make it be a vector of strings rather than just a string. (parse_command_line): Support several --headers-dir on the command line. (set_suppressions): Adjust. * tests/data/test-abidiff-exit/test-headers-dirs/headers-a/header-a-v{0,1}.h: Header files of new binary test input. * tests/data/test-abidiff-exit/test-headers-dirs/headers-b/header-b-v{0,1}.h: Likewise. * tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-v{0,1}.c: Source code of new binary test input. * tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-{1,2}.txt: Reference output of new binary test input. * tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-v{0,1}.o: New binary test input. * tests/data/Makefile.am: Add the new files above to source distribution. * tests/test-abidiff-exit.cc (InOutSpec::in_elfv{0,1}_path): Add new data members. (in_out_specs): Adjust the content of this array as its type changed. Also, add two new entries to run the test over the new binary test inputs above. (do_prefix_strings): Define new static function. (main): Use it the new do_prefix_strings here. Make abidiff use the --header-dir{1,2} option whenever header directories are specified in an entry of the in_out_specs array. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
f18a192aa6 |
Improve documentation of abidiff --type-id-style
* tools/abidw.cc (display_usage): In documentation of "--type-id-style" option, add a missing closing ')', spell "type id" without a '-', split overly long string over two lines, use "<...>" to indicate mandatory argument and improve description of formats. * doc/manuals/abidw.rst: In documentation of "--type-id-style" option, use "<...>" to indicate mandatory argument. Signed-off-by: Giuliano Procida <gprocida@google.com> |
||
|
29de666641 |
abg-writer: Add support for stable hash type ids.
The type ids currently emitted by the XML writer are simply type-id-1, type-id-2 etc. Additions or removals of types early in this sequence result in cascading changes to many other XML elements. This commit adds support for stable type ids in the form of hashes of libabigail's internal type names. On fairly rare occasions (typically involving unnamed types), the names of two distinct types can be the same. In any case, if there is a hash collision the XML writer will find the next unused id and so preserve uniqueness. Diffs between large XML files produced using --type-id-style hash will be much smaller and easier to review. This also commit adds some test cases to verify that the hashing is actually stable across architectures. * doc/manuals/abidw.rst: Replace stray documentation of --named-type-ids with documention of new --type-id-style option. * include/abg-writer.h (type_id_style_kind): Add new enum. (set_type_id_style): Add new write_context setter. (set_common_options): Set type id style in write context. * include/abg-hash.h (fnv_hash): Declare new 32-bit FNV-1a hash function in abigail::hashing namespace. * src/abg-hash.h (fnv_hash): Define new 32-bit FNV-1a hash function in abigail::hashing namespace. * src/abg-writer.cc (write_context): Add m_type_id_style member to record type style to use, defaulting to SEQUENCE_TYPE_ID_STYLE; add m_used_type_id_hashes to record already-used hashes. (write_context::get_type_id_style): Add new getter. (write_context::set_type_id_style): Add new setter. (get_id_for_type): Add support for HASH_TYPE_ID_STYLE style. (set_type_id_style): Add new helper function. * tools/abidw.cc (options): Add type_id_style member. (display_usage): Add description of --type-id-style option. (parse_command_line): Parse --type-id-style option. * tests/data/Makefile.am: Add new hash type id ABI files. * tests/test-read-dwarf.cc: (InOutSpec): Add type_id_style member. (in_out_specs): Set type_id_style to SEQUENCE_TYPE_ID_STYLE in existing test specifications. Duplicate first 9 test cases with type_id_style set to HASH_TYPE_ID_STYLE. * tests/data/test-read-dwarf/test0.hash.abi: New ABI XML file with hash type ids. * tests/data/test-read-dwarf/test1.hash.abi: Ditto. * tests/data/test-read-dwarf/test2.so.hash.abi: Ditto. * tests/data/test-read-dwarf/test3.so.hash.abi: Ditto. * tests/data/test-read-dwarf/test4.so.hash.abi: Ditto. * tests/data/test-read-dwarf/test5.o.hash.abi: Ditto. * tests/data/test-read-dwarf/test6.so.hash.abi: Ditto. * tests/data/test-read-dwarf/test7.so.hash.abi: Ditto. * tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Ditto. Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
a9f5fb4089 |
Add --no-write-default-sizes option.
abidw will write out the exact same size-in-bits address for every
pointer type, reference type, function declaration and function type
even though it is always the same as the translation unit address
size. When giving the --no-write-default-sizes option these aren't
written out anymore. The reader is updated to set the default size
when none is given in the XML description.
Even though size and alignment are handled together in the reader,
default alignment is still set to zero, following commit
|
||
|
b8860e1db3 |
Add --no-elf-needed option to drop DT_NEEDED list from corpus.
The elf-needed list is not relevant for the exported ABI of a library so provide an option to drop it. * doc/manuals/abidw.rst: Document --no-elf-needed. * include/abg-writer.h (set_write_elf_needed): New function. (set_common_options): Call it. * src/abg-writer.cc (write_context::m_write_elf_needed): New data member. (write_context::{g,s}et_write_elf_needed): Add new accessors. (set_write_elf_needed): New function. (write_context::write_corpus): Check write_elf_needed. * tools/abidw.cc (options): Add write_elf_needed bool. (display_usage): Describe --no-elf-needed. (parse_command_line): Parse --no-elf-needed. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
8da509aaa2 |
Add no-parameter-names to drop function parameter names.
The function parameter names are not relevant for the (exported) ABI. So provide an option to simply drop them from the corpus. * doc/manuals/abidw.rst: Add documentation for --no-parameter-names. * include/abg-writer.h (set_write_parameter_names): New function. (set_write_parameter_names): Call it. * src/abg-writer.cc (write_context): Add m_write_parameter_names bool, get_write_parameter_names and set_write_parameter_names functions. (write_context::write_function_decl): Check write_parameter_names. * tools/abidw.cc (options): Add write_parameter_names. (display_usage): Describe --no-parameter-names. (parse_command_line): Parse --no-parameter-names. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
254cafb7d7 |
Add --drop-undefined-syms to abidw.
Add a drop_undefined_syms properties to the read_context that indicates the reader wants to drop any undefined symbols (which don't have associated addresses in the corpus). Implement this for the dwarf_reader and abidw (when using the --drop-undefined-syms option). * include/abg-dwarf-reader.h (set_drop_undefined_syms): New declaration. * src/abg-dwarf-reader.cc (class read_context): Add private bool drop_undefined_syms_. (drop_undefined_syms): New getter and setter method. (set_drop_undefined_syms): New function. (function_is_suppressed): Check drop_undefined_syms on read_context. (variable_is_suppressed): Likewise. * src/abg-reader.cc (read_context): Add private bool m_drop_undefined_syms. (drop_undefined_syms): New getter and setter method. * tools/abidw.cc (struct options): Add drop_undefined_syms. (display_usage): Print --drop-undefined-syms. (parse_command_line): Parse --drop-undefined-syms. (main): Call set_drop_undefined_syms. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
aef674711a |
Add --drop-private-types to abidw.
To create smaller abi XML files it is useful to be able to drop the private types from the representation. * tools/abidw.cc (options): Add drop_private_types bool. (display_usage): Add --drop-private-types. (parse_command_line): Parse --drop-private-types, set opts. (set_suppressions): Call set_drops_artifact_from_ir when drop_private_types set. * doc/manuals/abidw.rst: Document --drop-private-types. Signed-off-by: Mark Wielaard <mark@klomp.org> |
||
|
9fe85b370c |
Add --header-file option to add individual public header files.
Sometimes public header files are in the same directory as private header files. In such cases --headers-dir cannot be used. Add --header-file to add individual public header files. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Add hdr_files string vector argument. * src/abg-tools-utils.cc (handle_file_entry): New function that adds one specific file to the type_suppression. Implementation lifted from... (handle_fts_entry): ...here. Call handle_file_entry for each file. (gen_suppr_spec_from_headers): Also takes a header_files string vector as argument. Call handle_file_entry for each file entry. * tools/abidiff.cc (options): Add header_files1 and header_files2 string vectors. (display_usage): Print --header-file1 and --header-file2 usage. (parse_command_line): Handle --header-file1, --hf1 and --header-file2, --hf2. (set_diff_context_from_opts): Call gen_suppr_spec_from_headers with header_files1 and header_files2. (set_suppressions): Likewise. * tools/abidw.cc (options): Add header_files string vector. (display_usage): Print --header-file usage. (parse_command_line): Handle --header-file1, --hf1. (maybe_check_header_files): New function. (set_suppressions): Call gen_suppr_spec_from_headers with header_files. (main): Call maybe_check_header_files. * tools/abilint.cc (options): Add header_files string vector. (display_usage): Print --header-file usage. (parse_command_line): Handle --header-file1, --hf1. (set_suppressions): Call gen_suppr_spec_from_headers with header_files. * doc/manuals/abidiff.rst: Document --header-file1, --hf1 and --header-file2, --hf2. Add new options to documentation of --drop-private-types. * doc/manuals/abidw.rst: Document --header-file, --hf. * doc/manuals/abilint.rst: Likewise. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
1d6731c438 |
Update copyright year to 2020
We are in February 2020 so this is long overdue. * include/abg-comp-filter.h: Update copyright year to 2020. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-cxx-compat.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-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. * 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-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/print-diff-tree.cc: 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-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: Likewise. * tests/test-ini.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-svg.cc: Likewise. * 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/kmidiff.cc: Likewise. * update-copyright.sh: Fix the updating script to handle not just "Red Hat, Inc." Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
9ab71105eb |
KMI Whitelists: Drop old whitelist extraction methods
The previous commit introduces a new (tested) way of creating function and variable suppressions from multiple whitelist definitions. Migrate to this new way of processing KMI whitelists. * include/abg-tools-utils.h (gen_suppr_spec_from_kernel_abi_whitelist): Delete declaration. * src/abg-tools-utils.cc (gen_suppr_spec_from_kernel_abi_whitelist): Delete definition and migrate users to gen_suppr_spec_from_kernel_abi_whitelists. * tools/abidiff.cc (set_suppressions): Migrate from using gen_suppr_spec_from_kernel_abi_whitelist to gen_suppr_spec_from_kernel_abi_whitelists. * tools/abidw.cc (set_suppressions): Likewise. * tools/abipkgdiff.cc: Drop unused using definition. * tools/kmidiff.cc: Likewise. Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
3df54522b8 |
Add timing to the verbose logs of abidw
While doing my recent optimization work, it became useful to have an idea of the time different parts of the processing pipeline are taking. This patch introduces an abigail::tools_utils::timer type that is easy to use to time a given part of the code and emit the elapsed time to an output stream. This abigail::tools_utils::timer type is thus used to time various parts of the processing pipeline involved in abidw. Just using the existing --verbose option now yields timing information. * include/abg-tools-utils.h (class timer): Declare new type. (operator<<(ostream&, const timer&)): Declare new streaming operator for the new timer type. * src/abg-tools-utils.cc (struct timer::priv): Define new type. (timer::{timer, start, stop, value_in_seconds, value, value_as_string, ~timer}): Define member functions. (operator<<(ostream& o, const timer& t)): Define streaming operator. (build_corpus_group_from_kernel_dist_under): Add timing logs to the linux kernel reading process. * src/abg-dwarf-reader.cc (read_context::canonicalize_types_scheduled): Add timing logs to type canonicalization. (read_debug_info_into_corpus): Add timing logs for the whole debug info loading and internal representation building process. * tools/abidw.cc (load_corpus_and_write_abixml): Add timing logs for the binary loading and serizalization process. (load_kernel_corpus_group_and_write_abixml): Add timing logs the Linux Kernel binary loading and writing process. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
beededda29 |
Add compatibility layer for C++11 mode
Introduce a compatibility layer for C++11 code by adding include/abg-cxx-compat.h. abg-cxx-compat defines a new namespace abg_compat and defines abg_compat::hash abg_compat::shared_ptr abg_compat::weak_ptr abg_compat::dynamic_pointer_cast abg_compat::static_pointer_cast abg_compat::unordered_map abg_compat::unordered_set based on definitions from std::tr1 (std=gnu++98) or std:: (std=gnu++11). I decided for introducing abg_compat:: rather than polluting abigail:: to allow an easier transition to C++11 at a later time and to not subtly break existing code. As the shared_ptr in C++11 defines shared_ptr::operator bool() explicit, some locations where a shared_ptr is assigned to boolean, needed to be adjusted to explicitly cast to bool. * include/abg-cxx-compat.h: new file introducing the abg_compat namespace to provide C++11 functionality from either std::tr1 or std:: * include/Makefile.am: Add the new abg-cxx-compat.h to source distribution. * include/abg-comparison.h: replace std::tr1 usage by abg_compat and adjust includes accordingly: likewise * include/abg-diff-utils.h: likewise * include/abg-fwd.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-reporter.h: likewise * include/abg-sptr-utils.h: likewise * include/abg-suppression.h: likewise * include/abg-tools-utils.h: likewise * include/abg-workers.h: likewise * src/abg-comp-filter.cc: likewise * src/abg-comparison-priv.h: likewise * src/abg-corpus.cc: likewise * src/abg-dwarf-reader.cc: likewise * src/abg-hash.cc: likewise * src/abg-ir.cc: likewise * src/abg-reader.cc: likewise * src/abg-suppression.cc: likewise * src/abg-tools-utils.cc: likewise * src/abg-writer.cc: likewise * tests/test-diff-filter.cc: likewise * tests/test-diff-pkg.cc: likewise * tests/test-read-dwarf.cc: likewise * tests/test-read-write.cc: likewise * tests/test-types-stability.cc: likewise * tests/test-write-read-archive.cc: likewise * tools/abicompat.cc: likewise * tools/abidiff.cc: likewise * tools/abidw.cc: likewise * tools/abilint.cc: likewise * tools/abipkgdiff.cc: likewise Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
f3f7537b6e |
abidw: add option to only emit file names (--short-locs)
Various emitted directories contain machine specific information and therefore break reproducibility of abidw's output across different build paths. Hence introduce --short-locs to only emit file names. Thanks to earlier changes, adding an option boils down to adding it to set_opts and to the write_context along with some auxiliary functions for setting and getting. * include/abg-writer.h (set_short_locs): Declare new function. (set_common_options): Use it. set_opts * src/abg-writer.cc (write_context::m_short_locs): New data member. (write_context::write_context): Initialize it. (write_context::{g,s}et_short_locs): Define new accessors. (write_location, write_translation_unit, write_corpus): Honour the new write_context::get_short_locs property. (set_short_locs): Define new function. * tools/abidw.cc (options::short_locs): New data member. (display_usage): Help string for the new --no-show-locs option. (parse_command_line): Parse the new --no-show-locs option. Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
bf9e8b9448 |
abidw: add option to omit the compilation directory
The compilation directory contains machine specific information therefore breaks reproducibility of abidw's output across different build paths. Hence introduce --no-comp-dir-path (as in the xml attribute). Internally I decided to not carry on the duplication of 'dir' and 'path' and used 'comp_dir'. Thanks to earlier changes, adding an option boils down to adding it to set_common_options and to the write_context along with some auxiliary functions for setting and getting. write_translation_unit uses the flag in the write_context and omits the comp-dir-path if asked for. * include/abg-writer.h (set_write_comp_dir): Declare new function. (set_common_options): Use it. * src/abg-writer.cc (write_context::m_write_comp_dir): Define new data member. (write_context::write_context): Initialize it. (write_context::{g,s}et_write_comp_dir): Define new member accessors. (set_write_comp_dir): Define new free-form getter. (write_translation_unit): Teach to respect write_comp_dir flag of write_context. * tools/abidw.cc (options::write_corpus_path): Define new data member. (options::options): Initialize it. (display_usage): Add doc string for a new command line option: --no-comp-dir-path. (parse_command_line): Parse the new command line option --no-comp-dir-path. Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
fca2661581 |
Make write_architecture and write_corpus_path flags in the write_context
Having write_context carry corresponding flags for output sensitive command line options, is useful to ensure these options are not lost in chains for write_* calls. In particular, these options can have various meanings depending on the context (corpus, corpus_group, etc.) Hence add them to the write_context along with getters and setters and make the writers aware of their existence. We do not need to modify the corpus or corpus group's path or architecture any longer as they get ignored for a different reason now. Finally, drop the flag handling in abidw as it is already done via set_opts, which learned about these new flags. * include/abg-writer.h (set_write_architecture) (set_write_corpus_path): Declare new getter functions. (write_corpus): Take a new "member_of_group" argument. (set_common_options): Use set_write_{architecture, corpus_path} here. * src/abg-writer.cc (write_context::m_write_{architecture, corpus_path}}): Add new data members. (write_context::write_context): Initialize the new data members. (write_context::{s,g}et_write_{architecture, corpus}): Define new accessors. (set_write_{architecture, corpus}): Define new free-form getter functions. (write_corpus): Add flag to make aware if written as part of a group. * tools/abidw.cc (load_corpus_and_write_abixml) (load_kernel_corpus_group_and_write_abixml): Drop obsolete option handling as xml_writer::set_common_options now takes care of it. Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> ldiff --git a/include/abg-writer.h b/include/abg-writer.h index 200b5f7..729b455 100644 --- a/include/abg-writer.h +++ b/include/abg-writer.h @@ -53,6 +53,11 @@ set_show_locs(write_context& ctxt, bool flag); void set_annotate(write_context& ctxt, bool flag); +void +set_write_architecture(write_context& ctxt, bool flag); + +void +set_write_corpus_path(write_context& ctxt, bool flag); /// A convenience generic function to set common options (usually used /// by Libabigail tools) from a generic options carrying-object, into @@ -69,6 +74,8 @@ set_common_options(write_context& ctxt, const OPTS& opts) { set_annotate(ctxt, opts.annotate); set_show_locs(ctxt, opts.show_locs); + set_write_architecture(ctxt, opts.write_architecture); + set_write_corpus_path(ctxt, opts.write_corpus_path); } void @@ -105,7 +112,10 @@ write_corpus_to_archive(const corpus_sptr corp, const bool annotate = false); bool -write_corpus(write_context& ctxt, const corpus_sptr& corpus, unsigned indent); +write_corpus(write_context& ctxt, + const corpus_sptr& corpus, + unsigned indent, + bool member_of_group = false); bool ABG_DEPRECATED write_corpus(const corpus_sptr& corpus, unsigned indent, write_context& ctxt); Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
344138e6b4 |
abidw: Consolidate setting options
When setting options meant to be used for the write_context, it is easy to forget to change all relavant locations. In order to consolidate that, introduce a set_opts function that sets various known options. We benefit from earlier refactoring as now the write_context is passed around to carry options for writers. Hence we can be sure, that if we set up the context correctly (and do not use deprecated functionality), the respective write_* function will see the options set in the context. * include/abg-writer.h (set_common_option): Declare new function. * tools/abidw.cc (load_corpus_and_write_abixml) (load_kernel_corpus_group_and_write_abixml): Use the newly introduced set_common_option. Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
6c07e82933 |
write_context: allow mutating the ostream used
Allowing the mutation of the ostream, allows heavy reuse of the write_context as this is the distinction in most places where write_context is used. Hence, fixup various users of write_context and use common objects where applicable. * include/abg-writer.h (set_ostream): Declare new function. * src/abg-writer.cc (write_context::m_ostream): Make this data member be a pointer rather than a reference. (write_context::{write_context, get_ostream): Adjust. member. (write_context::set_ostream): Define new member function. (set_ostream): Define new free-form function. * tools/abidw.cc (load_corpus_and_write_abixml) (load_kernel_corpus_group_and_write_abixml): Use the feature of mutating the ostream and reuse the write_context in most cases. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
6aeed171c1 |
abg-writer: Refactor write_corpus_group API
Introduce a new call overload for write_corpus_group that follows the parameter order context, object (i.e. corpus_group), indent. Deprecate all other overloads that were part of the API and mostly forward them to the new overload. That effort is made to ensure write_context is always provided. write_context allows access to all options that influence the output format. * include/abg-writer.h (write_corpus_group): Introduce new overload write_corpus_group(ctxt, corpus_group, indent) and deprecate all others. * src/abg-writer.cc (write_corpus_group): Likewise for the definitions and adjust. * tools/abidw.cc (load_kernel_corpus_group_and_write_abixml): Migrate to new API of write_corpus_group() Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
948f27480f |
abg-writer: Refactor write_corpus API
Introduce a new overload for write_corpus that follows the parameter order context, object (i.e. corpus), indent. Deprecate all other overloads that were part of the API and mostly forward them to the new overload. That effort is made to ensure write_context is always provided. write_context allows access to all options that influence the output format. * include/abg-writer.h (write_corpus): Introduce new overload write_corpus(ctxt, corpus, indent) and deprecate all others. * src/abg-writer.cc (write_corpus): Likewise for the definitions and adjust. * tests/test-read-dwarf.cc (test_task::perform): Use the new write_corpus which requires a write_context. * tools/abidw.cc (load_corpus_and_write_abixml, ): Likewise. * tools/abilint.cc (main): Likewise. Also simplify logic around the locations as they now can be expressed with less code. Signed-off-by: Matthias Maennich <maennich@google.com> |
||
|
ad8732316a |
Bug 23044 - Assertions with side effects
There are lots of spots in libabigail's source code where the argument of the assert() call does have side effects. This is a problem because when the code is compiled with the NDEBUG macro defined, the assert call does nothing, so the side effects of its argument are then suppressed, changing the behaviour of the program. To handle this issue, this patch introduces the ABG_ASSERT macro which is a wrapper around the assert call that enable the use of side effects in its argument. The patch now uses that ABG_ASSERT macro instead of using the assert call directly. The patch also makes it so that the configure option accepts the --disable-assert option so that the user can build libabigail with the NDEBUG macro defined. Tested by running the testsuite with and without the --disable-assert option to configure. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
047342467c |
Update copyright for 2019
* include/abg-comp-filter.h: Update copyright for 2019 * include/abg-comparison.h: Update copyright for 2019 * include/abg-config.h: Update copyright for 2019 * include/abg-corpus.h: Update copyright for 2019 * include/abg-diff-utils.h: Update copyright for 2019 * include/abg-dwarf-reader.h: Update copyright for 2019 * include/abg-fwd.h: Update copyright for 2019 * include/abg-hash.h: Update copyright for 2019 * include/abg-ini.h: Update copyright for 2019 * include/abg-interned-str.h: Update copyright for 2019 * include/abg-ir.h: Update copyright for 2019 * include/abg-libxml-utils.h: Update copyright for 2019 * include/abg-libzip-utils.h: Update copyright for 2019 * include/abg-reader.h: Update copyright for 2019 * include/abg-reporter.h: Update copyright for 2019 * include/abg-sptr-utils.h: Update copyright for 2019 * include/abg-suppression.h: Update copyright for 2019 * include/abg-tools-utils.h: Update copyright for 2019 * include/abg-traverse.h: Update copyright for 2019 * include/abg-viz-common.h: Update copyright for 2019 * include/abg-viz-dot.h: Update copyright for 2019 * include/abg-viz-svg.h: Update copyright for 2019 * include/abg-workers.h: Update copyright for 2019 * include/abg-writer.h: Update copyright for 2019 * src/abg-comp-filter.cc: Update copyright for 2019 * src/abg-comparison-priv.h: Update copyright for 2019 * src/abg-comparison.cc: Update copyright for 2019 * src/abg-config.cc: Update copyright for 2019 * src/abg-corpus-priv.h: Update copyright for 2019 * src/abg-corpus.cc: Update copyright for 2019 * src/abg-default-reporter.cc: Update copyright for 2019 * src/abg-diff-utils.cc: Update copyright for 2019 * src/abg-dwarf-reader.cc: Update copyright for 2019 * src/abg-hash.cc: Update copyright for 2019 * src/abg-ini.cc: Update copyright for 2019 * src/abg-internal.h: Update copyright for 2019 * src/abg-ir-priv.h: Update copyright for 2019 * src/abg-ir.cc: Update copyright for 2019 * src/abg-leaf-reporter.cc: Update copyright for 2019 * src/abg-libxml-utils.cc: Update copyright for 2019 * src/abg-libzip-utils.cc: Update copyright for 2019 * src/abg-reader.cc: Update copyright for 2019 * src/abg-reporter-priv.cc: Update copyright for 2019 * src/abg-reporter-priv.h: Update copyright for 2019 * src/abg-sptr-utils.cc: Update copyright for 2019 * src/abg-suppression-priv.h: Update copyright for 2019 * src/abg-suppression.cc: Update copyright for 2019 * src/abg-tools-utils.cc: Update copyright for 2019 * src/abg-traverse.cc: Update copyright for 2019 * src/abg-viz-common.cc: Update copyright for 2019 * src/abg-viz-dot.cc: Update copyright for 2019 * src/abg-viz-svg.cc: Update copyright for 2019 * src/abg-workers.cc: Update copyright for 2019 * src/abg-writer.cc: Update copyright for 2019 * tests/print-diff-tree.cc: Update copyright for 2019 * tests/test-abicompat.cc: Update copyright for 2019 * tests/test-abidiff-exit.cc: Update copyright for 2019 * tests/test-abidiff.cc: Update copyright for 2019 * tests/test-alt-dwarf-file.cc: Update copyright for 2019 * tests/test-core-diff.cc: Update copyright for 2019 * tests/test-diff-dwarf-abixml.cc: Update copyright for 2019 * tests/test-diff-dwarf.cc: Update copyright for 2019 * tests/test-diff-filter.cc: Update copyright for 2019 * tests/test-diff-pkg.cc: Update copyright for 2019 * tests/test-diff-suppr.cc: Update copyright for 2019 * tests/test-diff2.cc: Update copyright for 2019 * tests/test-ini.cc: Update copyright for 2019 * tests/test-ir-walker.cc: Update copyright for 2019 * tests/test-lookup-syms.cc: Update copyright for 2019 * tests/test-read-dwarf.cc: Update copyright for 2019 * tests/test-read-write.cc: Update copyright for 2019 * tests/test-types-stability.cc: Update copyright for 2019 * tests/test-utils.cc: Update copyright for 2019 * tests/test-utils.h: Update copyright for 2019 * tests/test-write-read-archive.cc: Update copyright for 2019 * tools/abiar.cc: Update copyright for 2019 * tools/abicompat.cc: Update copyright for 2019 * tools/abidiff.cc: Update copyright for 2019 * tools/abidw.cc: Update copyright for 2019 * tools/abilint.cc: Update copyright for 2019 * tools/abipkgdiff.cc: Update copyright for 2019 * tools/abisym.cc: Update copyright for 2019 * tools/binilint.cc: Update copyright for 2019 * tools/kmidiff.cc: Update copyright for 2019 * update-copyright.sh: Update new year to 2019 Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
3c0701d59d |
Support having several debuginfo search dirs for a binary
There are use cases where the split debuginfo file of a given binary is under a given root directory and that the split debuginfo file itself depends on an alternate debuginfo file that is under another unrelated root directory. In that case, the dwarf reader must be able to look for the debuginfo files under several unrelated root directories. The tools abidiff and abidw must thus support having several occurences of the option --debug-info-dir1 (or --debug-info-dir2) meaning that the debuginfo files for the binary must be looked for under several root directories. This is what this patch does. * doc/manuals/abidiff.rst: Adjust doc for the --debug-info-dir{1,2} that can now be provided several times. * include/abg-dwarf-reader.h ({create, reset}_read_context) (read_corpus_from_elf): Take a vector of debug info root dirs. * include/abg-tools-utils.h (trim_leading_string) (find_file_under_dir, make_path_absolute_to_be_freed) (convert_char_stars_to_char_star_stars): Declare new functions. * src/abg-dwarf-reader.cc (find_alt_debug_info_link): Renamed find_alt_debug_info_location into this. (find_alt_debug_info_path): Define new static function. (find_alt_debug_info): Take a vector of debug info root dirs. Use the new find_alt_debug_info_path to look into the debug info root dirs for the alt debug info. (read_context::debug_info_root_paths_): Define new data member. (read_context::read_context): Take a vector of debug info root dirs and initialize the new read_context::debug_info_root_paths_. (read_context::{initialize, create_default_dwfl}): Take a vector of debug info root dirs and adjust. (read_context::{add_debug_info_root_paths, add_debug_info_root_path, find_alt_debug_info}): Define new member functions. (read_context::load_debug_info): Look into the debug info roots for split debug info files. (create_read_context, read_corpus_from_elf): Take a vector of debug info root dirs and adjust. (has_alt_debug_info): Adjust. * src/abg-tools-utils.cc (trim_leading_string) (make_path_absolute_to_be_freed, find_file_under_dir) (convert_char_stars_to_char_star_stars): Define new functions. (entry_of_file_with_name): Define new static function. (build_corpus_group_from_kernel_dist_under): Adjust. * tests/print-diff-tree.cc (main): Adjust. * tests/test-diff-dwarf.cc (main): Adjust. * tests/test-ir-walker.cc (main): Adjust. * tests/test-read-dwarf.cc (main): Adjust. * tools/abicompat.cc (main): Adjust. * tools/abidiff.cc (options::di_root_paths{1,2}): Changed di_root_path{1,2} into this, change their types into vectors of allocated char*. (options::prepared_di_root_paths{1,2}): Define new data members. (options::~options): Define new destructor. (parse_command_line): Adjust. (prepare_di_root_paths): Define new static function. (handle_error): Remove arguments input_file_name, debug_info_dir{1,2}. Now just take an instance of options instead. Adjust. (main): Adjust. * tools/abidw.cc (options::dir_root_paths): Renamed dir_root_path into this and make it be a vector of allocated char*. (options::prepared_di_root_paths): Define new data member. (options::~options): Free the allocated char* in options::dir_root_paths. (parse_command_line): Support several --debug-info-dir. (load_corpus_and_write_abixml): Adjust. (prepare_di_root_paths): Define static function. (main): Adjust. * tools/abilint.cc (main): Adjust. * tools/abipkgdiff.cc (compare): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
a5837326cb |
Add newline at end of version string display
I screwed up version string display by forgetting to add a newline after it. Oops. Fixed thus. * tools/abidiff.cc (main): Add a newline at the end of the version string line. * tools/abidw.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. * tools/kmidiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2df84dd767 |
Fix version revision number printing in tools --help option
The revision number of the version string is junk since 1.0. This patch fixes that. The patch also comes up with a function that returns a version string, rather than having client code constructing the version string on their own. * configure.ac: Properly set the VERSION_REVISION macro. * include/abg-tools-utils.h (get_library_version_string): Declare new function. * src/abg-tools-utils.cc (get_library_version_string): Define the new function. (gen_suppr_spec_from_kernel_abi_whitelist): Dis-ambiguate the use of the 'config' type. * tools/abicompat.cc (main): Use the new abigail::tools_utils::get_library_version_string function. * tools/abidiff.cc (main): Likewise. * tools/abidw.cc (main): Likewise. * tools/abilint.cc (main): Likewise. * tools/abipkgdiff.cc (main): Likewise. * tools/abisym.cc (main): Likewise. * tools/kmidiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b3c3049fdd |
Update copyright notice for all source files
Happy New Year 2018, I guess :-) * update-copyright.sh: New sed-based script to update the year in the copyright notice. * include/abg-comp-filter.h: Updated the year in the copyright notice. * 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-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. * 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-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/print-diff-tree.cc: 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-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-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.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/kmidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
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> |
||
|
b438c0648e |
Allow setting options to instances of xml_writer::write_context
Up to know, it wasn't possible to set options to instances of xml_writer::write_context. So it wasn't possible to, say, make abidw stop emitting source locations in the abixml. This patch does the work necessary to set two options: annotate and show locations. Note that the patch doesn't yet enable abidw to stop emitting source locations. That will be done in a subsequent patch. * include/abg-writer.h (create_write_context, set_show_locs) (set_annotate): Declare new functions. (write_corpus, write_corpus_group): Remove the output stream and the annotate parameters as these can be retrieved from the context. * src/abg-writer.cc (write_context::m_show_locs): New data member. (write_context::write_context): Initialize it. (write_context::{get_show_locs, set_show_locs}): Add new member functions. (write_location): Take a write_context, rather than an output stream. From the context, we detect if the user did set the "show loc" option and act accordingly. Write the second overload in terms of the first one. (create_write_context, set_show_locs, set_annotate): Define new functions. (write_type_decl, write_qualified_type_def) (write_pointer_type_def, write_reference_type_def) (write_array_type_def, write_enum_type_decl, write_typedef_decl) (write_var_decl, write_function_decl) (write_class_decl_opening_tag, write_union_decl_opening_tag) (write_type_tparameter, write_non_type_tparameter) (write_function_tdecl, write_class_tdecl): Adjust the invocation of write_location. (write_corpus, write_corpus_group): Remove the output stream and the annotate parameters as these can be retrieved from the context. Adjust. * tools/abidw.c: (load_corpus_and_write_abixml): Create a write_context object, set the 'annotate' option to it and use that object to actually write out the corpus. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
8edaadb5f6 |
22160 - Annotate state flag unitialized in abidw
This patch initializes the annotate state flag in abidw. Oops. * tools/abidw.cc (options::options): Initialize the annotate data member. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
a1b6a3d351 |
Bug 21730 - Make abipkgdiff compare Linux Kernel packages as expected
This is the initial patch that makes abipkgdiff recognize Linux kernel packages passed in argument and do the right thing. abipkgdiff gets the vmlinux binary from the debug info package, considers the union of that vmlinux binary and the thousands of kernel modules that we shall name "the Kernel". It then compares ABI (actually Kernel/Module Interface, a.k.a KMI) of the Kernel of the first package against the KMI of the Kernel of the second package. * include/abg-tools-utils.h (get_vmlinux_path_from_kernel_dist): Declare new function. (get_binary_paths_from_kernel_dist): Re-organize order of parameters. (file_is_kernel_package, file_is_kernel_debuginfo_package): Make the file_path parameter be const. (build_corpus_group_from_kernel_dist_under): Take an additional debug_info_root parameter. * src/abg-tools-utils.cc (file_is_kernel_package) (file_is_kernel_debuginfo_package): Const-ify the file_name parameter. (find_vmlinux_path): Define new static function. (get_binary_paths_from_kernel_dist): Re-organize the order of parameters. The debug_info_root_path parameter is now an input parameter. (get_vmlinux_path_from_kernel_dist): Define new function. (get_binary_paths_from_kernel_dist): Adjust invocation of get_binary_paths_from_kernel_dist. (build_corpus_group_from_kernel_dist_under): Take an additional debug_info_root parameter. * tools/abidw.cc (load_kernel_corpus_group_and_write_abixml): Adjust invocation to build_corpus_group_from_kernel_dist_under. * tools/abipkgdiff.cc (create_maps_of_package_content): Don't map the content of a Linux Kernel package. (compare_prepared_userspace_packages) (compare_prepared_linux_kernel_packages, compare_prepared): Define new functions. (compare): Use the new functions above here. * tools/kmidiff.cc (print_kernel_dist_binary_paths_under): Adjust the invocation of get_binary_paths_from_kernel_dist. (main): Adjust the invocation of build_corpus_group_from_kernel_dist_under. Make sure that a kernel package is accompanied by a debug info package. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b9a7e99dda |
Add --vmlinux{1,2} option to abidw and kmidiff
When using abidw to generate an abixml for a Linux Kernel build tree, usually, people have to copy the vmlinux binary into the directory where modules are, so that the tool can find it. This --vmlinux option helps to avoid doing that copy. Simarly, when comparing two Linux Kernel build trees, --vmlinux1 and --vmlinux2 are there to make the tool find the vmlinux binaries to compare, independantly from the directories under which the modules are to be found. * include/abg-tools-utils.h (build_corpus_group_from_kernel_dist_under): Add a new vmlinux_path parameter. * src/abg-tools-utils.cc (find_vmlinux_and_module_paths): Do not try to find a vmlinux binary if we already have the path to one. (build_corpus_group_from_kernel_dist_under): Add a new vmlinux_path parameter. * tools/abidw.cc (options::vmlinux): New data member. (display_usage): Add a usage string for --vmlinux (parse_command_line): Parse the new --vmlinux option. (load_kernel_corpus_group_and_write_abixml): Fix some return code when the function fails. Verify the presence of the vmlinux binary that was given. Adjust. * tools/kmidiff.cc (options::{vmlinux1, vmlinux2}): New data members. (display_usage): Add a usage string for --vmlinux1 and --vmlinux2. (parse_command_line): Parse the --vmlinux1 and --vmlinux2 options. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
76d832115d |
Allow selective resolution of class declaration
When a class is forward-declared, resolving it to a definition that appears later in the same translation unit or in another translation is an interesting problem. Until now, the declaration would be resolved to the definition of that class found in the binary. The problem is that there can be different such definitions, especially in C where there is no "One Definition Rule". In that case, the definition chosen is random. This patch resolves that randomness. For a given class declaration, if there is just one possible definition in the binary, then the declaration is resolved to that definition. If there is one definition for that declaration in the same translation unit, then the declaration is resolved to that definition. If there are more than one definitions in translation units that are not the one of the declaration, then the declaration is left unresolved. This is what I call "selective class declaration resolution". Note that an unresolved class declaration now compares different to a definition of a class of the same name. This is so that we can have an unresolved class be present in the resulting .abi file, alongside an (incompatible) definition of the same class. The change from a class declaration to its definition is filtered out by default, though. * include/abg-fwd.h (type_base_wptrs_type) (istring_type_base_wptrs_map_type): Define new typedefs. (lookup_class_types): Declare new functions. * include/abg-ir.h (environment::decl_only_class_equals_definition): Declare new accessor. (type_maps::{*_types}): Make these accessors return istring_type_base_wptrs_map_type& instead of istring_type_base_wptr_map_type&. * src/abg-dwarf-reader.cc (read_context::resolve_declaration_only_classes): Implement the new selective declaration resolution scheme. * src/abg-ir.cc (type_maps::priv::{*_types_}): Change the type of these data members from istring_type_base_wptr_map_type to istring_type_base_wptrs_map_type. (type_maps::{*_types}): Make these accessors definitions return istring_type_base_wptrs_map_type& instead of istring_type_base_wptr_map_type&. (translation_unit::bind_function_type_life_time): Adjust. (environment::priv::decl_only_class_equals_definition_): New data member. (environment::priv::priv): Initialize it. By default, a decl-only class is now considered different from its definition. (environment::decl_only_class_equals_definition): Define new accessor. (lookup_types_in_map, lookup_class_types): Define new functions. (lookup_type_in_map, lookup_union_type_per_location) (lookup_basic_type, lookup_basic_type_per_location) (lookup_class_type, lookup_class_type_per_location) (lookup_union_type, lookup_enum_type) (lookup_enum_type_per_location, lookup_typedef_type) (lookup_typedef_type_per_location, lookup_qualified_type) (lookup_pointer_type, lookup_reference_type, lookup_array_type) (lookup_function_type, maybe_update_types_lookup_map) (maybe_update_types_lookup_map<class_decl>) (maybe_update_types_lookup_map<function_type>): Adjust. (type_base::get_canonical_type_for): When doing type comparison here, we can now consider that an unresolved class declaration compares different to an incompatible class definition of the same name. So no need to look through decl-only classes in that case. (equals): In the overload for class_or_union, if environment::decl_only_class_equals_definition() is false, then an unresolved class declaration of name "N" compares different to a class definition named "N". * tests/data/test-annotate/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust * tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Adjust. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Adjust. * tests/data/test-diff-filter/test38/Makefile: New test material. * tests/data/test-diff-filter/test38/test38-a.c: Likewise. * tests/data/test-diff-filter/test38/test38-b.c: Likewise. * tests/data/test-diff-filter/test38/test38-c.c: Likewise. * tests/data/test-diff-filter/test38/test38-report-0.txt: Likewise. * tests/data/test-diff-filter/test38/test38-v0: Likewise. * tests/data/test-diff-filter/test38/test38-v1: Likewise. * tests/data/test-diff-filter/test38/test38.h: Likewise. * tests/data/test-diff-filter/test39/Makefile: Likewise. * tests/data/test-diff-filter/test39/test39-a-v0.c: Likewise. * tests/data/test-diff-filter/test39/test39-a-v1.c: Likewise. * tests/data/test-diff-filter/test39/test39-b-v0.c: Likewise. * tests/data/test-diff-filter/test39/test39-b-v1.c: Likewise. * tests/data/test-diff-filter/test39/test39-c-v0.c: Likewise. * tests/data/test-diff-filter/test39/test39-c-v1.c: Likewise. * tests/data/test-diff-filter/test39/test39-main.c: Likewise. * tests/data/test-diff-filter/test39/test39-report-0.txt: Likewise. * tests/data/test-diff-filter/test39/test39-v0: Likewise. * tests/data/test-diff-filter/test39/test39-v1: Likewise. * tests/data/test-diff-filter/test39/test39.h: Likewise. * tests/data/Makefile.am: Add the new test material above to the source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test inputs above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
adb656cc76 |
Initial support of the serialization of the KMI of a Linux Kernel Tree
We have the kmidiff program that takes two Linux Kernel trees containing the vmlinux binary and its modules and compare their Kernel Module Interface, aka KMI. We need to be able to serialize (save in a file) a representation of that KMI. We need to load that KMI back, and compare two serialized KMIs. This patch implements the serialization of the KMI of a Linux Kernel tree. It actually serializes an instance of abigail::ir::corpus_group that is a collection of instances of abigail::ir::corpus. The KMI of each individual binary (vmlinux or kernel module) is represented by one abigail::ir::corpus. All the corpora share the same definitions of types and decls, whenever that makes sense. The patch thus factorizes the routines used to walk a Linux kernel out of the kmidiff program. These routines are then re-used in the abidw program to make it walk a Linux kernel tree (when the --linux-tree option is provided), load the vmlinux and module binaries as an instance of abigail::corpus_group and serialize it out into an output stream. * include/abg-tools-utils.h (check_dir) (get_binary_paths_from_kernel_dist) (build_corpus_group_from_kernel_dist_under): Declare new functions. The last two functions are being moved from tools/kmidiff.cc so that they can be re-used. * include/abg-writer.h (write_corpus): Declare one overload that takes a write_context parameter. (write_corpus_group): Declare three overloads of this new function. * src/abg-tools-utils.cc (check_dir): Define new function. (load_generate_apply_suppressions, is_vmlinux, is_kernel_module) (find_vmlinux_and_module_paths) (get_binary_paths_from_kernel_dist) (build_corpus_group_from_kernel_dist_under): Define new functions. * src/abg-writer.cc (write_context::set_annotate): Define new member function. (write_corpus): Add an overload that takes a write_context. Adapt the existing overload to make it use this new one. (write_corpus_group): Define this new function and two additional overloads for it. * tools/kmidiff.cc (set_suppressions, is_vmlinux) (is_kernel_module, find_vmlinux_and_module_paths) (get_binary_paths_from_kernel_dist) (build_corpus_group_from_kernel_dist_under): Remove. (main): Adjust the call to build_corpus_group_from_kernel_dist_under as its arguments are now adapted since it's been factorized out into abg-tools-utils.h. * tools/abidw.cc (options::corpus_group_for_linux): Define new data member. (options::options): Adjust. (display_usage): Add help strings for the new --linux-tree option. (load_corpus_and_write_abixml): Factorize this function out of the main function. (load_kernel_corpus_group_and_write_abixml): Define new function. (main): Use the factorized load_corpus_and_write_abixml and the new load_corpus_and_write_abixml functions. * tests/test-read-write.cc: Adjust. * doc/manuals/abidw.rst: Add documentation for the new --linux-tree option. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
56f36edcde |
Rename write_corpus_to_native_xml into write_corpus
Rename write_corpus_to_native_xml into write_corpus because it's a better name. * include/abg-writer.h (write_corpus): Rename write_corpus_to_native_xml to this. * src/abg-writer.cc (write_corpus): Rename write_corpus_to_native_xml to this. * tests/test-read-dwarf.cc (test_task::perform): Adjust. * tests/test-read-write.cc: Remove a useless "using abigail::xml_writer::write_corpus_to_native_xml". * tools/abidw.cc (main): Adjust. * tools/abilint.cc (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
c15eecc9a0 |
Make abidw support the --kmi-whitelist option
When writting out the ABI of a Linux kernel binary we must be able to restrict it to the set of functions and global variables which ELF symbols have names defined in a white list. This patch adds that support, using the --kmi-whitelist option. * tools/abidw.cc (options::{kabi_whitelist_paths, kabi_whitelist_supprs}): New data members. (display_usage): Add a help string for the new --kmi-whitelist option. (parse_command_line): Parse the new --kmi-whitelist option. (maybe_check_suppression_files): Check the presence of the linux kernel abi white list passed by the option --kmi-whitelist. (main): Ignore loading the symbol table if the kernel abi white list is provided. * doc/manuals/abidw.rst: Add documentation for the new option. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
3d0cb0cbba |
Fix help string for --header-dirs
* tools/abidw.cc (display_usage): Fix patch -> path typo. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
b81b8f6f8c |
Make abidw --headers-dir work with the --out-file option
* tools/abidw.cc (parse_command_line): Don't require an empty output file when parsing the --headers-dir option. This was a thinko. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
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> |
||
|
fadfa1a6f6 |
Support Linux Kernel binaries
This patch teaches the ELF/DWARF reader of libabigail to load special ELF sections that are specific to Linux Kernel binaries (either vmlinux or linux kernel modules). The patch creates a new flag that tells the ELF reader that it needs to consider the input binary as a Linux Kernel binary. This is the new 'Linux Kernel mode'. In this linux kernel mode, the reader expects sections that are named __ksymtab and/or __ksymtab_gpl sections. Those sections contain indexes (of ELF symbols described in the normal ELF symbol table) of exported ELF symbols that are specifically marked by developers using EXPORT_SYMBOL or EXPORT_SYMBOL_GPL macros. These are symbols of global variables and functions defined and meant to be used by kernel modules. They constitute the interface exported by the Linux Kernel to its modules. So the patch only exports the publicly defined and exported ELF symbols that are also listed in __ksymtab and __ksymtab_gpl sections. The patch also fixes and re-organizes things left and right so that this new mode works in a well integrated manner with the other parts of the reader: - The load address of the binary is no more assumed to be the load address specified by the program header that is at offset zero. This is usually the case for user-space programs. To handle Linux Kernel binaries, the load address is now the one specified by the program header that is at the smallest offset. - The patch now tries to populate the various symbol maps only when necessary. That way, the new symbol maps defined for the ksymtab and ksymtab_gpl section are also loaded only when necessary; that is, when in Linux Kernel mode. - The patch (more) agressively suppresses non-member functions or variables that are not declarations and that have no associated ELF symbol. The patch knows how to recognize and read relevant ELF symbol information from __ksymtab and __ksymtab_gpl sections. The patch makes abidiff and abidw detect that a binary is a Linux Kernel binary (either a vmlinux or a module). It does this by detecting the presence of the speciall __ksymtab_strings section. If it detects that a binary is a Linux Kernel binary then it only considers functions and variables which are defined and exported in the sense of ELF *AND* which ELF symbols are listed in the __ksymtab and __ksymtab_gpl sections. If users want abidiff and abidw to consider their input binaries as normal ELF binaries then they can use the option --no-linux-kernel-mode. * include/abg-dwarf-reader.h (create_read_context): Take a new flag to say if the context is to read an ELF binary in linux kernel mode. * src/abg-dwarf-reader.cc (typedef address_set_type) (address_set_sptr): New typedefs. (get_binary_load_address): The load address of the binary is the load address specified by the program header that is at the smallest offset; not by the program header that is at offset zero. (read_context::{ksymtab_section_, ksymtab_gpl_section_, linux_exported_fn_syms_, linux_exported_var_syms_, linux_exported_gpl_fn_syms_, linux_exported_gpl_var_syms_, load_in_linux_kernel_mode_}): New data members. (read_context::read_context): Initialize ksymtab_section_, ksymtab_gpl_section_ and load_in_linux_kernel_mode_. (read_context::{find_symbol_table_section, find_opd_section, lookup_elf_fn_symbol_from_address, lookup_elf_var_symbol_from_address, get_function_address, get_variable_address}): Make these const. (read_context::{find_ksymtab_section, find_ksymtab_gpl_section, lookup_elf_symbol_from_address, function_symbol_is_exported, variable_symbol_is_exported, linux_exported_fn_syms, create_or_get_linux_exported_fn_syms, linux_exported_var_syms, create_or_get_linux_exported_var_syms, linux_exported_gpl_fn_syms, linux_exported_gpl_var_syms, create_or_get_linux_exported_gpl_fn_syms, linux_exported_gpl_var_syms, create_or_get_linux_exported_gpl_var_syms, architecture_word_size, load_kernel_symbol_table, load_ksymtab_symbols, load_ksymtab_gpl_symbols, load_linux_specific_exported_symbol_maps, load_in_linux_kernel_mode}): New member functions. (read_context::read_int_from_array_of_bytes): Factorize this new member function out of ... (read_context::{lookup_ppc64_elf_fn_entry_point_address}): ... this. Make this function const too. (read_context::read_uint64_from_array_of_bytes): New function. Uses read_int_from_array_of_bytes above. (read_context::{fun_entry_addr_sym_map_sptr}): Try to load symbol maps only when it's necessary. (read_context::elf_architecture_is_big_endian): Fix logic. (read_context::{var_addr_sym_map}): Express the const variant in terms of the non-const one. In the non-const one, load the map only when necessary. (read_context::load_symbol_maps_from_symtab_section): Renamed load_symbol_maps into this. (read_context::is_linux_kernel_binary): Define new member function. (read_context::{function, variable}_symbol_is_exported): If we are not prevented from considering loading in linux kernel mode, then just looking at a linux kernel binary makes us consider the special kernel sections. (read_debug_info_into_corpus): Likewise. (build_ir_node_from_die): Take a new flag that says if the ir node is a declaration required by another concrete IR node. (enum read_context::kernel_symbol_table_kind): New enum. (read_context::load_symbol_maps): Support loading linux kernel specific sections too. (build_var_decl): Use the new read_context::variable_symbol_is_exported. (function_is_suppressed): Suppress non-member functions or variables that are not declarations and that have no symbol. (variable_is_suppressed, build_var_decl_if_not_suppressed): Take a new flag that says if the variable is a declaration required by a concrete variable. If non member variable that is a declaration is not the specification of another concrete variable, then it's suppressed. (add_fn_symbols_to_map, add_var_symbols_to_map): New function definitions. (read_debug_info_into_corpus): If we are reading linux kernel or linux kernel modules, only set explicitely exported symbols (in the linux kernel binary sense) as exported function or variable symbols. (create_read_context): Take a new flag to say if the context is to read an ELF binary in linux kernel mode. * tools/abidiff.cc (options::options): Initialize options::linux_kernel_mode to true. (display_usage): Display usage of the --no-linux-kernel-mode option. (parse_command_line): Parse the --no-linux-kernel-mode option. * tools/abidw.cc (options::options): Initialize options::linux_kernel_mode to true. (display_usage): Display usage of --no-linux-kernel-mode option. (parse_command_line): Parse the --no-linux-kernel-mode option. * doc/manuals/abidiff.rst: Document the new --no-linux-kernel-mode options. * doc/manuals/abidw.rst: Likewise. * tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Adjust. * tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.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/test20-pr19025-libvtkParallelCore-6.1.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/data/test-read-dwarf/libtest23.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Adjust. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
d198b27b64 |
Update copyright year on a bunch of files
* include/abg-corpus.h: Update copyright year to 2017. * src/abg-dwarf-reader.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-writer.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidw.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
2d53328bf4 |
Misc comments and apidoc fixes
* src/abg-dwarf-reader.cc (lookup_symbol_from_gnu_hash_tab): Fix typo in comment. * tools/abicompat.cc (perform_compat_check_in_weak_mode): Better comments. * tools/abidw.cc (dislay_usage): Fix white spaces. Signed-off-by: Dodji Seketeli <dodji@redhat.com> Conflicts: tools/abidw.cc |
||
|
98c8d61684 |
Drop suppressed ABI artifacts from the IR
This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
d78ad0e349 |
Add --verbose to abidw
* doc/manuals/abidw.rst: Update the manual for the new --verbose option. * tools/abidw.cc (options::do_log): New data member. (options::options): Initialize it. (display_usage): New string for --verbose. (parse_command_line): Parse the --verbose option. (main): Set the the logging option. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
c0bc52bab8 |
Update copyright information
* tools/abidiff.cc: Update copyright info for 2016. * tools/abidw.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
c2d32394b9 |
Emit more informational messages on unrecognized options
This is like what was done for abififf, but for abicompat, abidw, abipkgdiff and abilint. * tools/abicompat.cc (options::prog_name): New data member. (display_help, perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode, main): Prefix error messages with the name of the program. * tools/abidw.cc (options::wrong_option): New data member. (display_help): Prefix error messages with the name of the program.n (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abilint.cc (optionqs::wrong_option): New data member (display_usage): Prefix error messages with the name of the program. (parse_command_line): Record the name of the unrecognized option. (main): Tell the name of the unrecognized option. Prefix error messages with the name of the program. * tools/abipkgdiff.cc (options::{wrong_option, prog_name}): New data members. (package::erase_extraction_directory, display_usage, extract_rpm) (extract_deb, extract_tar) (erase_created_temporary_directories_parent, extract_package) (compare, create_maps_of_package_content): Prefix error messages with the name of the program. (maybe_check_suppression_files): Adjust. (parse_command_line): Record the name of the unrecognized option, and the name of option which lacks an operand. (main): Give the name of the unrecognized option. Prefix error messages with the name of the program. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
097a5c46ff |
Fix abidw -v
abidw -v was failing to work until now. This patch fixes that. * tools/abidw.cc (parse_command_line): Simplify logic. (main): Fix logic. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
6a7566d513 |
Add the option of printing the file, line and column information about a type being reported.
* bash-completion/abicompat: Complete the new "--no-show-locs" option. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abipkgdiff: Likewise. * doc/manuals/abicompat.rst: Mention the new "--no-show-locs" option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-comparison.h (show_locs): Add declarations. * src/abg-comparison.cc: (diff_context::priv): Add a new switch called "show_locs_" and set its default value to false. (report_loc_info): New function. Outputting the extra information is conditionalized based on the associated diff contexts settings. (show_locs): define a getter/setter for diff_context::priv::show_locs_. ({distinct,pointer,reference,qualified_type,enum,class,scope,fn_parm, typedef,corpus}_diff::report): Call report_loc_info when appropriate. (maybe_report_diff_for_member): Likewise. (represent): Accept a const reference to a diff_context_sptr as a first argument and call report_loc_info on its second argument. * src/abg-dwarf-reader.cc: * tests/data/Makefile.am: Add the new test reference files. * tests/data/test-abicompat/test0-fn-changed-report-2.txt: New test reference output. * tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise. * tests/test-abidiff.cc: Explicitly create a diff context and turn off location emitting. * tests/test-diff-dwarf.cc: Likewise. * tests/test-abicompat.cc: Add --no-show-locs to all existing test arguments. Run a few of the existing tests again, but without this option. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abicompat.cc: Handle the new "--no-show-locs" option. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> |
||
|
43c908ed15 |
Bug 19336 - Better handle redundantly qualified reference types
Sometimes we can see const references in DWARF. But then, a reference is always const, so that qualified reference is redundant. Furthermore, having that construct make its way into the internal representation can cause awkward diagnostics. The DWARF reader was thus eliding such redundant qualifiers in the function "maybe_strip_qualification". It was doing so by stripping the qualifier from the qualified type. So const reference, for instance, becomes a (non-qualified) reference. In that case, we are turning a qualified type into a non-qualified one. But as the accompanying problem report suggests, this can cause issues during the DWARF parsing. This is because a given Debug Information Entry (DIE) of qualified type kind can be referenced elsewhere, by another type. That other type expects that DIE to be a qualified type. And libabigail's DWARF reader code enforces that. So the internal representation of a type resulting from a qualified type DIE must be a qualified type itself. So the way the function "maybe_strip_qualification" was doing the redundancy elision was wrong. This patch fixes that by keeping the type qualified, but introducing a "no-op" qualifier. Actually, the IR already has that "no-op" qualifier: abigail::ir::qualified_type_def::CV_NONE. So now "maybe_strip_qualification" just turns the CV_CONST qualifier into a CV_NONE one when the former is redundant. Now that the libabigail type system actually *has* types qualified with this no-op qualifier, we need to handle things like printing the name of such qualified types. When we are printing the name of the type for internal reasons (i.e, for type canonicalization purposes) we need to make a difference between the name of a no-op qualified type and the name of the underlying type of the qualified type, otherwise, the canonicalizer wrongly considers the two types as being equal. But then when we are printing the name of the no-op qualified type for diagnostics reasons, then the name is the same as the name of its underlying unqualified type. * src/abg-dwarf-reader.cc (maybe_strip_qualification): Do not nuke the qualified type. Rather, just turn the redundant const qualifier into a no-op one. * src/abg-comparison.cc (compute_diff_for_types): Look through no-op qualified types. * include/abg-ir.h (decl_base::{peek,set}_temporary_qualified_name): Declare new accessors. * src/abg-ir.cc (decl_base::priv::temporary_qualified_name_): New data member. (decl_base::{peek,set}_temporary_qualified_name): Define new accessors. (qualified_type_def::priv::{temporary_internal_name_, internal_name}): New data members. (qualified_type_def::build_name): For a no-op qualified type, the internal name (which contains the 'none' qualifier) is different from the non-internal name. (qualified_type_def::get_qualified_name): Handle temporary names and non-temporary names in two different caches. Also handle internal and non-internal names in two different caches. This makes four different caches. (qualified_name_setter::do_update): Do not touch the non-internal, non-temporary qualified name cache if the qualified parent name is empty. * tools/abidw.cc (main): change --check-alternate-debug-info to make it *not* display the name/path to the alternate debug info, when it's found. Rather, only --check-alternate-debug-info-base-name keeps displaying the base name of the alternate debug info. * tests/data/test-alt-dwarf-file/test1-libgromacs-debug-dir/*: New test material. * tests/data/Makefile.am: Add the new test material to the build system. * tests/test-alt-dwarf-file.cc (in_out_specs): Take the new test input into account. * tests/data/test-read-dwarf/test1.abi: Adjust. * tests/data/test-read-dwarf/test7.so.abi: Likewise. * tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise. * tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise. * tests/data/test-read-dwarf/test15-pr18892.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/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
266fa9288e |
Add --version option to several libabigail tools
This patch changed the revision number of the libabigail library to make it reflect the fact that we are not in "release candidate" mode, before the first 1.0 release. So the revision number is now "rc0". The configuration manager has been updated to support version numbers that are strings, so that it can supports things like "rc0". Then, several libabigail tools have been modified to support the --version option to display their version number. * configure.ac: Set the version revision to "rc0". * doc/manuals/abicompat.rst: Adjust manual for new --version option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abilint.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-config.h (config::{m_format_minor, m_format_major}): Make these be strings. (config::{get,set}_format_minor_version_number): Make these return strings. (config::{get,set}_format_major_version_number): Make these return or take strings. (abigail_get_library_version): Make this take strings. * src/abg-config.cc (config::config): Adjust. (config::{get,set}_format_major_version_number): Make these return or take strings. (config::{get,set}_format_minor_version_number): Make these return strings. (abigail_get_library_version): Make this take strings. * include/abg-version.h.in: Make the version variables be strings. * src/abg-writer.cc (write_translation_unit): The version numbers are now strings so adjust. * tools/{abicompat,abidiff,abidw,abilint,abipkgdiff,abisym}.cc (options::display_version): New data member. (options::options): Initialize it. (display_usage): Add documentation for new --version option. (parse_command_line): Parse new --version option. (main): Support --version. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
|
6d4472066b |
Make abidw --abidiff not show definitely harmless changes
When comparing the ABI of the input ELF binary with that same ABI saved to abixml and read back again, there can be some minor and harmless changes that are seen, because libabigail makes some approximations for performance reasons. For instance, if there are two types that are equivalent, but have different names (because of typedefs) then libabigail will consider that they are the same type, and might save them (to abixml) and read them back (from abixml) in different order. That can lead to subtle changes that are reported (and filtered out) by the command "abidw --abixml". This patch arranges for abidw --abixml to avoid emitting a report saying that a filtered out change was detected, as those cases are considered OK. The patch also fixes a little issue where abidw would abort because the user forgot to provide the binary to analyze, on the command line. * tools/abidw.cc (set_diff_context): New function. (main): Use that new function. Do not show any output for --abidiff if only compatible changes were detected. Also, do not abort if no input binary was giving. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |