mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-23 18:22:08 +00:00
7bd6983052
This patch is a reorganization of the code to better support the need for having several different front-ends. In the libabigail pipeline of operation, a front-end is the part of the pipeline that analyses the input file. For instance, to analyse an ELF file, there is going to be one front-end. To analyse an ABIXML file, there is going to be another front-end. The middle-end is the part of the pipeline that interacts with the internal representation of ABIs. The middle-end knows how to analyse, compare ABI corpora provide an internal representation of the comparison result and analyse it as well. The back-end would be the part of the front-end that knows how to serialize internal representations of ABIs and ABI comparison results. One could thus imagine a front-end that understands the DWARF debug info format embedded in an ELF file. Another front-end would be dedicated to the CTF debug info format, and so on. Front-ends can share capabilities. For instance, DWARF and CTF front-ends are ELF based front end. As such, they share capabilities to understand the ELF format. They don't share much with the ABIXML front-end, however, as it's based on XML, which has almost nothing in common with ELF. To support this organization of concepts, this patch introduces a new hierarchy of types in the form of C++ classes. All front-ends implements the "Front End Interface". As such, they all inherit the abigail::fe_iface class. That class provides properties and behaviours that are shared by all front-ends that libabigail supports today. Namely, that class provides access to some of the options that are relevant to operating the front-end, to the ABI corpus or corpus group being constructed and to the suppression specifications that are considered. It also provides an abstract interface to perform the actual loading of the ABI corpus. That abstract interface has to be implemented by every single concrete front-end that is provided in libabigail. Then, there is the "ELF Reader" front-end. Its class name is abigail:🧝:reader. It inherits the abigail::fe_iface class and implements the fe_iface::load_corpus() so that the ELF properties of the ELF file be loaded and exposed in the ABI corpus as returned by the fe_iface::corpus() accessor. This ELF reader front-end also provides lots of capabilities that are specific to accessing ELF content. Then, there is a common base class for ELF-based front-ends to come, named abigail::elf_based_reader, which inherits the abigail:🧝:reader class. The purpose of this base class is to provide common properties and behaviours that are necessary to implement things like a DWARF or a CTF front-end, or any other front-end to support an ELF-based debug info format. Then, there is a CTF front-end which class is named abigail::ctf::reader. It inherits the abigail::elf_based_reader class and implements the fe_iface::load_corpus() interface to load and analyse the CTF-specific properties of the ELF file. To do this, abigail::ctf::reader::load_corpus() re-uses the abigail:🧝:load_corpus() member function to load the generic ELF parts of the ABI corpus. This reader then constructs the internal representation of the ABI corpus and passes it to the middle-end for further analysis. Then, there is a DWARF front-end which class is named abigail::dwarf::reader. It inherits the abigail::elf_based_reader class and implements the fe_iface::load_corpus() interface to load and analyse the DWARF-specific properties of the ELF file. To do this, abigail::dwarf::reader re-uses the abigail:🧝:load_corpus() member function to load the generic ELF parts of the ABI corpus, just like what the CTF front-end does. And then, just like the CTF front-end, this reader then constructs the internal representation of the ABI corpus and passes it to the middle-end for further analysis. Lastly, there is an ABIXML front-end which class is named abigail::abixml::reader. It inherits the abigail::fe_iface class directly. Note that unlike the two previous front-ends, this one doesn't inherit the elf_based_reader base class, for reasons that should be obvious to the astute reader by now. So, this front-end implements the abigail::fe_iface::load_corpus() abstract interface to load the properties for the ABI corpus represented in the ABIXML format, construct the internal representation and pass it to the middle-end for further analysis. The code of the tools got adapted to use these front-ends. The support of CTF is still guarded by #ifdef WITH_CTF pre-processor macros, but the one cool side effect is that the amount of guarded code is reduced. Basically, it's only the creation of the CTF front-end that is guarded. After its creation, what is returned is an instance of abigail::elf_based_reader::reader, exactly like what is returned by the creation of a DWARF front-end. Thus, the rest of the code is exactly the same, regardless of the kind of front-end. I believe this results in a more elegant and maintainable code. As a proof-of-concept, this patch also provides the create_best_elf_based_reader function. This function analyses the ELF file and depending on the kind of debug info it provides, returns the right front-end for it. Maybe at some point, all the #ifdef WITH_CTF guard pre-processing macros will be constrained in a single function like this one that will take the decision of instantiating the right front-end. The rest of the code will be as generic as it gets. The patch adjusts the reference abixml files produced by the CTF front-end because it now emits the <elf-needed> XML element which was not emitted before. This is done because the CTF front-end inherits the elf-reader which reads the "elf-needed" property from the binary, without explicit intervention from the CTF front-end. The patch passes 'make distcheck' on all the supported platforms. * include/abg-fwd.h (build_internal_underlying_enum_type_name): Move this here from src/abg-dwarf-reader.cc. * include/abg-elf-reader-common.h: Delete this file. Its content is going to be put in the new include/abg-elf-reader.h. * src/abg-elf-reader-common.cc: Likewise. * include/abg-{elf-based-reader, elf-reader, fe-iface}.h: Add new files. * src/abg-fe-iface.cc: Likewise. * include/Makefile.am: Add the new file abg-fe-iface.h, abg-elf-based-reader.h and abg-elf-reader.h to source distribution and remove include/abg-elf-reader-common.h from source distribution. * src/abg-ir.cc (build_internal_underlying_enum_type_name): Move this here from abg-dwarf-reader.cc so that it can be used by other readers. * include/abg-reader.h (abigail::abixml::reader): Rename the namespace abigail::xml_reader into this one. (read_context, create_native_xml_read_context) (read_context_get_path, read_corpus_from_native_xml) (read_corpus_from_native_xml_file) (read_corpus_group_from_native_xml) (read_corpus_group_from_native_xml_file): Remove. (read_translation_unit_from_file) (read_translation_unit_from_buffer) (read_translation_unit_from_istream) (read_translation_unit) (consider_types_not_reachable_from_public_interfaces) (get_types_from_type_id, get_artifact_used_by_relation_map) (load_canonical_type_ids): Take an fe_iface&, not a read_context. (create_reader): Declare new function that returns a fe_iface_sptr. (read_corpus_from_abixml, read_corpus_from_abixml_file) (read_corpus_group_from_abixml) (read_corpus_group_from_abixml_file): Declare new functions. * src/abg-reader.cc (namespace abixml): Rename the xml_reader namespace into this. (abixml::reader_sptr): New typedef. (abixml::reader): Rename read_context into this. Make it inherit the fe_iface interface. (abixml::reader::{m_path, m_env, m_corpus, m_corpus_group, m_exported_decls_builder, m_supprs}): Remove these data members that are now part of the fe_iface parent type. (abixml::reader::{set_environment, get_corpus, set_corpus, set_corpus_group, maybe_add_fn_to_exported_decls, maybe_add_var_to_exported_decls, maybe_check_abixml_canonical_type_stability, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name}): Remove. (read_corpus_from_input): Remove. Actually the code of this went into abixml::reader::read_context(). (abixml::reader::get_libxml_reader): Rename the get_reader member function into this. (abixml::add_reader_suppressions): Rename add_read_context_suppressions into this. (abixml::reader::read_corpus): Implement this virtual member function if the fe_iface parent interface. (maybe_set_naming_typedef, advance_cursor) (handle_version_attribute, walk_xml_node_to_map_type_ids) (read_elf_needed_from_input, read_symbol_db_from_input) (get_or_read_and_add_translation_unit, build_needed) (read_elf_needed_from_input, add_read_context_suppressions) (maybe_set_artificial_location, maybe_set_naming_typedef) (build_namespace_decl, build_elf_symbol) (build_elf_symbol_from_reference, build_elf_symbol_db) (build_function_parameter, build_function_decl) (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, variable_is_suppressed, build_var_decl) (build_type_decl, build_qualified_type_decl) (build_pointer_type_def, build_reference_type_def) (build_function_type, build_subrange_type, build_array_type_def) (build_enum_type_decl_if_not_suppressed, build_enum_type_decl) (build_typedef_decl, build_class_decl_if_not_suppressed) (build_union_decl_if_not_suppressed, build_class_decl) (build_union_decl, build_function_tdecl, build_class_tdecl) (build_type_tparameter, build_type_composition) (build_non_type_tparameter, build_non_type_tparameter) (build_template_tparameter, build_template_parameter, build_type) (handle_type_decl, handle_namespace_decl) (handle_qualified_type_decl, handle_pointer_type_def) (handle_reference_type_def, handle_function_type) (handle_array_type_def, handle_enum_type_decl) (handle_typedef_decl, handle_var_decl, handle_function_decl) (handle_class_decl, handle_union_decl, handle_function_tdecl) (read_translation_unit_from_istream): Take or use an abixml::reader rather than a read_context. (read_translation_unit, read_translation_unit_from_input) (consider_types_not_reachable_from_public_interfaces) (get_types_from_type_id, get_artifact_used_by_relation_map) (read_corpus_group_from_input, read_translation_unit) (handle_element_node, read_location, read_artificial_location) (load_canonical_type_ids) : Take an fe_iface&, not a read_context. (create_abixml_reader): Rename create_native_xml_read_context into this. Make it return a fe_iface_sptr. (read_corpus_from_abixml): Rename read_corpus_from_abixml into this. (read_corpus_from_abixml_file): Rename read_corpus_from_native_xml_file into this. (read_context_get_path): Remove. * include/abg-tools-utils.h (abigail::tools_utils::{file_has_dwarf_debug_info, file_has_ctf_debug_info}): Declare new functions. (create_best_elf_based_reader): Declare new function. * include/abg-corpus.h (corpus::add): Pass the translation unit by reference. (corpus::exported_decls_builder::maybe_add_{fn,var}_to_exported_fns): Take a const parameter. * src/abg-corpus-priv.h (corpus::exported_decls_builder::priv::add_{fn,var}_to_exported): Take a const parameter and adjust. * src/abg-corpus.cc (corpus::exported_decls_builder::maybe_add_{fn,var}_to_exported_fns): Take a const parameter. (corpus::add): Take a reference to translation_unit_sptr. * include/abg-suppression.h (abigail::fe_iface): Forward-declare this. (abigail::{suppression_sptr, suppressions_type}): Declare these types here. (abigail::suppr::{suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location, is_elf_symbol_suppressed, is_elf_symbol_suppressed, is_function_suppressed, is_variable_suppressed, is_type_suppressed}): Declare these functions here. * src/abg-suppression-priv.h (function_is_suppressed) (variable_is_suppressed, type_is_suppressed) (is_elf_symbol_suppressed): Remove these template functions. * src/abg-suppression.cc (suppression_matches_function_name) (suppression_matches_function_sym_name): Remove. (variable_is_suppressed, suppression_can_match) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name) (suppression_matches_type_name_or_location) (is_elf_symbol_suppressed, is_elf_symbol_suppressed) (is_function_suppressed, is_variable_suppressed) (is_type_suppressed): New functions. * include/abg-ctf-reader.h (abigail::ctf::{read_context, create_read_context, read_corpus, read_and_add_corpus_to_group_from_elf, set_read_context_corpus_group, reset_read_context, dic_type_key}): Remove. (ctf::{create_reader, reset_reader}): Declare new functions. * src/abg-ctf-reader.cc (read_context): Remove. (process_ctf_typedef, process_ctf_base_type) (build_ir_node_for_variadic_parameter_type) (process_ctf_function_type, process_ctf_sou_members) (process_ctf_forward_type, process_ctf_struct_type) (process_ctf_union_type, process_ctf_array_type) (process_ctf_qualified_type, process_ctf_pointer_type) (process_ctf_enum_type, fill_ctf_section) (lookup_symbol_in_ctf_archive, dic_type_key): Forward-declare these static functions. (ctf::reader): New class that is the abstraction of the CTF reader. It extends the abigail::elf_based_reader class. This is a renaming of the abigail::ctf::read_context class. (ctf::reader::{elf_handler, elf_fd, elf_handler_dbg, elf_fd_dbg, symtab, debug_info_root_paths_, debug_info_root_paths_}): Remove these data members as they are now properties of the abigail::elf_reader class, which is a parent class of this abigail::ctf::reader class. (ctf::reader::{exported_decls_builder, maybe_add_fn_to_exported_decls, current_corpus_group, has_corpus_group, main_corpus_from_current_group, current_corpus_is_main_corpus_from_current_group, should_reuse_type_from_corpus_group}): Remove these accessors that can now be used from the parent classes abigail::{elf_reader, elf_based_reader}. (ctf::reader::reader): This now delegates to the constructor of elf_based_reader. It doesn't pass any argument to initialize() anymore. (ctf::reader::initialize): Add an overload with no parameter. In the other overload, do not take a pointer to an environment as no new environment can be passed to the instance of reader that is being reset. Adjust the code of the initializer to reflect all the data members that got removed. (ctf::{env, find_ctfa_file, slurp_elf_info, process_ctf_archive, process_ctf_type, lookup_type, read_corpus, ~reader}): New member functions. Most of these were free-form functions that took ctf::read_context as first parameter. In read_corpus, do not set the corpus::LINUX_KERNEL_BINARY_ORIGIN origin as that is now done by elf::reader when it reads the binary. (lookup_type): Remove. These are now member functions of the ctf::reader class. (process_ctf_typedef, process_ctf_base_type) (build_ir_node_for_variadic_parameter_type) (process_ctf_function_type, process_ctf_sou_members) (process_ctf_forward_type, process_ctf_struct_type) (process_ctf_union_type, process_ctf_array_type) (process_ctf_qualified_type, process_ctf_pointer_type): Take a ctf::reader rather an ctf::read_context. Adjust the content of the functions. (process_ctf_type, lookup_type, process_ctf_archive): Remove these and turn them into member functions of ctf::reader. (open_elf_handler, close_elf_handler, find_alt_debuginfo): Remove these ELF handling functions as ELF handling is now done by the elf_reader parent class. (fill_ctf_section): Take a const pointer to Elf_Scn. (slurp_elf_info, find_ctfa_file): Remove this and make it be a member of ctf::reader. Also, make it handle only CTF reader specific pieces. slurp_elf_info now delegates the reading of generic ELF properties to elf::reader by calling elf::reader::read_corpus(). (create_read_context, read_corpus, set_read_context_corpus_group) (read_and_add_corpus_to_group_from_elf): Remove these functions. (create_reader, reset_reader): Create new functions (dic_type_key): Make this static. * include/abg-dwarf-reader.h (abigail::dwarf::elf_type): Move this enum into the namespace abigail::elf_reader in the file include/abg-elf-reader.h. (abigail::dwarf::{read_context, read_context_sptr, create_read_context, read_context_get_path, reset_read_context, add_read_context_suppressions, set_read_context_corpus_group, read_corpus_from_elf, read_and_add_corpus_to_group_from_elf, read_and_add_corpus_to_group_from_elf, add_read_context_suppressions, refers_to_alt_debug_info, has_alt_debug_info, get_soname_of_elf_file, get_type_of_elf_file, set_debug_info_root_path, get_debug_info_root_path, get_show_stats, set_show_stats, set_drop_undefined_syms, set_do_log, set_environment, get_environment}): Remove. * src/abg-dwarf-reader.cc (struct dwfl_deleter, dwfl_sptr) (addr_elf_symbol_sptr_map_type, address_set_type) (address_set_sptr): Delete these types. (read_context::options_type): Remove. The data members of this type got moved to struct fe_iface::options_type. (find_alt_debug_info_link, find_alt_debug_info_path) (find_alt_debug_info, lookup_data_tag_from_dynamic_segment) (elf_file_type, refers_to_alt_debug_info, has_alt_debug_info) (get_soname_of_elf_file, get_type_of_elf_file) : Remove these ELF specific functions from here; move them to the elf_reader namespace. (dwarf::reader): Create new class that extends elf_based_reader. dwarf::read_context is renamed into this type, actually. (dwarf::reader::die_source_dependant_container_set::get_container): Adjust. (dwarf::reader::{supprs_, dwarf_version_, offline_callbacks_, debug_info_root_paths_, handle_, dwarf_, alt_fd_, alt_dwarf_, alt_debug_info_path_, elf_module_, elf_handle_, elf_path_, symtab_section_, cur_corpus_group_, cur_corpus_, dt_needed_, dt_soname_, elf_architecture_, exported_decls_builder_, options_, drop_undefined_syms_}): Remove these ELF-related data members to move them into the elf_reader namespace. (maybe_propagate_canonical_type) (build_translation_unit_and_add_to_ir, build_ir_node_from_die) (add_or_update_class_type, add_or_update_union_type) (build_ir_node_for_void_type) (build_ir_node_for_variadic_parameter_type, build_function_decl) (function_is_suppressed, build_or_get_fn_decl_if_not_suppressed) (build_var_decl, build_or_get_var_decl_if_not_suppressed) (variable_is_suppressed) (propagate_canonical_type) (get_parent_die, get_scope_die, die_is_at_class_scope) (die_location, die_qualified_type_name, die_qualified_name) (die_qualified_type_name_empty) (die_return_and_parm_names_from_fn_type_die) (die_function_signature, die_function_type_is_method_type) (die_pretty_print_type, die_pretty_print_decl, die_pretty_print) (maybe_canonicalize_type, build_subrange_type) (build_subranges_from_array_type_die, compare_dies, die_location) (die_loc_and_name, die_is_effectively_public_decl) (maybe_cache_type_comparison_result) (get_cached_type_comparison_result) (maybe_get_cached_type_comparison_result, die_is_at_class_scope) (die_function_type_is_method_type, die_member_offset) (die_qualified_type_name, die_qualified_decl_name) (die_qualified_name, die_qualified_type_name_empty) (die_return_and_parm_names_from_fn_type_die) (die_function_signature, die_pretty_print_type) (die_pretty_print_decl, die_pretty_print) (at_least_one_decl_only_among_odr_relevant_dies) (compare_as_type_dies, compare_as_decl_and_type_dies) (fn_die_equal_by_linkage_name, try_canonical_die_comparison) (maybe_propagate_canonical_type, propagate_canonical_type) (compare_dies, compare_dies_during_canonicalization) (find_import_unit_point_between_dies, get_parent_die) (get_scope_die, find_lower_bound_in_imported_unit_points) (build_translation_unit_and_add_to_ir) (build_namespace_decl_and_add_to_ir, build_type_decl) (build_enum_underlying_type, build_enum_type) (finish_member_function_reading) (maybe_finish_function_decl_reading) (lookup_class_or_typedef_from_corpus) (is_function_for_die_a_member_of_class) (add_or_update_member_function, add_or_update_class_type) (add_or_update_union_type, build_qualified_type) (schedule_array_tree_for_late_canonicalization) (maybe_strip_qualification, build_pointer_type_def) (build_reference_type, build_function_type, build_subrange_type) (build_subranges_from_array_type_die, build_array_type) (build_typedef_type, build_or_get_var_decl_if_not_suppressed) (build_var_decl, function_is_suppressed) (build_or_get_fn_decl_if_not_suppressed, variable_is_suppressed) (type_is_suppressed, type_is_suppressed) (get_opaque_version_of_type, create_default_fn_sym) (build_function_decl, maybe_canonicalize_type) (build_ir_node_from_die) (build_ir_node_for_variadic_parameter_type): Take a reference to the new dwarf::reader rather than to the previous read_context. Adjust the function body. (return_comparison_result): Adjust. (dwarf::reader::reader): Adjust this from read_context::read_context. (dwarf::reader::initialize): Adjust from dwarf::read_context::initialize. (dwarf::reader::create): New factory static member function. (dwarf::reader::~reader): This doesn't have to clear anything for now. (dwarf::reader::read_corpus): New virtual member function which implements the fe_iface::read_corpus pure virtual interface. This now delegates the reading of the generic ELF properties to elf::reader by calling elf::reader::read_corpus(). Newer front-ends will be able to do the same. (dwarf::reader::reset_corpus): New member function. (dwarf::reader::read_debug_info_into_corpus): Adjust. This is now a member function. Also, do not set the corpus::LINUX_KERNEL_BINARY_ORIGIN here as it's now set by the elf::reader when it loads the binary. (dwarf::reader::{env, drop_undefined_syms, drop_undefined_syms, dwarf_elf_handle, dwarf_per_die_source, elf_path, compute_canonical_die_offset, get_die_source, get_die_from_offset, get_die_qualified_name, get_die_pretty_type_representation, get_die_qualified_type_name, get_die_pretty_representation, odr_is_relevant, set_canonical_die_offset, get_canonical_die_offset, erase_canonical_die_offset, die_wip_classes_map, die_wip_function_types_map, compare_before_canonicalisation, resolve_declaration_only_classes, resolve_declaration_only_enums, symbol_already_belongs_to_a_function, fixup_functions_with_no_symbols, canonicalize_types_scheduled, tu_die_imported_unit_points_map, die_parent_map, find_symbol_table_section, get_variable_address, exported_decls_builder, load_all_types, load_in_linux_kernel_mode, show_stats, do_log, build_die_parent_maps): Adjust. (offset_pairs_stack_type::rdr_): Changed the ctxt_ into this. (offset_pairs_stack_type::offset_pairs_stack_type): Adjust. (offset_pairs_stack_type::{erase_redundant_type_pair_entry, cancel_canonical_propagated_type}): Adjust. (dwarf::reader::{get_suppressions, offline_callbacks, create_default_dwfl, dwfl_handle, elf_module, elf_handle, add_debug_info_root_paths, add_debug_info_root_path, find_alt_debug_info, dwarf, alt_dwarf, alt_debug_info_path, current_corpus, reset_current_corpus, current_corpus_group, has_corpus_group, main_corpus_from_current_group, current_corpus_is_main_corpus_from_current_group, should_reuse_type_from_corpus_group, function_symbol_is_exported, variable_symbol_is_exported, symtab, dt_needed, dt_soname, elf_architecture, is_elf_symbol_suppressed, load_dt_soname_and_needed, load_elf_architecture, load_elf_properties, maybe_add_fn_to_exported_decls, maybe_add_var_to_exported_decls}): Remove these member functions as they got moved into the elf_reader namespace or into the fe_iface class. (dwarf::read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Move these into the suppr namespace. Make it take an additional parameter that is reference fe_iface. (dwarf::reader::load_debug_info): Remove. This became merged into dwarf::read_debug_info_into_corpus. (dwarf::{set_debug_info_root_path, get_debug_info_root_path, get_show_stats, set_drop_undefined_syms, set_do_log}): Remove. (add_read_context_suppressions) (set_read_context_corpus_group, read_corpus_from_elf): Remove. (read_debug_info_into_corpus): This became a member function of dwarf::reader. (create_reader): Renamed create_read_context into this. Make it return an elf_based_reader_sptr, like the other front-end factory functions. Adjust. (reset_dwarf_reader): Renamed reset_read_context into this. Adjust. (read_corpus_from_elf): Adjust. * src/abg-elf-based-reader.cc: New file. * src/abg-elf-helpers.h (struct dwfl_deleter, dwfl_sptr) (addr_elf_symbol_sptr_map_type, address_set_sptr): Move these types here from abg-dwarf-reader.cc (initialize_dwfl_callbacks, lookup_data_tag_from_dynamic_segment): * src/abg-elf-helpers.cc (lookup_data_tag_from_dynamic_segment) (lookup_data_tag_from_dynamic_segment, initialize_dwfl_callbacks) (create_new_dwfl_handle, get_soname_of_elf_file): New functions that got moved here from the factorizing of abg-dwarf-reader.cc and abg-ctf-reader.cc. * src/abg-tools-utils.cc (file_has_dwarf_debug_info) (file_has_ctf_debug_info): New functions. (load_generate_apply_suppressions): Take an elf_based_reader, not a dwarf::read_context. (maybe_load_vmlinux_dwarf_corpus): Adjust the body to use the new front-end types. * src/Makefile.am: Add the new files src/abg-{fe-iface, elf-based-reader, elf-reader}.cc to source distribution. Remove src/abg-elf-reader-common.cc. * tools/Makefile.am: Factorize linking to libabigail.so by using LDADD. * tools/abicompat.cc (read_corpus, main): Adjust. * tools/abidiff.cc (set_suppressions) (set_native_xml_reader_options, handle_error, main): Adjust. * tools/abidw.cc (set_suppressions, load_corpus_and_write_abixml) (load_kernel_corpus_group_and_write_abixml): Adjust. * tools/abilint.cc (build_type_use_tree, show_how_type_is_used) (set_suppressions, main): Adjust. * tools/abipkgdiff.cc (elf_file::type, compare, compare_to_self) (create_maps_of_package_content) (compare_prepared_userspace_packages) (self_compare_prepared_userspace_package): Adjust. * tools/abisym.cc: Adjust invocation to abigail::dwarf::lookup_symbol_from_elf, from abigail::dwarf_reader::lookup_symbol_from_elf. * tools/kmidiff.cc (main): Adjust. * tests/print-diff-tree.cc (main): Adjust. * tests/test-abidiff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-ir-walker.cc (main): Likewise. * tests/test-read-ctf.cc (test_task_ctf::perform): Likewise. * tests/test-read-dwarf.cc: Remove the useless "using" statements. * tests/test-read-write.cc: Likewise. * tests/test-symtab.cc (read_corpus, TEST_CASE) (assert_symbol_count): Adjust. * tests/data/test-read-ctf/test0.abi: Adjust. * tests/data/test-read-ctf/test0.hash.abi: Likewise. * tests/data/test-read-ctf/test1.so.abi: Likewise. * tests/data/test-read-ctf/test1.so.hash.abi: Likewise. * tests/data/test-read-ctf/test2.so.abi: Likewise. * tests/data/test-read-ctf/test2.so.hash.abi: Likewise. * tests/data/test-read-ctf/test3.so.abi: Likewise. * tests/data/test-read-ctf/test3.so.hash.abi: Likewise. * tests/data/test-read-ctf/test4.so.abi: Likewise. * tests/data/test-read-ctf/test4.so.hash.abi: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
70 lines
1.7 KiB
C++
70 lines
1.7 KiB
C++
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
// -*- Mode: C++ -*-
|
|
//
|
|
// Copyright (C) 2013-2022 Red Hat, Inc.
|
|
//
|
|
// Author: Dodji Seketeli
|
|
|
|
/// @file
|
|
///
|
|
/// This file contains the declarations of the entry points to
|
|
/// de-serialize an instance of @ref abigail::corpus from a file in
|
|
/// elf format, containing dwarf information.
|
|
|
|
#ifndef __ABG_DWARF_READER_H__
|
|
#define __ABG_DWARF_READER_H__
|
|
|
|
#include <ostream>
|
|
#include <elfutils/libdwfl.h>
|
|
#include "abg-corpus.h"
|
|
#include "abg-suppression.h"
|
|
#include "abg-elf-based-reader.h"
|
|
|
|
namespace abigail
|
|
{
|
|
|
|
/// The namespace for the DWARF reader.
|
|
namespace dwarf
|
|
{
|
|
|
|
using namespace abigail::ir;
|
|
|
|
elf_based_reader_sptr
|
|
create_reader(const std::string& elf_path,
|
|
const vector<char**>& debug_info_root_paths,
|
|
environment& environment,
|
|
bool read_all_types = false,
|
|
bool linux_kernel_mode = false);
|
|
|
|
void
|
|
reset_reader(elf_based_reader& rdr,
|
|
const std::string& elf_path,
|
|
const vector<char**>& debug_info_root_paths,
|
|
bool read_all_types = false,
|
|
bool linux_kernel_mode = false);
|
|
|
|
corpus_sptr
|
|
read_corpus_from_elf(const std::string& elf_path,
|
|
const vector<char**>& debug_info_root_paths,
|
|
environment& environment,
|
|
bool load_all_types,
|
|
fe_iface::status& status);
|
|
|
|
bool
|
|
lookup_symbol_from_elf(const environment& env,
|
|
const string& elf_path,
|
|
const string& symbol_name,
|
|
bool demangle,
|
|
vector<elf_symbol_sptr>& symbols);
|
|
|
|
bool
|
|
lookup_public_function_symbol_from_elf(const environment& env,
|
|
const string& path,
|
|
const string& symname,
|
|
vector<elf_symbol_sptr>& func_syms);
|
|
}// end namespace dwarf
|
|
|
|
}// end namespace abigail
|
|
|
|
#endif //__ABG_DWARF_READER_H__
|