mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-24 18:52:15 +00:00
ce1278c3da
* 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>
448 lines
9.3 KiB
C++
448 lines
9.3 KiB
C++
// -*- Mode: C++ -*-
|
|
//
|
|
// Copyright (C) 2013 Red Hat, Inc.
|
|
//
|
|
// 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/>.
|
|
|
|
/// @file
|
|
|
|
#ifndef __ABG_IRFWD_H__
|
|
#define __ABG_IRFWD_H__
|
|
|
|
#include <cstddef>
|
|
#include <tr1/memory>
|
|
#include <list>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <tr1/functional>
|
|
#include <typeinfo>
|
|
#include <utility> // for std::rel_ops, at least.
|
|
#include <ostream>
|
|
#include "abg-hash.h"
|
|
|
|
/// Toplevel namespace for libabigail.
|
|
namespace abigail
|
|
{
|
|
/**
|
|
@mainpage libabigail
|
|
|
|
|
|
The GNU Application Binary Interface Generic Analysis and
|
|
Instrumentation Library.
|
|
|
|
This is an interface to the GNU Compiler Collection for the
|
|
collection and analysis of compiler-generated binaries.
|
|
|
|
Checkout out the project homepage <a
|
|
href="http://sourceware.org/libabigail"> here</a>.
|
|
|
|
The current libabigail source code can be checked out with:
|
|
git clone git://sourceware.org/git/libabigail.git.
|
|
|
|
The mailing list to send messages and patches to is
|
|
libabigail@sourceware.org.
|
|
*/
|
|
|
|
// Inject some types.
|
|
using std::tr1::shared_ptr;
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
// Pull in relational operators.
|
|
using namespace std::rel_ops;
|
|
|
|
// Forward declarations for corpus.
|
|
|
|
class corpus;
|
|
|
|
// Forward declarations for ir.
|
|
class location;
|
|
class location_manager;
|
|
class translation_unit;
|
|
class class_decl;
|
|
class class_tdecl;
|
|
class decl_base;
|
|
class enum_type_decl;
|
|
class function_decl;
|
|
class function_tdecl;
|
|
class function_type;
|
|
class global_scope;
|
|
class node_visitor;
|
|
class location;
|
|
class location_manager;
|
|
class method_type;
|
|
class namespace_decl;
|
|
class parameter;
|
|
class pointer_type_def;
|
|
class qualified_type_def;
|
|
class reference_type_def;
|
|
class scope_decl;
|
|
class scope_type_decl;
|
|
class template_decl;
|
|
class template_parameter;
|
|
class non_type_tparameter;
|
|
class type_tparameter;
|
|
class template_tparameter;
|
|
|
|
class type_composition;
|
|
class type_base;
|
|
class type_decl;
|
|
class typedef_decl;
|
|
class var_decl;
|
|
|
|
struct type_shared_ptr_equal;
|
|
struct traversable_base;
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope (shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
const global_scope*
|
|
get_global_scope(const decl_base&);
|
|
|
|
const global_scope*
|
|
get_global_scope(const decl_base*);
|
|
|
|
const global_scope*
|
|
get_global_scope(const shared_ptr<decl_base>);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const decl_base&);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const decl_base*);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_global_scope(const scope_decl&);
|
|
|
|
bool
|
|
is_global_scope(const scope_decl*);
|
|
|
|
bool
|
|
is_global_scope(const shared_ptr<scope_decl>);
|
|
|
|
bool
|
|
is_at_global_scope(const decl_base&);
|
|
|
|
bool
|
|
is_at_global_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_at_class_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_at_class_scope(const decl_base*);
|
|
|
|
bool
|
|
is_at_class_scope(const decl_base&);
|
|
|
|
bool
|
|
is_at_template_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_parameter(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_type(const decl_base&);
|
|
|
|
shared_ptr<type_base>
|
|
is_type(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<typedef_decl>
|
|
is_typedef(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<typedef_decl>
|
|
is_typedef(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<class_decl>
|
|
is_class_type(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<class_decl>
|
|
is_class_type(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<class_decl>
|
|
look_through_decl_only_class(shared_ptr<class_decl>);
|
|
|
|
bool
|
|
is_var_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_parm_composition_type(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_function_template_pattern(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
shared_ptr<decl_base>
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
shared_ptr<scope_decl>);
|
|
|
|
bool
|
|
has_scope(const decl_base&);
|
|
|
|
bool
|
|
has_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_member_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_member_decl(const decl_base*);
|
|
|
|
bool
|
|
is_member_decl(const decl_base&);
|
|
|
|
bool
|
|
is_member_type(const shared_ptr<type_base>);
|
|
|
|
bool
|
|
is_member_type(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
remove_decl_from_scope(shared_ptr<decl_base>);
|
|
|
|
bool
|
|
get_member_is_static(const decl_base&);
|
|
|
|
bool
|
|
get_member_is_static(const decl_base*);
|
|
|
|
bool
|
|
get_member_is_static(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
set_member_is_static(decl_base&,
|
|
bool);
|
|
|
|
void
|
|
set_member_is_static(shared_ptr<decl_base>,
|
|
bool);
|
|
|
|
bool
|
|
is_data_member(const var_decl&);
|
|
|
|
bool
|
|
is_data_member(const var_decl*);
|
|
|
|
bool
|
|
is_data_member(const shared_ptr<var_decl>);
|
|
|
|
void
|
|
set_data_member_offset(shared_ptr<var_decl>, size_t);
|
|
|
|
size_t
|
|
get_data_member_offset(const var_decl&);
|
|
|
|
size_t
|
|
get_data_member_offset(const shared_ptr<var_decl>);
|
|
|
|
size_t
|
|
get_data_member_offset(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
set_data_member_is_laid_out(shared_ptr<var_decl>, bool);
|
|
|
|
bool
|
|
get_data_member_is_laid_out(const var_decl&);
|
|
|
|
bool
|
|
get_data_member_is_laid_out(const shared_ptr<var_decl>);
|
|
|
|
bool
|
|
is_member_function(const function_decl&);
|
|
|
|
bool
|
|
is_member_function(const function_decl*);
|
|
|
|
bool
|
|
is_member_function(const shared_ptr<function_decl>);
|
|
|
|
bool
|
|
get_member_function_is_ctor(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_ctor(const shared_ptr<function_decl>);
|
|
|
|
bool
|
|
get_member_function_is_dtor(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_dtor(const shared_ptr<function_decl>);
|
|
|
|
bool
|
|
get_member_function_is_const(const function_decl&);
|
|
|
|
bool
|
|
get_member_function_is_const(const shared_ptr<function_decl>);
|
|
|
|
size_t
|
|
get_member_function_vtable_offset(const function_decl&);
|
|
|
|
size_t
|
|
get_member_function_vtable_offset(const shared_ptr<function_decl>);
|
|
|
|
bool
|
|
member_function_is_virtual(const function_decl&);
|
|
|
|
bool
|
|
member_function_is_virtual(const shared_ptr<function_decl>);
|
|
|
|
void
|
|
set_member_function_is_virtual(const function_decl&, bool);
|
|
|
|
void
|
|
set_member_function_is_virtual(const shared_ptr<function_decl>&, bool);
|
|
|
|
shared_ptr<type_base>
|
|
strip_typedef(const shared_ptr<type_base>);
|
|
|
|
string
|
|
get_type_name(const shared_ptr<type_base>);
|
|
|
|
string
|
|
get_pretty_representation(const decl_base*);
|
|
|
|
string
|
|
get_pretty_representation(const type_base*);
|
|
|
|
string
|
|
get_pretty_representation(const shared_ptr<decl_base>&);
|
|
|
|
string
|
|
get_pretty_representation(const shared_ptr<type_base>&);
|
|
|
|
const decl_base*
|
|
get_type_declaration(const type_base*);
|
|
|
|
decl_base*
|
|
get_type_declaration(type_base*);
|
|
|
|
shared_ptr<decl_base>
|
|
get_type_declaration(const shared_ptr<type_base>);
|
|
|
|
bool
|
|
types_are_compatible(const shared_ptr<type_base>,
|
|
const shared_ptr<type_base>);
|
|
|
|
bool
|
|
types_are_compatible(const shared_ptr<decl_base>,
|
|
const shared_ptr<decl_base>);
|
|
|
|
const scope_decl*
|
|
get_top_most_scope_under(const decl_base*,
|
|
const scope_decl*);
|
|
|
|
const scope_decl*
|
|
get_top_most_scope_under(const shared_ptr<decl_base>,
|
|
const scope_decl*);
|
|
|
|
const scope_decl*
|
|
get_top_most_scope_under(const shared_ptr<decl_base>,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
void
|
|
fqn_to_components(const std::string&,
|
|
std::list<string>&);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_translation_unit(const string&,
|
|
const translation_unit&);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_translation_unit(const std::list<string>&,
|
|
const translation_unit&);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_scope(const string&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_type_in_scope(const std::list<string>&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_var_decl_in_scope(const string&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
const shared_ptr<decl_base>
|
|
lookup_var_decl_in_scope(const std::list<string>&,
|
|
const shared_ptr<scope_decl>);
|
|
|
|
string
|
|
demangle_cplus_mangled_name(const string&);
|
|
|
|
void
|
|
dump(const shared_ptr<decl_base>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
dump(const shared_ptr<type_base>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<type_base>);
|
|
|
|
void
|
|
dump(const shared_ptr<var_decl>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<var_decl>);
|
|
|
|
void
|
|
dump(const translation_unit&, std::ostream&);
|
|
|
|
void
|
|
dump(const translation_unit&);
|
|
|
|
void
|
|
dump(const shared_ptr<translation_unit>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<translation_unit>);
|
|
|
|
void
|
|
dump_decl_location(const decl_base&);
|
|
|
|
void
|
|
dump_decl_location(const decl_base*);
|
|
|
|
void
|
|
dump_decl_location(const shared_ptr<decl_base>&);
|
|
|
|
} // end namespace abigail
|
|
#endif // __ABG_IRFWD_H__
|