mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-25 19:22:07 +00:00
3153f4c83a
20 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
3153f4c83a |
Do not choke on AR archives
* tools/abg-tools-utils.h (file_type::FILE_TYPE_AR): New enumerator. * tools/abg-tools-utils.cc (guess_file_type): Recognize AR archive files. * tools/bidiff.cc (main): Support AR archives. * tools/bidw.cc (main): Likewise. * tools/bilint.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9ed00db0a2 |
Make bidiff filter output and display symbol names by default
* tools/bidiff.cc (options::options): Initialize options::show_linkage_names to true and options::show_harmful_changes to false. (parse_command_line): Change --linkage-names into --no-linkage-names as the linkage names are now displayed by default. Change --no-harmless into --harmless as harmless changes are now filtered by default. (display_usage): Update help string for the --linkage-names -> --no-linkage-names and --no-harmful -> --harmful change. * tests/test-diff-filter.cc: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
cf80e9d378 |
Support debug info files being outside the expected system directories
* include/abg-dwarf-reader.h (read_corpus_from_elf): Take a debug_info_root_path parameter. src/abg-dwarf-reader.cc (create_default_dwfl): Take a debug_info_root_path. Use that to initialize the Dwfl_Callbacks structure used by dwfl_begin. (create_default_dwfl_sptr, read_corpus_from_elf): Likewise, Take a debug_info_root_path parameter. * tests/test-diff-dwarf.cc (main): Adjust. * tests/test-read-dwarf.cc (main): Likewise. * tools/bidiff.cc (options::dir_root_path[12]): New member. (options::options): Initialize it. (display_usage): Add help string for the --debug-info-dir[12] options. (parse_command_line): Handle the new --debug-info-dir[12] options. (main): Pass the debug info directories to read_corpus_from_elf. * bidw.cc (options::::di_root_path): New member. (options::options): Initialize it. (display_usage): Add help string for the new --debug-info-dir option. (parse_command_line): Handle the new --debug-info-dir. (main): Pass the debug info root path to read_corpus_from_elf. * tools/bilint.cc (options::di_root_path): New member. (options::options): Initialize it. (display_usage): Add help string for the new --debug-info-dir. (parse_command_line): Handle --debug-info-dir command line option. (main): Pass the debug info root path to read_corpus_from_elf. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ce1278c3da |
Initial support for elf symbol (versionning) during decl comparison
* include/abg-fwd.h (get_linkage_name): Remove. * include/abg-dwarf-reader.h (enum symbol_type) (enum symbol_binding): Move these into abg-ir.h. (lookup_symbol_from_elf, lookup_public_function_symbol_from_elf): Adjust. * src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr): Declare this before using it. (die_address_attribute, die_location_address) (stt_to_elf_symbol_type, stb_to_elf_symbol_binding) (find_hash_table_section_index, find_symbol_table_section) (find_symbol_table_section_index, find_text_section) (find_bss_section, compare_symbol_name) (get_symbol_versionning_sections get_version_for_symbol) (lookup_symbol_from_sysv_hash_tab) (lookup_symbol_from_gnu_hash_tab, get_elf_class_size_in_bytes) (bloom_word_at, setup_gnu_ht, lookup_symbol_from_elf_hash_tab) (lookup_symbol_from_symtab, maybe_adjust_fn_sym_address) (maybe_adjust_var_sym_address): New static functions. (enum hash_table_kind): New enum. (struct gnu_ht): New struct. (read_context::var_decls_to_add_): Renamed var_decls_to_add into this. (read_context::{fun, var}_sym_addr_sym_index_map_): New member. (read_context::{lookup_symbol_from_elf, lookup_elf_symbol_from_index, lookup_elf_fn_symbol_from_address, lookup_elf_var_symbol_from_address, fun_sym_addr_sym_index_map, var_sym_addr_sym_index_map, load_symbol_addr_to_index_maps, get_function_address, get_variable_address}): New member functions. (read_context::lookup_public_{variable, function}_symbol_from_elf): Adjust. (op_pushes_constant_value): Fix a bug here. (lookup_symbol_from_elf): Adjust. Support cases where there is no elf hash table, e.g, for relocatable files. (lookup_public_function_symbol_from_elf) (lookup_public_variable_symbol_from_elf): Adjust. (build_var_decl): Allow updating the var_decl to associate it with its underlying symbol. In that case, if the linkage name is not set, set it to the symbol name. (build_function_decl): Likewise for function_decl. (operator<<(std::ostream&, symbol_type)): (operator<<(std::ostream&, symbol_binding)): Move these do abg-ir.cc. * include/abg-ir.h (class elf_symbol): Declare new class. Move enum symbol_binding and enum symbol_type (from abg-dwarf-reader.h) to elf_symbol::binding and elf_symbol::type here. (operator<<(std::ostream&, elf_symbol::type)) (operator<<(std::ostream&, elf_symbol::binding)) (operator==(const elf_symbol_sptr, const elf_symbol_sptr)): New operators. (class elf_symbol::version): Declare new class. (class var_decl): Make this pimpl, and add ... (var_decl::{g,s}et_symbol): ... new member functions. (class function_decl): Likewise, make this pimpl and add ... (function_decl::{g,s}et_symbol): ... new member functions. * src/abg-ir.cc (struct elf_symbol, elf_symbol::priv): New types. (elf_symbol::*): Lots of new members and member functions. (operator==(const elf_symbol_sptr, const elf_symbol_sptr)): New. (operator<<(std::ostream&, elf_symbol::type)): New. (operator<<(std::ostream&, elf_symbol::binding)): New. (elf_symbol::version::priv): New type. (elf_symbol::version::*): Lots of member functions. (get_linkage_name): Removed. (var_decl::priv): New type. Pimplify the thing. (var_decl::{s,g}et_symbol): New. (var_decl::operator==): Take symbols in account in the comparison. (function_decl::priv): New type. (function_decl::*): Pimplify. (function_decl::{s,g}et_symbol): New. (function_decl::operator==): Take symbols in account in the comparison. * include/abg-comparison.h (diff_context::show_linkage_name): New member function. * src/abg-comparison.cc (diff_context::priv::show_linkage_name_): New member. (diff_context::priv::priv): Initialize it. (diff_context::show_linkage_names): New member function. (corpus_diff::report): If the user used --show-linkage-names, display the linkage name after the name of the functions. Add missing "'" in the some spots. * tools/bidiff.cc (options.show_linkage_names): New member. (display_usage, parse_command_line): Support --linkage-names. * tools/bisym.cc (show_help): Add '\n' at the end of help string for --demangle. Add --no-absolute-path option. (parse_command_line): Support --no-absolute-path. (main): Adjust for symbol (versionning) support. Consider that the program successfully completed even when the symbol wasn't found. Support --no-absolute-path. * tests/data/test-lookup-syms/test0-report.txt: New. * tests/data/test-lookup-syms/test01-report.txt: New. * tests/data/test-lookup-syms/test02-report.txt: New. * tests/data/test-read-dwarf/test0.abi: Adjust. * tests/data/test-read-dwarf/test1.abi: Adjust. * tests/data/test-diff-dwarf/test7-report.txt: Adjust. * tests/data/test-diff-filter/test10-report.txt: Adjust. * tests/data/test-diff-filter/test12-report.txt: Adjust. * tests/data/test-lookup-syms/test1-[123]-report.txt: New. * tests/data/test-lookup-syms/test1.c: New. * tests/data/test-lookup-syms/test1.version-script: New. * tests/test-lookup-syms.cc: Adjust for new tests. * test/Makefile.am: Adjust makefile. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e4820f9e33 |
File static data member changes in STATIC_DATA_MEMBER_CHANGE_CATEGORY
* include/abg-comparison.h (diff_category::STATIC_DATA_MEMBER_CHANGE_CATEGORY): New category. (diff_category::EVERYTHING_CATEGORY): Update * src/abg-comp-filter.cc (static_data_member_type_size_changed) (static_data_member_added_or_removed): Define new static functions. (harmless_filter::visit): Categorize changes to static data members as STATIC_DATA_MEMBER_CHANGE_CATEGORY. * tools/bidiff.cc (set_diff_context_from_opts): STATIC_DATA_MEMBER_CHANGE_CATEGORY is falls into the harmless group. * tests/data/test-diff-filter/test12-report.txt: New test input. * tests/data/test-diff-filter/test12-v0.cc: Likewise. * tests/data/test-diff-filter/test12-v0.o: Likewise. * tests/data/test-diff-filter/test12-v1.cc: Likewise. * tests/data/test-diff-filter/test12-v1.o: Likewise. * tools/bidiff.cc: Run this test with the additional input data above. * tests/Makefile.am: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
305f18e91e |
Filter non-virtual member fns insertions/deletions from class changes
* include/abg-fwd.h (member_function_is_virtual): Declare new function. * include/abg-comparison.h (diff_category::{NON_VIRT_MEM_FUN_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY}): New enumerators. (diff_category::EVERYTHING_CATEGORY): Adjust. (class_diff::{changed, deleted, inserted}_member_fns): Declare new member functions. * src/abg-comp-filter.cc (data_member_added_or_removed): Add missing comments. (has_non_virtual_mem_fn_change): New static predicate function. (harmless_filter::visit): Categorize non-virtual member function changes in a diff into NON_VIRT_MEM_FUN_CHANGE_CATEGORY. * src/abg-comparison.cc (TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY): New macro. (report_mem_header): Count filtered functions for added/deleted functions as well. (class_diff::priv::count_filtered_changed_mem_fns): Renamed priv::count_filtered_member_functions into this. Filter out changes to non-virtual member functions here. (class_diff::priv::count_filtered_{inserted, deleted}_mem_fns): New member functions. (class_diff::{deleted, inserted, changed}_member_fns): Define new member functions. (class_diff::report): Adjust count for filtered inserted/deleted member functions. Do not report NON_VIRT_MEM_FUN_CHANGE_CATEGORY if it's disallowed. (class_diff::traverse): Propagate only VIRTUAL_MEMBER_CHANGE_CATEGORY from member functions to their enclosing class. * src/abg-ir.cc (member_function_is_virtual): Define new functions. * tools/bidiff.cc (set_diff_context_from_opts): Adjust to add NON_VIRT_MEM_FUN_CHANGE_CATEGORY into the harmless group and VIRTUAL_MEMBER_CHANGE_CATEGORY into the harmful one. * tests/data/test-diff-filter/test0-report.txt: New test input. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test10-v0.cc: Likewise. * tests/data/test-diff-filter/test10-v0.o: Likewise. * tests/data/test-diff-filter/test10-v1.cc: Likewise. * tests/data/test-diff-filter/test10-v1.o: Likewise. * tests/data/test-diff-filter/test11-report.txt: Likewise. * tests/data/test-diff-filter/test11-v0.cc: Likewise. * tests/data/test-diff-filter/test11-v0.o: Likewise. * tests/data/test-diff-filter/test11-v1.cc: Likewise. * tests/data/test-diff-filter/test11-v1.o: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-filter/test9-v0.cc: Likewise. * tests/data/test-diff-filter/test9-v0.o: Likewise. * tests/data/test-diff-filter/test9-v1.cc: Likewise. * tests/data/test-diff-filter/test9-v1.o: Likewise. * tests/test-diff-filter.cc: Consume the test input above to run more tests. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
23b7fa9ac2 |
Add a new DECL_NAME_CHANGE_CATEGORY change category
* include/abg-comparison.h (enum diff_category::DECL_NAME_CHANGE_CATEGORY): New enumerator. * src/abg-comparison.cc (report_name_size_and_alignment_changes) ({enum, typedef}_diff::report): Adjust to avoid emitting name change report if the DECL_NAME_CHANGE_CATEGORY category of change is currently disallowed. * abg-comp-filter.cc (decl_name_changed): New static function. (harmless_filter::visit): Detect that the decl name changed and put the current diff node (and its parents) into the DECL_NAME_CHANGE_CATEGORY category. * tools/bidiff.cc (set_diff_context_from_opts): Set the new DECL_NAME_CHANGE_CATEGORY category into the harmless_changes group of categories. * tests/data/test-diff-filter/test6-report.txt: New test input file. * tests/data/test-diff-filter/test6-v0.cc: Likewise. * tests/data/test-diff-filter/test6-v0.o: Likewise. * tests/data/test-diff-filter/test6-v1.cc: Likewise. * tests/data/test-diff-filter/test6-v1.o: Likewise. * tests/data/test-diff-filter/test7-report.txt: Likewise. * tests/data/test-diff-filter/test7-v0.cc: Likewise. * tests/data/test-diff-filter/test7-v0.o: Likewise. * tests/data/test-diff-filter/test7-v1.cc: Likewise. * tests/data/test-diff-filter/test7-v1.o: Likewise. * tests/test-diff-filter.cc: Take the new inputs above to run new tests. * tests/Makefile.am: Add the new files above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
64bbb5ccef |
Add a COMPATIBLE_TYPE_CHANGE_CATEGORY to bidiff --no-harmless
* include/abg-comparison.h (diff_category::COMPATIBLE_TYPE_CHANGE_CATEGORY): New enumerator. (operator|=(diff_category&, diff_category)): New declaration. * include/abg-fwd.h (is_typedef, strip_typedef) (types_are_compatible): New declarations. * include/abg-ir.h (operator==(const decl_base_sptr, const decl_base_sptr)): Added the consts here. (operator==(const type_base_sptr, const type_base_sptr)): New declaration. * src/abg-comp-filter.cc (is_compatible_change): New static function. (harmless_filter::visit): Detect compatible changes and add the sub-tree into the new COMPATIBLE_TYPE_CHANGE_CATEGORY if applicable. Cleanup the logic. * src/abg-comparison.cc (operator|=(diff_category&, diff_category)): Define new function. (operator==(const decl_base_sptr l, const decl_base_sptr r)): Add consts. (operator==(const type_base_sptr l, const type_base_sptr r)): Define new operator. (is_typedef, strip_typedef, types_are_compatible): New function definitions. * tests/data/test-diff-filter/test3-report.txt: New test report reference. * tests/data/test-diff-filter/test3-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test3-v0.o: New test input. * tests/data/test-diff-filter/test3-v1.cc: Source code for new test input. * tests/data/test-diff-filter/test3-v1.o: New test input. * tests/test-diff-filter.cc: Adjust to consume the new tests inputs above. * tools/bidiff.cc: Add the new COMPATIBLE_TYPE_CHANGE_CATEGORY into the --harmless group. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
67e6971005 |
Take filtering in account in diff stats & better categorizing
* include/abg-comparison.h (diff_category::ACCESS_CHANGE_CATEGORY): Renamed ACCESS_CHANGED_CATEGORY into this. (diff_category::SIZE_OR_OFFSET_CHANGE_CATEGORY): Renamed SIZE_CHANGED_CATEGORY into this. Changed its semantics to incorporate offset changes as well. * src/abg-comparison.cc (struct noop_deleter): Move this up. (represent): Do not report filtered out data members. (report_mem_header): Add a new num_filtered parameter to take filtered-out members in account in members report headers. Adjust. (class_diff::priv::{count_filtered_bases, count_filtered_data_members, count_filtered_member_functions}): New member functions. When a member is filtered, do not report it all. ({enum_diff, class_diff}::report): Adjust. Take filtered members into account in headers. (corpus_diff::priv::apply_filters_and_compute_diff_stats): New member function. (corpus_diff::priv::emit_diff_stats): Renamed emit_corpus_diff_stats into this. Change it to take the stats in parameter. (corpus_diff::report): Adjust to re-use the above. Filter varibles as well. Take the filtered functions & variables in account in the stats. Do not report filtered-out functions & variables at all. * src/abg-comp-filter.cc (type_size_changed, access_changed) (data_member_offset_changed): New predicates. ({harmless, harmful}_filter::visit): Adjust to use the new predicates above. Update the harmful variant for the new SIZE_OR_OFFSET_CHANGE_CATEGORY category. * tools/bidiff.cc (set_diff_context_from_opts): Adjust for the categories name changes. * tests/data/test-diff-filter/test0-report.txt: New test input. * tests/data/test-diff-filter/test0-v0.cc: Likewise. * tests/data/test-diff-filter/test0-v0.o: Likewise. * tests/data/test-diff-filter/test0-v1.cc: Likewise. * tests/data/test-diff-filter/test0-v1.o: Likewise. * tests/test-diff-filter.cc: New test harness. * tests/Makefile.am: Add the new test files above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
802f7cbc92 |
Initial implementation of diff tree node filtering
* include/abg-comp-filter.h: New file. * include/Makefile.am: Add the new include/abg-comp-filter.h to the source distribution. * include/abg-comparison.h (enum visiting_kind, diff_category): New enums. (operator|): Declare new operator declaration for the new visiting_kind enum. (operator{|,^,&,~}): Declare new operator decl for the new diff_category enum. (diff_context::{get_allowed_category, set_allowed_category, switch_categories_on, switch_categories_off, diff_filters, add_diff_filter, maybe_apply_filters}): Declare new member functions. (diff::{parent_, category_}): New members. (diff::diff): Adjust. (diff::{get_parent, set_parent, get_category, add_to_category, is_filtered_out, to_be_reported}): New members. (diff_node_visitor::{get_visiting_kind, set_visiting_kind}): New members. (diff_node_visitor::visit): Add a new flag to saying if the visitor is being called in post or pre children traversing mode. * src/abg-comparison.cc (operator|): Declare new operator declaration for the new visiting_kind enum. (operator{|,^,&,~}): Declare new operator decl for the new diff_category enum. (diff_context::priv::{allowed_category_, filters_}): New members. (diff_context::diff_context): Add all known filters. (diff_context::{get_allowed_category, set_allowed_category, switch_categories_on, switch_categories_off, diff_filters, add_diff_filter, maybe_apply_filters}): Define new member functions. (diff::{is_filtered_out, to_be_reported}): Define new members. (*::report): Use the new diff::to_be_reported function. (*::traverse): Adjust for pre/post visiting. (var_diff::var_diff): Chain the type diff node to its parent. ({pointer_diff, reference_diff, qualified_type_diff, typedef_diff}::underlying_type_diff): Chain the underlying type diff node to its parent. (enum_diff::enum_diff): Likewise. (base_diff::underlying_class_diff): Likewise. ({class_diff, corpus_diff}::report): Do not report changed (member) functions that have been filtered out. Rather report that they have been filtered out. ({function_decl_diff, class_diff}::traverse): Chain underlying type diff nodes to their parent. (diff_node_visitor::visit): Add a new flag to saying if the visitor is being called in post or pre children traversing mode. Make sure to call the default diff::visit overload. * src/abg-comp-filter.cc: New file. * src/Makefile.am: Add the new abg-comp-filter.cc to the source distribution. * tools/bidiff.cc (options::show_harm{ful,less}_changes): New members. (display_usage): Add usage strings for --no-harmless and --no-harmful options. (parse_command_line): Parse --no-harmless and --no-harmful command line options. (set_diff_context_from_opts): Populate the diff context accordingly. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bac732ff5a |
Add --drop/--keep options to bidiff
* include/abg-sptr-utils.h: New file. * include/Makefile.am: Add abg-sptr-utils. to the build system. * include/abg-libxml-utils.h (reader_sptr, xml_char_sptr): Remove these typedefs as there are now in abg-sptr-utils. (build_sptr): Likewise for this template and its specializations declarations. * src/abg-libxml-utils.cc (sptr_utils::build_sptr): Mode the definition of the specializations for xmlTextReader and xmlChar into the sptr_utils namespace. * include/abg-corpus.h (corpus::{get_regex_patterns_of_fns_to_suppress, get_regex_patterns_of_vars_to_suppress, get_regex_patterns_of_fns_to_keep, get_regex_patterns_of_vars_to_keep}): Declare new member functions. * src/abg-comparison.cc (sptr_utils::regex_t_deleter): Define new functor. (build_sptr) Define new specialization for regex_t. (struct array_deleter): Remove unused functor. (corpus::priv::regex_patterns_{fns,vars}_to_{suppress,keep}): New data members. (symtab_build_visitor_type::regex_patterns_{fns,vars}_to_{suppress,keep}): Likewise. (symtab_build_visitor_type::r_{fns,vars}_{suppress,keep})): Likewise. (symtab_build_visitor_type::symtab_build_visitor_type): Update the signature of this constructor to take regex patterns for functions and variables to suppress and to keep. Also, initialize the data members from these new parameters. (symtab_build_visitor_type::regex_{fns,vars}_{suppress,keep}): New member functions. (symtab_build_visitor_type::{add_fn_to_wip_fns, add_var_to_wip_vars}): Likewise. (symtab_build_visitor_type::visit) Use either add_fn_to_wip_fns or add_var_to_wip_vars depending on the overload of the visit() member. (corpus::priv::build_symbol_table): Update for the change of the symtab_build_visitor_type constructor signature. (corpus::get_regex_patterns_of_{fns,vars}_to_{suppress,keep}): Define new member functions. * tools/bidiff.cc (options::{drop,keep}_{fn,var}_regex_patterns}): New data member. (display_usage): Add help strings for --drop, --drop-fn, --drop-var, --keep, --keep-fn, --keep-var (parse_command_line): Parse the command lines above. (set_corpus_keep_drop_regex_patterns): Define new static function. (main): Use the new set_corpus_keep_drop_regex_patterns. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fde5a31a2a |
Add a --stat option to bidiff
* include/abg-comparison.h (diff_context::show_stats_only): Declare new accessors. * src/abg-comparison.cc (diff_context::priv::show_stats_only_): New member. (diff_context::show_stats_only): Define new accessors. (corpus_diff::report): If showing stats only, quit right after showing the summary. * tools/bidiff.cc (options::show_stats_only): New data member. (options::options): Initialize the new data member. (display_usage): Add help string for --stat. (parse_command_line): Parse the --stat option. (set_diff_context_from_opts): Update to set the show_stats_only onto the context. Cleanup the logic to make it more compact. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fd21fea696 |
Add --{changed,deleted,added}-{fns,vars} options to bidiff
* include/abg-comparison.h (diff_context::{show_{deleted,changed_added}_{fns,vars}}): Declare new accessors. (corpus_diff::context): Declare new getter. * src/abg-comparison.cc (diff_context::{show_{deleted,changed_added}_{fns,vars}}): Define these new accessors. (corpus_diff::priv::emit_corpus_diff_stats): Define new function. (corpus_diff::context()): Define new getter. (corpus_diff::report): Use the new corpus_diff::priv::emit_corpus_diff_stats to emit diff stats at the beginning of the report. Conditionalise emitting the different parts of the reports (changed,deleted,added stuff) on the values of the new properties that were just added. * tools/bidiff.cc (options::{show_{deleted,changed,added}_{fns,vars}): New properties. (display_usage, parse_command_line): Update for the newly added --{changed,deleted,added}-{fns,vars} command line options. (set_diff_context_from_opts): Define new static function. (main): Create a diff context, initialize it from the options (using set_diff_context_from_opts) and pass it to compute_diff. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7209295af9 |
Add --show-symtabs to bidiff
* tools/bidiff.cc (display_usage): Update usage string. (parse_command_line): Recognize the --show-symtab cmdline option. (display_symtabs): New static function. (main): Call the new display_symtabs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2c9fb3e70d |
Support new 'abi-corpus' native XML format (.abi)
* include/abg-reader.h (read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Declare new entry points. * include/abg-writer.h (write_corpus_to_native_xml) (write_corpus_to_native_xml_file): Likewise. * src/abg-reader.cc (read_translation_unit_from_input): Renamed read_input into this. Support new 'path' attribute for 'abi-instr' XML element. (read_corpus_from_input): New static function. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream): Update wrt read_input -> read_translation_unit_from_input. (read_corpus_from_native_xml, read_corpus_from_native_xml) (read_corpus_from_native_xml_file): Define new entry points. * src/abg-writer.cc (write_translation_unit): Write 'path' attribute into the 'abi-instr' xml element. (write_corpus_to_native_xml, write_corpus_to_native_xml_file): Define new entry points. * tools/abg-tools-utils.h (file_type::{FILE_TYPE_XML_CORPUS, FILE_TYPE_ZIP_CORPUS}): New enumerators. * tools/abg-tools-utils.cc (guess_file_type): Support detection of the new xml file format containing a document root 'abi-corpus' root element. * tools/bidiff.cc (main): Support diffing xml corpus-es and zip corpus-es. * tools/bidw.cc (main): Recognize elf files before reading them. * tools/bilint.cc (main): Support reading xml/zip corpus-es too. * tests/data/test-read-write/test[0-23].xml: Update 'path' attribute. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fbb6b1bc73 |
Initial support for diffing ABI corpus files
* include/abg-comparison.h (string_function_ptr_map) (changed_function_ptr, string_changed_function_ptr_map) (corpus_diff_sptr): New convenience typedefs. (translation_unit_diff): Add comments. (class corpus_diff): New type. (compute_diff): New overload for corpus_diff. * include/abg-corpus.h (corpus::{functions, variables}): New typedefs. (corpus::{operator==, get_functions, get_variables}): New members. * include/abg-diff-utils.h (struct deep_ptr_eq_functor): New functor. * include/abg-ir.h (translation_unit::operator==): New member equality operator. * src/abg-comparison.cc (struct corpus_diff::priv): New private struct holding the private members of corpus_diff. (corpus_diff::priv::{lookup_tables_empty, clear_lookup_tables, ensure_lookup_tables_populated}): Define new private member functions. (corpus_diff::{corpus_diff, first_corpus, second_corpus, function_changes, variable_changes, length, report}): New public members. (struct noop_deleter): New struct. (compute_diff): New implementation for corpus_diff. * src/abg-corpus.cc (struct corpus::priv): Renamed corpus::impl into this. Add new fns, vars and is_symbol_table_built data members. (corpus::priv::build_symbol_table): New member function. (class symtab_build_visitor_type): New visitor type to build the symbol table. (struct func_comp, struct var_comp): New comparison functors. (corpus::priv::build_symbol_table): Define new member function. (corpus::{corpus, add, get_translation_units, operator==, get_functions, get_variables}): Define new members. * src/abg-ir.cc (translation_unit::operator==): Define new member equality operator. (operator==(translation_unit_sptr l, translation_unit_sptr r)): Define new equality operator. * tools/abg-tools-utils.h (enum file_type): New enum. (guess_file_type): Declare new function. * tools/abg-tools-utils.cc (guess_file_type): define new function. * tools/bidiff.cc (main): Guess the type of the files given in input and support elf files reading and diffing. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6258b5f824 |
Prepare serialization API for multiple backends
* include/abg-reader.h: New file with abigail::xml_reader APIs. * include/abg-writer.h: New file with abigail::xml_writer APIs. * include/Makefile.am: Add the new files above to the source distribution. * src/abg-reader.cc: Update top-file comments. (namespace xml_reader): Rename namespace reader into this. (read_to_translation_unit, read_corpus_from_archive): New static functions. (read_translation_unit_from_file) (read_translation_unit_from_file, read_corpus_from_file): New entry points. (struct array_deleter): New functor. (translation_unit::read): Remove this. * src/abg-writer.cc: Update top file comments. (namespace xml_writer): Rename namespace writer into this. (struct archive_write_ctxt): New internal type. (create_archive_write_context, write_translation_unit_to_archive) (write_translation_unit, write_corpus_to_archive): New low level static functions overloads. (write_corpus_to_archive, write_translation_unit): Public higher level overloads. (translation_unit::write): Remove. (dump): Update for new xml_writer namespace. * include/abg-ir.h (translation_unit::{read, write}): Remove these serialization methods. * include/abg-corpus.h (corpus_sptr): New convenience typedef. (corpus::{read, write}): Remove these methods. * src/abg-corpus.cc (corpus::{read, write}) (corpus::impl::{serialized_tus, archive}): Remove these members. (corpus::impl::{get_archive, close_archive, write_tu_to_archive, read_to_translation_unit}): Remove these methods. * tests/test-bidiff.cc (main): Update for usage of the new xml_reader API. * tests/test-read-write.cc (main): Likewise. Update for the usage of the new xml_writer API, too. * tests/test-walker.cc (main): Update for the usage of the new xml_reader API. * tests/test-write-read-archive.cc (main): Likewise. And for the xml_writer API, too. * tools/biar.cc (add_tus_to_archive, extract_tus_from_archive): Likewise. * tools/bidiff.cc (main): Likewise, for xml_reader APIs. * tools/bilint.cc (main): Likewise, for xml_writer APIs, too. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1cdc283b1d |
Add diff support for typedef_decl and type_decl
* include/abg-ir.h (operator<<(std::ostream&, decl_base::visibility)): Declare new streaming operator. * src/abg-ir.cc (operator<<(std::ostream&, decl_base::visibility)): Define it. (type_decl::{operator==, get_pretty_representation}): Likewise, define these new overloads. (decl_base::{operator==, get_pretty_representation}): New overloads. * include/abg-comparison.h (type_decl_diff type_decl_diff_sptr, typedef_diff, typedef_diff_sptr): Declare new classes and typedefs. * src/abg-comparison.cc (type_decl_diff::{type_decl_diff, first_type_decl, second_type_decl, length, report}): New methods definitions. (compute_diff): New function definition that takes pointers of type_decl. (typedef_diff::{typedef_diff, first_typedef_decl, second_typedef_decl, underlying_type_diff, length, report}): New methods. (compute_diff): New function definition that takes pointers of typedef_decl. (try_to_diff_types): New template function, factorized out of ... (compute_diff_for_types): ... this. Add support diffing type_decl and typedef_decl. (pointer_diff::report): Fix indentation of emitted report. * tools/bidiff.cc (parse_command_line): Fix style. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
894df5bf01 |
Progress on diffing pointers, references and classes
* include/abg-comparison.h (diff::{first_subject,second_subject): Changed first_scope/second_scope into these; so that this diff class now works on stuff that are not scope. Changed the type of these to decl_base_sptr (diff::diff): Update for the change above. (diff::{length, report}): New virtual pure methods. (class pointer_diff, reference_diff): New classes declarations. (compute_diff): New overloads for the new classes above. Make the existing overloads take shared_pointers instead of references. Also make them return shared pointers of the computed diff, rather than just populating diff references passed in parameter. (class class_diff): Renamed class class_decl_diff into this. (report_changes): Change these functions into member functions. * src/abg-comparison.cc (compute_diff_for_types): New static function. (pointer_diff::pointer_diff, pointer_diff::first_pointer) (pointer_diff::second_pointer, pointer_diff::length) (pointer_diff::underlying_type_diff) (pointer_diff::underlying_type_diff, pointer_diff::report) (pointer_diff::report, compute_diff) (reference_diff::reference_diff, reference_diff::first_reference) (reference_diff::second_reference) (reference_diff::underlying_type_diff) (reference_diff::underlying_type_diff, reference_diff::length) (reference_diff::report, compute_diff): New functions. (class_diff::class_diff, class_diff::length) (class_diff::first_class_decl, class_diff::second_class_decl) (class_diff::base_changes, class_diff::base_changes) (class_diff::member_types_changes) (class_diff::member_types_changes) (class_diff::data_members_changes) (class_diff::data_members_changes, class_diff::member_fns_changes) (class_diff::member_fns_changes) (class_diff::member_fn_tmpls_changes) (class_diff::member_class_tmpls_changes) Update wrt class_decl_diff -> class_diff renaming. (class_diff::report): Make the report function be a member function. Add an indentation parameter. Add support for member types and data members. (compute_diff): New overload for class_decl_sptr. (scope_diff::first_scope, scope_diff::second_scope) (scope_diff::length, scope_diff::report): New member functions. (scope_diff::{deleted_member_at, inserted_member_at}): Update wrt first_scope -> first_subject change. (compute_diff): New overload for scope_decl_sptr. (translation_unit_diff::report): Change the report function into this member function. (compute_diff): Change the overload for translation_unit to take a translation_unit_sptr rather than a reference. * tools/bidiff.cc (main): Update this wrt the change of the signature of compute_diff. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
749611d2e8 |
Initial implementation of tu diffing & bidiff cmd line program
* include/abg-comparison.h (class translation_unit_diff): New type. (compute_diff): Make this take class_decl&, rather than class_decl_sptr. Add new overloads for scope_decl& and translation_unit&. (report_changes): New overload for scope_diff& and translation_unit&. * src/abg-comparison.cc (struct class_decl_diff::priv): New type. (class class_decl_diff): Add comments to methods. (class translation_unit_diff): Implement methods. (compute_diff, report_changes): Implement the new overloads. (scope_diff::ensure_lookup_tables_populated): Fix a thinko here. * src/abg-ir.cc (is_var_decl): Add new predicate. * tools/abg-tools-utils.h (file_exists, is_regular_file) (check_file): Declare new functions. * tools/abg-tools-utils.cc (get_stat, file_exists, check_file) (is_regular_file): Define new functions. (is_dir): Use the new get_stat. * tools/bidiff.cc: New file. * tools/Makefile.am: Add tools/bidiff.cc to the build system; make it produce the bidiff tool. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |