libabigail
|
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 "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"
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 | ABG_RETURN(value) |
A macro used to return from DIE comparison routines. | |
#define | ABG_RETURN_FALSE |
A macro used to return the "false" boolean from DIE comparison routines. | |
#define | NOTIFY_DIE_COMPARISON_FAILED(l, r) |
#define | RETURN_IF_COMPARISON_CYCLE_DETECTED |
#define | SET_RESULT_TO(result, value, l, r) |
A macro to set the 'result' variable to a given value. | |
#define | SET_RESULT_TO_FALSE(result, l, r) |
A macro to set the 'result' variable to 'false'. | |
#define | UINT64_MAX |
Typedefs | |
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_map< Dwarf_Off, type_or_decl_base_sptr > | die_artefact_map_type |
Convenience typedef for a map which key is the offset of a dwarf die and which value is the corresponding artefact. | |
typedef unordered_map< Dwarf_Off, class_decl_sptr > | die_class_map_type |
Convenience typedef for a map which key is the offset of a dwarf die, (given by dwarf_dieoffset()) and which value is the corresponding class_decl. | |
typedef unordered_map< Dwarf_Off, class_or_union_sptr > | die_class_or_union_map_type |
Convenience typedef for a map which key is the offset of a dwarf die, (given by dwarf_dieoffset()) and which value is the corresponding class_or_union_sptr. | |
typedef unordered_map< Dwarf_Off, function_decl_sptr > | die_function_decl_map_type |
Convenience typedef for a map which key the offset of a dwarf die and which value is the corresponding function_decl. | |
typedef unordered_map< Dwarf_Off, function_type_sptr > | die_function_type_map_type |
Convenience typedef for a map which key is the offset of a dwarf die and which value is the corresponding function_type. | |
typedef unordered_map< Dwarf_Off, interned_string > | die_istring_map_type |
Convenience typedef for a map which key is the offset of a DIE and the value is the corresponding qualified name of the DIE. | |
typedef unordered_map< Dwarf_Off, translation_unit_sptr > | die_tu_map_type |
Convenience typedef for a map which key is the offset of a DW_TAG_compile_unit and the value is the corresponding translation_unit_sptr. | |
typedef unordered_set< std::pair< Dwarf_Off, Dwarf_Off >, dwarf_offset_pair_hash > | dwarf_offset_pair_set_type |
typedef vector< Dwarf_Off > | dwarf_offsets_type |
A convenience typedef for a vector of Dwarf_Off. | |
typedef vector< imported_unit_point > | imported_unit_points_type |
Convenience typedef for a vector of imported_unit_point. | |
typedef unordered_map< interned_string, dwarf_offsets_type, hash_interned_string > | istring_dwarf_offsets_map_type |
Convenience typedef for a map which is an interned_string and which value is a vector of offsets. | |
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 unordered_map< Dwarf_Off, Dwarf_Off > | offset_offset_map_type |
Convenience typedef for a map which key is a dwarf offset. The value is also a dwarf offset. | |
typedef unordered_map< std::pair< offset_type, offset_type >, offset_pair_set_type, offset_pair_hash > | offset_pair_set_map_type |
A convenience typedef for an unordered_map that associates a pair of offset_type to a set of pairs of offset_type. | |
typedef unordered_set< std::pair< offset_type, offset_type >, offset_pair_hash > | offset_pair_set_type |
A convenience typedef for an unordered set of pairs of offset_type. | |
typedef std::pair< offset_type, offset_type > | offset_pair_type |
A convenience typedef for a pair of offset_type. | |
typedef unordered_map< std::pair< offset_type, offset_type >, offset_pair_vector_type, offset_pair_hash > | offset_pair_vect_map_type |
A convenience typedef for an unordered map that associates a pair of offset_type to a vector of pairs offset_type. | |
typedef vector< std::pair< offset_type, offset_type > > | offset_pair_vector_type |
A convenience typedef for a vector of pairs of offset_type. | |
typedef unordered_set< offset_type, offset_hash > | offset_set_type |
A convenience typedef for an unordered set of DIE offsets. | |
typedef shared_ptr< reader > | reader_sptr |
typedef stack< scope_decl * > | 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. | |
typedef unordered_map< Dwarf_Off, 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< char ** > &debug_info_root_paths, environment &environment, bool load_all_types, bool linux_kernel_mode) |
Create a dwarf::reader. | |
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< char ** > &debug_info_root_paths, environment &environment, bool load_all_types, 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< char ** > &debug_info_root_path, bool read_all_types, bool linux_kernel_mode) |
Re-initialize a reader so that it can re-used to read another binary. | |
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.
#define ABG_RETURN | ( | value | ) |
A macro used to return from DIE comparison routines.
If the return value is false, the macro invokes the notify_die_comparison_failed signalling function before returning. That way, hackers willing to learn more about why the comparison routine returned "false" can just set a breakpoint on notify_die_comparison_failed and execute the program from compare_dies_during_canonicalization, for instance.
value | the value to return from the DIE comparison routines. |
Definition at line 11703 of file abg-dwarf-reader.cc.
#define ABG_RETURN_FALSE |
A macro used to return the "false" boolean from DIE comparison routines.
As the return value is false, the macro invokes the notify_die_comparison_failed signalling function before returning.
value | the value to return from the DIE comparison routines. |
Definition at line 11723 of file abg-dwarf-reader.cc.
#define NOTIFY_DIE_COMPARISON_FAILED | ( | l, | |
r ) |
Definition at line 11690 of file abg-dwarf-reader.cc.
#define RETURN_IF_COMPARISON_CYCLE_DETECTED |
Definition at line 11775 of file abg-dwarf-reader.cc.
#define SET_RESULT_TO | ( | result, | |
value, | |||
l, | |||
r ) |
A macro to set the 'result' variable to a given value.
If the value equals to COMPARISON_RESULT_DIFFERENT, then the macro invokes the notify_die_comparison_failed function so that the hacker can set a debugging breakpoint on notify_die_comparison_failed to know where a DIE comparison failed during compare_dies_during_canonicalization for instance.
result | the 'result' variable to set. |
l | the first DIE of the comparison operation. |
r | the second DIE of the comparison operation. |
Definition at line 11765 of file abg-dwarf-reader.cc.
#define SET_RESULT_TO_FALSE | ( | result, | |
l, | |||
r ) |
A macro to set the 'result' variable to 'false'.
The macro invokes the notify_die_comparison_failed function so that the hacker can set a debugging breakpoint on notify_die_comparison_failed to know where a DIE comparison failed during compare_dies_during_canonicalization for instance.
result | the 'result' variable to set. |
l | the first DIE of the comparison operation. |
r | the second DIE of the comparison operation. |
Definition at line 11745 of file abg-dwarf-reader.cc.
#define UINT64_MAX |
Definition at line 55 of file abg-dwarf-reader.cc.