2013-10-11 15:19:29 +00:00
|
|
|
// -*- Mode: C++ -*-
|
|
|
|
//
|
2014-06-23 08:17:50 +00:00
|
|
|
// Copyright (C) 2013-2014 Red Hat, Inc.
|
2013-10-11 15:19:29 +00:00
|
|
|
//
|
|
|
|
// This file is part of the GNU Application Binary Interface Generic
|
|
|
|
// Analysis and Instrumentation Library (libabigail). This library is
|
|
|
|
// free software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU Lesser General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 3, or (at your option) any
|
|
|
|
// later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Lesser Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this program; see the file COPYING-LGPLV3. If
|
|
|
|
// not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
// Author: Dodji Seketeli
|
|
|
|
|
|
|
|
/// @file
|
|
|
|
|
|
|
|
#include <cstring>
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
#include <vector>
|
2013-10-11 15:19:29 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
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>
2014-03-27 10:03:53 +00:00
|
|
|
#include "abg-comp-filter.h"
|
2013-10-11 15:19:29 +00:00
|
|
|
#include "abg-tools-utils.h"
|
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>
2013-12-04 08:44:20 +00:00
|
|
|
#include "abg-reader.h"
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
#include "abg-dwarf-reader.h"
|
2013-10-11 15:19:29 +00:00
|
|
|
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
using std::vector;
|
2013-10-11 15:19:29 +00:00
|
|
|
using std::string;
|
|
|
|
using std::ostream;
|
|
|
|
using std::cout;
|
|
|
|
using std::cerr;
|
2014-06-04 14:30:18 +00:00
|
|
|
using std::tr1::shared_ptr;
|
2013-10-11 15:19:29 +00:00
|
|
|
using abigail::translation_unit;
|
|
|
|
using abigail::translation_unit_sptr;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
using abigail::corpus_sptr;
|
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>
2013-10-15 08:49:44 +00:00
|
|
|
using abigail::comparison::translation_unit_diff_sptr;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
using abigail::comparison::corpus_diff_sptr;
|
2013-10-11 15:19:29 +00:00
|
|
|
using abigail::comparison::compute_diff;
|
2014-06-04 14:30:18 +00:00
|
|
|
using namespace abigail::dwarf_reader;
|
2013-10-11 15:19:29 +00:00
|
|
|
using abigail::tools::check_file;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
using abigail::tools::guess_file_type;
|
2013-10-11 15:19:29 +00:00
|
|
|
|
|
|
|
struct options
|
|
|
|
{
|
2014-08-28 15:54:36 +00:00
|
|
|
bool display_usage;
|
|
|
|
bool missing_operand;
|
2014-05-22 11:14:44 +00:00
|
|
|
string file1;
|
|
|
|
string file2;
|
|
|
|
vector<string> drop_fn_regex_patterns;
|
|
|
|
vector<string> drop_var_regex_patterns;
|
|
|
|
vector<string> keep_fn_regex_patterns;
|
|
|
|
vector<string> keep_var_regex_patterns;
|
|
|
|
bool show_stats_only;
|
|
|
|
bool show_symtabs;
|
|
|
|
bool show_deleted_fns;
|
|
|
|
bool show_changed_fns;
|
|
|
|
bool show_added_fns;
|
|
|
|
bool show_all_fns;
|
|
|
|
bool show_deleted_vars;
|
|
|
|
bool show_changed_vars;
|
|
|
|
bool show_added_vars;
|
|
|
|
bool show_all_vars;
|
|
|
|
bool show_linkage_names;
|
|
|
|
bool show_harmful_changes;
|
|
|
|
bool show_harmless_changes;
|
2014-06-23 10:05:20 +00:00
|
|
|
bool show_redundant_changes;
|
2014-06-04 14:30:18 +00:00
|
|
|
shared_ptr<char> di_root_path1;
|
|
|
|
shared_ptr<char> di_root_path2;
|
2014-02-11 15:22:52 +00:00
|
|
|
|
|
|
|
options()
|
2014-08-28 15:54:36 +00:00
|
|
|
: display_usage(false),
|
|
|
|
missing_operand(false),
|
|
|
|
show_stats_only(false),
|
2014-02-28 12:03:53 +00:00
|
|
|
show_symtabs(false),
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
show_deleted_fns(false),
|
|
|
|
show_changed_fns(false),
|
|
|
|
show_added_fns(false),
|
|
|
|
show_all_fns(true),
|
|
|
|
show_deleted_vars(false),
|
|
|
|
show_changed_vars(false),
|
|
|
|
show_added_vars(false),
|
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>
2014-03-27 10:03:53 +00:00
|
|
|
show_all_vars(true),
|
2014-05-30 07:17:17 +00:00
|
|
|
show_linkage_names(true),
|
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>
2014-03-27 10:03:53 +00:00
|
|
|
show_harmful_changes(true),
|
2014-06-23 10:05:20 +00:00
|
|
|
show_harmless_changes(false),
|
|
|
|
show_redundant_changes(false)
|
2014-02-11 15:22:52 +00:00
|
|
|
{}
|
2013-10-11 15:19:29 +00:00
|
|
|
};//end struct options;
|
|
|
|
|
2014-07-05 20:17:01 +00:00
|
|
|
static void
|
|
|
|
display_usage(const string &prog_name, ostream& out)
|
2013-10-11 15:19:29 +00:00
|
|
|
{
|
2014-07-05 20:17:01 +00:00
|
|
|
out << "usage: " << prog_name << " [options] [<bi-file1> <bi-file2>]\n"
|
2013-10-11 15:19:29 +00:00
|
|
|
<< " where options can be:\n"
|
2014-05-22 11:14:44 +00:00
|
|
|
<< " --debug-info-dir1 <path> the root for the debug info of bi-file1\n"
|
|
|
|
<< " --debug-info-dir2 <path> the root for the debug info of bi-file2\n"
|
2014-02-28 12:03:53 +00:00
|
|
|
<< " --stat only display the diff stats\n"
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
<< " --symtabs only display the symbol tables of the corpora\n"
|
|
|
|
<< " --deleted-fns display deleted public functions\n"
|
|
|
|
<< " --changed-fns display changed public functions\n"
|
|
|
|
<< " --added-fns display added public functions\n"
|
|
|
|
<< " --deleted-vars display deleted global public variables\n"
|
|
|
|
<< " --changed-vars display changed global public variables\n"
|
|
|
|
<< " --added-vars display added global public variables\n"
|
2014-08-27 13:16:53 +00:00
|
|
|
<< " --no-linkage-name do not display linkage names of "
|
2014-05-30 07:17:17 +00:00
|
|
|
"added/removed/changed\n"
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
<< " --drop <regex> drop functions and variables matching a regexp\n"
|
|
|
|
<< " --drop-fn <regex> drop functions matching a regexp\n"
|
|
|
|
<< " --drop-fn <regex> drop functions matching a regexp\n"
|
|
|
|
<< " --drop-var <regex> drop variables matching a regexp\n"
|
|
|
|
<< " --keep <regex> keep only functions and variables matching a regex\n"
|
|
|
|
<< " --keep-fn <regex> keep only functions matching a regex\n"
|
2014-08-26 14:29:53 +00:00
|
|
|
<< " --keep-var <regex> keep only variables matching a regex\n"
|
|
|
|
<< " --harmless display the harmless changes\n"
|
|
|
|
<< " --no-harmful do not display the harmful changes\n"
|
2014-06-23 10:05:20 +00:00
|
|
|
<< " --redundant display redundant changes\n"
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
<< " --help display this message\n";
|
2013-10-11 15:19:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Parse the command line and set the options accordingly.
|
|
|
|
///
|
|
|
|
/// @param argc the number of words on the command line
|
|
|
|
///
|
|
|
|
/// @param argv the command line, which is an array of words.
|
|
|
|
///
|
|
|
|
/// @param opts the options data structure. This is set by the
|
|
|
|
/// function iff it returns true.
|
|
|
|
///
|
|
|
|
/// @return true if the command line could be parsed and opts filed,
|
|
|
|
/// false otherwise.
|
|
|
|
bool
|
|
|
|
parse_command_line(int argc, char* argv[], options& opts)
|
|
|
|
{
|
|
|
|
if (argc < 2)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; ++i)
|
|
|
|
{
|
|
|
|
if (argv[i][0] != '-')
|
|
|
|
{
|
|
|
|
if (opts.file1.empty())
|
|
|
|
opts.file1 = argv[i];
|
|
|
|
else if (opts.file2.empty())
|
|
|
|
opts.file2 = argv[i];
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
2014-05-22 11:14:44 +00:00
|
|
|
else if (!strcmp(argv[i], "--debug-info-dir1"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
2014-06-04 14:30:18 +00:00
|
|
|
// elfutils wants the root path to the debug info to be
|
|
|
|
// absolute.
|
|
|
|
opts.di_root_path1 = abigail::tools::make_path_absolute(argv[j]);
|
2014-05-22 11:14:44 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--debug-info-dir2"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
2014-06-04 14:30:18 +00:00
|
|
|
// elfutils wants the root path to the debug info to be
|
|
|
|
// absolute.
|
|
|
|
opts.di_root_path2 = abigail::tools::make_path_absolute(argv[j]);
|
2014-05-22 11:14:44 +00:00
|
|
|
++i;
|
|
|
|
}
|
2014-02-28 12:03:53 +00:00
|
|
|
else if (!strcmp(argv[i], "--stat"))
|
|
|
|
opts.show_stats_only = true;
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
else if (!strcmp(argv[i], "--symtabs"))
|
2014-02-11 15:22:52 +00:00
|
|
|
opts.show_symtabs = true;
|
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>
2013-11-19 09:58:56 +00:00
|
|
|
else if (!strcmp(argv[i], "--help"))
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.display_usage = true;
|
|
|
|
return true;
|
|
|
|
}
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
else if (!strcmp(argv[i], "--deleted-fns"))
|
|
|
|
{
|
|
|
|
opts.show_deleted_fns = true;
|
|
|
|
opts.show_all_fns = false;
|
|
|
|
opts.show_all_vars = false;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--changed-fns"))
|
|
|
|
{
|
|
|
|
opts.show_changed_fns = true;
|
|
|
|
opts.show_all_fns = false;
|
|
|
|
opts.show_all_vars = false;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--added-fns"))
|
|
|
|
{
|
|
|
|
opts.show_added_fns = true;
|
|
|
|
opts.show_all_fns = false;
|
|
|
|
opts.show_all_vars = false;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--deleted-vars"))
|
|
|
|
{
|
|
|
|
opts.show_deleted_vars = true;
|
|
|
|
opts.show_all_fns = false;
|
|
|
|
opts.show_all_vars = false;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--changed-vars"))
|
|
|
|
{
|
|
|
|
opts.show_changed_vars = true;
|
|
|
|
opts.show_all_fns = false;
|
|
|
|
opts.show_all_vars = false;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--added-vars"))
|
|
|
|
{
|
|
|
|
opts.show_added_vars = true;
|
|
|
|
opts.show_all_fns = false;
|
|
|
|
opts.show_all_vars = false;
|
|
|
|
}
|
2014-08-27 13:16:53 +00:00
|
|
|
else if (!strcmp(argv[i], "--no-linkage-name"))
|
2014-05-30 07:17:17 +00:00
|
|
|
opts.show_linkage_names = false;
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
else if (!strcmp(argv[i], "--drop"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
|
|
|
return false;
|
|
|
|
opts.drop_fn_regex_patterns.push_back(argv[j]);
|
|
|
|
opts.drop_var_regex_patterns.push_back(argv[j]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--drop-fn"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
opts.drop_fn_regex_patterns.push_back(argv[j]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--drop-var"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
opts.drop_var_regex_patterns.push_back(argv[j]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--keep"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
opts.keep_fn_regex_patterns.push_back(argv[j]);
|
|
|
|
opts.keep_var_regex_patterns.push_back(argv[j]);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--keep-fn"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
opts.keep_fn_regex_patterns.push_back(argv[j]);
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "--keep-var"))
|
|
|
|
{
|
|
|
|
int j = i + 1;
|
|
|
|
if (j >= argc)
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
opts.missing_operand = true;
|
|
|
|
return true;
|
|
|
|
}
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
opts.keep_var_regex_patterns.push_back(argv[j]);
|
|
|
|
}
|
2014-05-30 07:17:17 +00:00
|
|
|
else if (!strcmp(argv[i], "--harmless"))
|
|
|
|
opts.show_harmless_changes = true;
|
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>
2014-03-27 10:03:53 +00:00
|
|
|
else if (!strcmp(argv[i], "--no-harmful"))
|
|
|
|
opts.show_harmful_changes = false;
|
2014-06-23 10:05:20 +00:00
|
|
|
else if (!strcmp(argv[i], "--redundant"))
|
|
|
|
opts.show_redundant_changes = true;
|
2013-10-11 15:19:29 +00:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-02-11 15:22:52 +00:00
|
|
|
/// Display the function symbol tables for the two corpora.
|
|
|
|
///
|
|
|
|
/// @param c1 the first corpus to display the symbol table for.
|
|
|
|
///
|
|
|
|
/// @param c2 the second corpus to display the symbol table for.
|
|
|
|
///
|
|
|
|
/// @param o the output stream to emit the symbol tables to.
|
|
|
|
static void
|
|
|
|
display_symtabs(const corpus_sptr c1, const corpus_sptr c2, ostream& o)
|
|
|
|
{
|
|
|
|
o << "size of the functions symtabs: "
|
|
|
|
<< c1->get_functions().size()
|
|
|
|
<< " and "
|
|
|
|
<< c2->get_functions().size()
|
|
|
|
<< "\n\n";
|
|
|
|
|
|
|
|
if (c1->get_functions().size())
|
|
|
|
o << "First functions symbol table\n\n";
|
|
|
|
for (abigail::corpus::functions::const_iterator i =
|
|
|
|
c1->get_functions().begin();
|
|
|
|
i != c1->get_functions().end();
|
|
|
|
++i)
|
|
|
|
o << (*i)->get_pretty_representation() << std::endl;
|
|
|
|
|
|
|
|
if (c1->get_functions().size() != 0)
|
|
|
|
o << "\n";
|
|
|
|
|
|
|
|
if (c2->get_functions().size())
|
|
|
|
o << "Second functions symbol table\n\n";
|
|
|
|
for (abigail::corpus::functions::const_iterator i =
|
|
|
|
c2->get_functions().begin();
|
|
|
|
i != c2->get_functions().end();
|
|
|
|
++i)
|
|
|
|
o << (*i)->get_pretty_representation() << std::endl;
|
|
|
|
}
|
|
|
|
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
using abigail::comparison::diff_context_sptr;
|
|
|
|
using abigail::comparison::diff_context;
|
|
|
|
|
|
|
|
/// Update the diff context from the @ref options data structure.
|
|
|
|
///
|
|
|
|
/// @param ctxt the diff context to update.
|
|
|
|
///
|
|
|
|
/// @param opts the instance of @ref options to consider.
|
|
|
|
static void
|
|
|
|
set_diff_context_from_opts(diff_context_sptr ctxt,
|
|
|
|
options& opts)
|
|
|
|
{
|
2014-02-28 12:03:53 +00:00
|
|
|
ctxt->show_stats_only(opts.show_stats_only);
|
|
|
|
ctxt->show_deleted_fns(opts.show_all_fns || opts.show_deleted_fns);
|
|
|
|
ctxt->show_changed_fns(opts.show_all_fns || opts.show_changed_fns);
|
|
|
|
ctxt->show_added_fns(opts.show_all_fns || opts.show_added_fns);
|
|
|
|
ctxt->show_deleted_vars(opts.show_all_vars || opts.show_deleted_vars);
|
|
|
|
ctxt->show_changed_vars(opts.show_all_vars || opts.show_changed_vars);
|
|
|
|
ctxt->show_added_vars(opts.show_all_vars || opts.show_added_vars);
|
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>
2014-05-08 09:31:57 +00:00
|
|
|
ctxt->show_linkage_names(opts.show_linkage_names);
|
2014-06-23 10:05:20 +00:00
|
|
|
ctxt->show_redundant_changes(opts.show_redundant_changes);
|
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>
2014-03-27 10:03:53 +00:00
|
|
|
|
|
|
|
if (!opts.show_harmless_changes)
|
2014-04-13 21:09:02 +00:00
|
|
|
ctxt->switch_categories_off
|
|
|
|
(abigail::comparison::ACCESS_CHANGE_CATEGORY
|
|
|
|
| abigail::comparison::COMPATIBLE_TYPE_CHANGE_CATEGORY
|
2014-08-22 15:19:27 +00:00
|
|
|
| abigail::comparison::HARMLESS_DECL_NAME_CHANGE_CATEGORY
|
2014-04-17 09:18:21 +00:00
|
|
|
| abigail::comparison::NON_VIRT_MEM_FUN_CHANGE_CATEGORY
|
|
|
|
| abigail::comparison::STATIC_DATA_MEMBER_CHANGE_CATEGORY);
|
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>
2014-03-27 10:03:53 +00:00
|
|
|
if (!opts.show_harmful_changes)
|
2014-04-13 21:09:02 +00:00
|
|
|
ctxt->switch_categories_off
|
|
|
|
(abigail::comparison::SIZE_OR_OFFSET_CHANGE_CATEGORY
|
|
|
|
| abigail::comparison::VIRTUAL_MEMBER_CHANGE_CATEGORY);
|
2014-02-28 12:03:53 +00:00
|
|
|
}
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
/// Set the regex patterns describing the functions to drop from the
|
|
|
|
/// symbol table of a given corpus.
|
|
|
|
///
|
|
|
|
/// @param opts the options to the regex patterns from.
|
|
|
|
///
|
|
|
|
/// @param c the corpus to set the regex patterns into.
|
|
|
|
static void
|
|
|
|
set_corpus_keep_drop_regex_patterns(options& opts, corpus_sptr c)
|
|
|
|
{
|
|
|
|
if (!opts.drop_fn_regex_patterns.empty())
|
|
|
|
{
|
|
|
|
vector<string>& v = opts.drop_fn_regex_patterns;
|
|
|
|
vector<string>& p = c->get_regex_patterns_of_fns_to_suppress();
|
|
|
|
p.assign(v.begin(), v.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!opts.keep_fn_regex_patterns.empty())
|
|
|
|
{
|
|
|
|
vector<string>& v = opts.keep_fn_regex_patterns;
|
|
|
|
vector<string>& p = c->get_regex_patterns_of_fns_to_keep();
|
|
|
|
p.assign(v.begin(), v.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!opts.drop_var_regex_patterns.empty())
|
|
|
|
{
|
|
|
|
vector<string>& v = opts.drop_var_regex_patterns;
|
|
|
|
vector<string>& p = c->get_regex_patterns_of_vars_to_suppress();
|
|
|
|
p.assign(v.begin(), v.end());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!opts.keep_var_regex_patterns.empty())
|
|
|
|
{
|
|
|
|
vector<string>& v = opts.keep_var_regex_patterns;
|
|
|
|
vector<string>& p = c->get_regex_patterns_of_vars_to_keep();
|
|
|
|
p.assign(v.begin(), v.end());
|
|
|
|
}
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
}
|
|
|
|
|
2013-10-11 15:19:29 +00:00
|
|
|
int
|
|
|
|
main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
options opts;
|
|
|
|
if (!parse_command_line(argc, argv, opts))
|
2014-08-28 15:54:36 +00:00
|
|
|
{
|
|
|
|
cerr << "unrecognized option\n"
|
|
|
|
"try the --help option for more information\n";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opts.missing_operand)
|
|
|
|
{
|
|
|
|
cerr << "missing operand\n"
|
|
|
|
"try the --help option for more information\n";
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opts.display_usage)
|
2013-10-11 15:19:29 +00:00
|
|
|
{
|
2014-08-26 14:29:53 +00:00
|
|
|
display_usage(argv[0], cout);
|
2013-10-11 15:19:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!opts.file1.empty() && !opts.file2.empty())
|
|
|
|
{
|
|
|
|
if (!check_file(opts.file1, cerr))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (!check_file(opts.file2, cerr))
|
|
|
|
return true;
|
|
|
|
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
abigail::tools::file_type t1_type, t2_type;
|
2013-10-11 15:19:29 +00:00
|
|
|
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
t1_type = guess_file_type(opts.file1);
|
|
|
|
if (t1_type == abigail::tools::FILE_TYPE_UNKNOWN)
|
|
|
|
{
|
|
|
|
cerr << "Unknown content type for file " << opts.file1 << "\n";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
t2_type = guess_file_type(opts.file2);
|
|
|
|
if (t2_type == abigail::tools::FILE_TYPE_UNKNOWN)
|
|
|
|
{
|
|
|
|
cerr << "Unknown content type for file " << opts.file2 << "\n";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
translation_unit_sptr t1, t2;
|
2014-06-04 14:30:18 +00:00
|
|
|
abigail::dwarf_reader::status c1_status =
|
|
|
|
abigail::dwarf_reader::STATUS_OK,
|
|
|
|
c2_status = abigail::dwarf_reader::STATUS_OK;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
corpus_sptr c1, c2;
|
2014-06-04 14:30:18 +00:00
|
|
|
char *di_dir1 = 0, *di_dir2 = 0;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
|
|
|
|
switch (t1_type)
|
|
|
|
{
|
|
|
|
case abigail::tools::FILE_TYPE_UNKNOWN:
|
|
|
|
cerr << "Unknown content type for file " << opts.file1 << "\n";
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
case abigail::tools::FILE_TYPE_NATIVE_BI:
|
|
|
|
t1 = abigail::xml_reader::read_translation_unit_from_file(opts.file1);
|
|
|
|
break;
|
|
|
|
case abigail::tools::FILE_TYPE_ELF:
|
2014-06-02 15:05:05 +00:00
|
|
|
case abigail::tools::FILE_TYPE_AR:
|
2014-06-04 14:30:18 +00:00
|
|
|
di_dir1 = opts.di_root_path1.get();
|
|
|
|
c1_status = abigail::dwarf_reader::read_corpus_from_elf(opts.file1,
|
|
|
|
&di_dir1, c1);
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
break;
|
2014-01-07 13:12:26 +00:00
|
|
|
case abigail::tools::FILE_TYPE_XML_CORPUS:
|
|
|
|
c1 =
|
|
|
|
abigail::xml_reader::read_corpus_from_native_xml_file(opts.file1);
|
|
|
|
break;
|
|
|
|
case abigail::tools::FILE_TYPE_ZIP_CORPUS:
|
2014-08-31 08:34:11 +00:00
|
|
|
#ifdef WITH_ZIP_ARCHIVE
|
2014-01-07 13:12:26 +00:00
|
|
|
c1 = abigail::xml_reader::read_corpus_from_file(opts.file1);
|
2014-08-31 08:34:11 +00:00
|
|
|
#endif //WITH_ZIP_ARCHIVE
|
2014-01-07 13:12:26 +00:00
|
|
|
break;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
}
|
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>
2013-12-04 08:44:20 +00:00
|
|
|
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
switch (t2_type)
|
|
|
|
{
|
|
|
|
case abigail::tools::FILE_TYPE_UNKNOWN:
|
|
|
|
cerr << "Unknown content type for file " << opts.file2 << "\n";
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
case abigail::tools::FILE_TYPE_NATIVE_BI:
|
|
|
|
t2 = abigail::xml_reader::read_translation_unit_from_file(opts.file2);
|
|
|
|
break;
|
|
|
|
case abigail::tools::FILE_TYPE_ELF:
|
2014-06-02 15:05:05 +00:00
|
|
|
case abigail::tools::FILE_TYPE_AR:
|
2014-06-04 14:30:18 +00:00
|
|
|
di_dir2 = opts.di_root_path2.get();
|
|
|
|
c2_status = abigail::dwarf_reader::read_corpus_from_elf(opts.file2,
|
|
|
|
&di_dir2, c2);
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
break;
|
2014-01-07 13:12:26 +00:00
|
|
|
case abigail::tools::FILE_TYPE_XML_CORPUS:
|
|
|
|
c2 =
|
|
|
|
abigail::xml_reader::read_corpus_from_native_xml_file(opts.file2);
|
|
|
|
break;
|
|
|
|
case abigail::tools::FILE_TYPE_ZIP_CORPUS:
|
2014-08-31 08:34:11 +00:00
|
|
|
#ifdef WITH_ZIP_ARCHIVE
|
2014-01-07 13:12:26 +00:00
|
|
|
c2 = abigail::xml_reader::read_corpus_from_file(opts.file2);
|
2014-08-31 08:34:11 +00:00
|
|
|
#endif //WITH_ZIP_ARCHIVE
|
2014-01-07 13:12:26 +00:00
|
|
|
break;
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!t1 && !c1)
|
2013-10-11 15:19:29 +00:00
|
|
|
{
|
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>
2013-12-04 08:44:20 +00:00
|
|
|
cerr << "failed to read input file " << opts.file1 << "\n";
|
2014-06-04 14:30:18 +00:00
|
|
|
if (c1_status != abigail::dwarf_reader::STATUS_OK)
|
|
|
|
{
|
|
|
|
switch (c1_status)
|
|
|
|
{
|
|
|
|
case abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND:
|
|
|
|
cerr << "could not find the debug info";
|
|
|
|
if(di_dir1 == 0)
|
|
|
|
cerr << " Maybe you should consider using the "
|
|
|
|
"--debug-info-dir1 option to tell me about the "
|
|
|
|
"root directory of the debuginfo? "
|
|
|
|
"(e.g, --debug-info-dir1 /usr/lib/debug)\n";
|
|
|
|
else
|
|
|
|
cerr << "Maybe the root path to the debug information '"
|
|
|
|
<< di_dir1 << "' is wrong?\n";
|
|
|
|
break;
|
|
|
|
case abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND:
|
|
|
|
cerr << "could not find the ELF symbols in the file '"
|
|
|
|
<< opts.file1
|
|
|
|
<< "'\n";
|
|
|
|
break;
|
|
|
|
case abigail::dwarf_reader::STATUS_OK:
|
|
|
|
// This cannot be!
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2013-10-11 15:19:29 +00:00
|
|
|
}
|
|
|
|
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
if (!t2 && !c2)
|
2013-10-11 15:19:29 +00:00
|
|
|
{
|
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>
2013-12-04 08:44:20 +00:00
|
|
|
cerr << "failed to read input file" << opts.file2 << "\n";
|
2014-06-04 14:30:18 +00:00
|
|
|
if (c2_status != abigail::dwarf_reader::STATUS_OK)
|
|
|
|
{
|
|
|
|
switch (c2_status)
|
|
|
|
{
|
|
|
|
case abigail::dwarf_reader::STATUS_DEBUG_INFO_NOT_FOUND:
|
|
|
|
cerr << "could not find the debug info";
|
|
|
|
if(di_dir2 == 0)
|
|
|
|
cerr << " Maybe you should consider using the "
|
|
|
|
"--debug-info-dir1 option to tell me about the "
|
|
|
|
"root directory of the debuginfo? "
|
|
|
|
"(e.g, --debug-info-dir1 /usr/lib/debug)\n";
|
|
|
|
else
|
|
|
|
cerr << "Maybe the root path to the debug information '"
|
|
|
|
<< di_dir2
|
|
|
|
<< "' is wrong?\n";
|
|
|
|
break;
|
|
|
|
case abigail::dwarf_reader::STATUS_NO_SYMBOLS_FOUND:
|
|
|
|
cerr << "could not find the ELF symbols in the file '"
|
|
|
|
<< opts.file2
|
|
|
|
<< "'\n";
|
|
|
|
break;
|
|
|
|
case abigail::dwarf_reader::STATUS_OK:
|
|
|
|
// This cannot be!
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2013-10-11 15:19:29 +00:00
|
|
|
}
|
|
|
|
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
if (!!c1 != !!c2
|
|
|
|
|| !!t1 != !!t2)
|
|
|
|
{
|
|
|
|
cerr << "the two input should be of the same kind\n";
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t1)
|
|
|
|
{
|
|
|
|
translation_unit_diff_sptr changes = compute_diff(t1, t2);
|
2014-08-28 15:52:12 +00:00
|
|
|
if (changes->length() > 0)
|
|
|
|
changes->report(cout);
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
}
|
|
|
|
else if (c1)
|
|
|
|
{
|
2014-02-11 15:22:52 +00:00
|
|
|
if (opts.show_symtabs)
|
|
|
|
{
|
|
|
|
display_symtabs(c1, c2, cout);
|
|
|
|
return false;
|
|
|
|
}
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
|
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>
2014-02-28 16:26:18 +00:00
|
|
|
set_corpus_keep_drop_regex_patterns(opts, c1);
|
|
|
|
set_corpus_keep_drop_regex_patterns(opts, c2);
|
|
|
|
|
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>
2014-02-12 15:42:14 +00:00
|
|
|
diff_context_sptr ctxt(new diff_context);
|
|
|
|
set_diff_context_from_opts(ctxt, opts);
|
|
|
|
corpus_diff_sptr changes = compute_diff(c1, c2, ctxt);
|
2014-08-28 15:52:12 +00:00
|
|
|
if (changes->length() > 0)
|
|
|
|
changes->report(cout);
|
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>
2013-12-23 13:05:19 +00:00
|
|
|
}
|
2013-10-11 15:19:29 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|