libabigail
Loading...
Searching...
No Matches
Namespaces | Macros | Typedefs | Enumerations | Functions
abg-dwarf-reader.cc File Reference

This file contains the definitions of the entry points to de-serialize an instance of abigail::corpus from a file in elf format, containing dwarf information. More...

#include "abg-internal.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <libgen.h>
#include <assert.h>
#include <limits.h>
#include <elfutils/libdwfl.h>
#include <dwarf.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <list>
#include <memory>
#include <ostream>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <mutex>
#include "abg-ir-priv.h"
#include "abg-suppression-priv.h"
#include "abg-corpus-priv.h"
#include "abg-symtab-reader.h"
#include "abg-dwarf-reader.h"
#include "abg-elf-based-reader.h"
#include "abg-sptr-utils.h"
#include "abg-tools-utils.h"
#include "abg-elf-helpers.h"
#include "abg-workers.h"
#include "parallel_hashmap/phmap.h"
Include dependency graph for abg-dwarf-reader.cc:

Go to the source code of this file.

Namespaces

namespace  abigail
 Toplevel namespace for libabigail.
 
namespace  abigail::dwarf
 The namespace for the DWARF reader.
 

Macros

#define UINT64_MAX
 

Typedefs

typedef phmap::flat_hash_map< void *, void * > addr_addr_phmap_type
 Convenience typedef for a flat hash which key is a dwarf DIE address. The value is also a dwarf address.
 
typedef shared_ptr< addr_elf_symbol_sptr_map_type > addr_elf_symbol_sptr_map_sptr
 Convenience typedef for a shared pointer to an addr_elf_symbol_sptr_map_type.
 
typedef unordered_set< void * > addr_set_type
 A convenience typedef for an unordered set of 'void*'.
 
typedef unordered_map< void *, type_or_decl_base_sptr > die_artefact_map_type
 Convenience typedef for a map which key is the address of a dwarf die and which value is the corresponding artefact.
 
typedef unordered_map< void *, class_decl_sptr > die_class_map_type
 Convenience typedef for a map which key is the address of a dwarf die and which value is the corresponding class_decl.
 
typedef unordered_map< void *, class_or_union_sptr > die_class_or_union_map_type
 Convenience typedef for a map which key is the address of a dwarf die and which value is the corresponding class_or_union_sptr.
 
typedef unordered_map< void *, function_decl_sptr > die_function_decl_map_type
 Convenience typedef for a map which key is the address of a dwarf die and which value is the corresponding function_decl.
 
typedef unordered_map< void *, function_type_sptr > die_function_type_map_type
 Convenience typedef for a map which key is the address of a dwarf die and which value is the corresponding function_type.
 
typedef unordered_map< void *, interned_string > die_istring_map_type
 Convenience typedef for a map which key is the address of a DIE and the value is the corresponding qualified name of the DIE.
 
typedef shared_ptr< die_parent_relations_builder_task > die_parent_relations_builder_task_sptr
 A convenience typedef for the a shared_ptr of die_parent_relations_builder_task.
 
typedef unordered_map< void *, translation_unit_sptr > die_tu_map_type
 Convenience typedef for a map which key is the address of a DW_TAG_compile_unit and the value is the corresponding translation_unit_sptr.
 
typedef unordered_map< dwarf_addr_pair_type, dwarf_addr_pair_set_type, dwarf_addr_pair_hash > dwarf_addr_pair_set_map_type
 A convenience typedef for an unordered_map that associates a pair of dwarf_addr_type to a set of pairs of void*.
 
typedef unordered_set< dwarf_addr_pair_type, dwarf_addr_pair_hash > dwarf_addr_pair_set_type
 
typedef std::pair< void *, void * > dwarf_addr_pair_type
 A convenience typedef for a std::pair of void*, , representing the address of a DIE.
 
typedef unordered_map< dwarf_addr_pair_type, dwarf_addr_pairs_type, dwarf_addr_pair_hash > dwarf_addr_pairs_map_type
 A convenience typedef for an unordered map that associates a pair of dwarf_addr_pair_type to a vector of pairs void*.
 
typedef vector< dwarf_addr_pair_type > dwarf_addr_pairs_type
 A convenience typedef for a vector of pairs of void*.
 
typedef vector< void * > dwarf_addrs_type
 A convenience typedef for a vector of void*, representing the address of a DIE.
 
typedef vector< imported_unit_point > imported_unit_points_type
 Convenience typedef for a vector of imported_unit_point.
 
typedef unordered_map< interned_string, dwarf_addrs_type, hash_interned_string > istring_dwarf_addrs_map_type
 Convenience typedef for a map which is an interned_string and which value is a vector of DIE addresses.
 
typedef unordered_map< interned_string, function_type_sptr, hash_interned_string > istring_fn_type_map_type
 Convenience typedef for a map that associates an interned_string to a function_type_sptr.
 
typedef shared_ptr< reader > reader_sptr
 
typedef stack< scope_decl_sptr > scope_stack_type
 Convenience typedef for a stack containing the scopes up to the current point in the abigail Internal Representation (aka IR) tree that is being built.
 
typedef unordered_map< string, classes_type > string_classes_map
 Convenience typedef for a map which key is a string and which value is a vector of smart pointer to a class.
 
typedef unordered_map< string, classes_or_unions_type > string_classes_or_unions_map
 Convenience typedef for a map which key is a string and which value is a vector of smart pointer to a class_or_union_sptr.
 
typedef unordered_map< string, enums_type > string_enums_map
 Convenience typedef for a map which key is a string and which value is a vector of smart pointer to a enum.
 
using tu_building_fn_type = void(*)(reader &, Dwarf_Die, translation_unit_sptr)
 A type alias for a function type to build a translation unit.
 
using tu_building_task_type = workers::simple_task< tu_building_fn_type, void, reader &, Dwarf_Die, translation_unit_sptr >
 A type alias for a task to build a translation unit in its own separate thread. The task executes a function of type tu_building_fn_type.
 
typedef shared_ptr< tu_building_task_type > tu_building_task_type_sptr
 A typedef of a shared pointer of tu_building_task_type.
 
typedef unordered_map< void *, imported_unit_points_type > tu_die_imported_unit_points_map_type
 Convenience typedef for a vector of imported_unit_point.
 

Enumerations

enum  die_source {
  NO_DEBUG_INFO_DIE_SOURCE , PRIMARY_DEBUG_INFO_DIE_SOURCE , ALT_DEBUG_INFO_DIE_SOURCE , TYPE_UNIT_DIE_SOURCE ,
  NUMBER_OF_DIE_SOURCES
}
 Where a DIE comes from. For instance, a DIE can come from the main debug info section, the alternate debug info section or from the type unit section. More...
 
enum  virtuality { VIRTUALITY_NOT_VIRTUAL , VIRTUALITY_VIRTUAL , VIRTUALITY_PURE_VIRTUAL }
 

Functions

elf_symbol_sptr create_default_fn_sym (const string &sym_name, const environment &env)
 Create a function symbol with a given name.
 
elf_based_reader_sptr create_reader (const std::string &elf_path, const vector< string > &debug_info_root_paths, environment &environment)
 Create a dwarf::reader.
 
elf_based_reader_sptr create_reader (const std::string &elf_path, const vector< string > &debug_info_root_paths, environment &environment, const fe_iface::options_type &options)
 Create a dwarf::reader.
 
string die_class_or_enum_flat_representation (const reader &rdr, const Dwarf_Die *die, const string &indent, bool one_line, bool qualified_names, void *where_addr, reader::tu_context_type_sptr &tu_ctxt)
 Compute the flat representation string of a class or enum type represented by a DIE.
 
string die_class_or_enum_flat_representation (const reader &rdr, const Dwarf_Die *die, const string &indent, bool one_line, bool qualified_names, void *where_addr, reader::tu_context_type_sptr &tu_ctxt, unordered_set< void * > &guard)
 Compute the flat representation string of a class or enum type represented by a DIE.
 
location die_location (const Dwarf_Die *die, reader::tu_context_type_sptr &tu_ctxt)
 Returns the source location associated with a decl DIE.
 
string die_pretty_print (reader &rdr, const Dwarf_Die *die, void *where_addr, reader::tu_context_type_sptr &tu_ctxt, unordered_set< void * > &guard)
 Compute the pretty printed representation of an artifact represented by a DIE.
 
string die_qualified_name (const reader &rdr, const Dwarf_Die *die, void *where, reader::tu_context_type_sptr &tu_ctxt, unordered_set< void * > &guard)
 Compute the qualified name of the artifact represented by a given DIE.
 
string die_qualified_type_name (const reader &rdr, const Dwarf_Die *die, void *where, reader::tu_context_type_sptr &tu_ctxt, unordered_set< void * > &guard)
 Compute the qualified name of a DIE that represents a type.
 
bool is_anonymous_type_die (Dwarf_Die *die)
 Test if a given DIE represents an anonymous type.
 
bool lookup_public_function_symbol_from_elf (environment &env, const string &path, const string &symname, vector< elf_symbol_sptr > &syms)
 Look into the symbol tables of an elf file to see if a public function of a given name is found.
 
bool lookup_symbol_from_elf (const environment &env, const string &elf_path, const string &symbol_name, bool demangle, vector< elf_symbol_sptr > &syms)
 Look into the symbol tables of a given elf file and see if we find a given symbol.
 
corpus_sptr read_corpus_from_elf (const std::string &elf_path, const vector< string > &debug_info_root_paths, environment &environment, const fe_iface::options_type &options, fe_iface::status &status)
 Read all abigail::translation_unit possible from the debug info accessible from an elf file, stuff them into a libabigail ABI Corpus and return it.
 
corpus_sptr read_corpus_from_elf (const std::string &elf_path, const vector< string > &debug_info_root_paths, environment &environment, fe_iface::status &status)
 Read all abigail::translation_unit possible from the debug info accessible from an elf file, stuff them into a libabigail ABI Corpus and return it.
 
void reset_reader (elf_based_reader &rdr, const std::string &elf_path, const vector< string > &debug_info_root_path, const fe_iface::options_type &options)
 Re-initialize a reader so that it can re-used to read another binary.
 

Detailed Description

This file contains the definitions of the entry points to de-serialize an instance of abigail::corpus from a file in elf format, containing dwarf information.

Definition in file abg-dwarf-reader.cc.

Macro Definition Documentation

◆ UINT64_MAX

#define UINT64_MAX

Definition at line 60 of file abg-dwarf-reader.cc.