libabigail
Loading...
Searching...
No Matches
abigail::dwarf Namespace Reference

The namespace for the DWARF reader. More...

Typedefs

typedef shared_ptr< addr_elf_symbol_sptr_map_typeaddr_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_sptrdie_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_sptrdie_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_sptrdie_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_sptrdie_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_stringdie_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_sptrdie_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_stringistring_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_stringistring_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_typestring_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_typestring_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_typestring_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_typetu_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 (const environment &env, const string &path, const string &symname, vector< elf_symbol_sptr > &func_syms)
 
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.
 

Detailed Description

The namespace for the DWARF reader.

Typedef Documentation

◆ addr_elf_symbol_sptr_map_sptr

Convenience typedef for a shared pointer to an addr_elf_symbol_sptr_map_type.

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

◆ die_artefact_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.

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

◆ die_class_map_type

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.

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

◆ die_class_or_union_map_type

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.

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

◆ die_function_decl_map_type

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.

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

◆ die_function_type_map_type

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.

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

◆ die_istring_map_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.

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

◆ die_tu_map_type

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.

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

◆ dwarf_offset_pair_set_type

typedef unordered_set<std::pair<Dwarf_Off, Dwarf_Off>, dwarf_offset_pair_hash> dwarf_offset_pair_set_type

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

◆ dwarf_offsets_type

typedef vector<Dwarf_Off> dwarf_offsets_type

A convenience typedef for a vector of Dwarf_Off.

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

◆ imported_unit_points_type

typedef vector<imported_unit_point> imported_unit_points_type

Convenience typedef for a vector of imported_unit_point.

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

◆ istring_dwarf_offsets_map_type

Convenience typedef for a map which is an interned_string and which value is a vector of offsets.

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

◆ istring_fn_type_map_type

Convenience typedef for a map that associates an interned_string to a function_type_sptr.

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

◆ offset_offset_map_type

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.

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

◆ offset_pair_set_map_type

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.

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

◆ offset_pair_set_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.

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

◆ offset_pair_type

typedef std::pair<offset_type, offset_type> offset_pair_type

A convenience typedef for a pair of offset_type.

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

◆ offset_pair_vect_map_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.

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

◆ offset_pair_vector_type

typedef vector< std::pair< offset_type, offset_type > > offset_pair_vector_type

A convenience typedef for a vector of pairs of offset_type.

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

◆ offset_set_type

typedef unordered_set<offset_type, offset_hash> offset_set_type

A convenience typedef for an unordered set of DIE offsets.

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

◆ reader_sptr

typedef shared_ptr<reader> reader_sptr

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

◆ scope_stack_type

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.

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

◆ string_classes_map

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.

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

◆ string_classes_or_unions_map

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.

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

◆ string_enums_map

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.

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

◆ tu_die_imported_unit_points_map_type

Convenience typedef for a vector of imported_unit_point.

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

Enumeration Type Documentation

◆ die_source

enum die_source

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.

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

◆ virtuality

enum virtuality

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

Function Documentation

◆ create_default_fn_sym()

elf_symbol_sptr create_default_fn_sym ( const string & sym_name,
const environment & env )

Create a function symbol with a given name.

Parameters
sym_namethe name of the symbol to create.
envthe environment to create the symbol in.
Returns
the newly created symbol.

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

◆ create_reader()

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.

Parameters
elf_paththe path to the elf file the reader is to be used for.
debug_info_root_pathsa vector to the paths to the directories under which the debug info is to be found for elf_path. Pass an empty vector if the debug info is not in a split file.
environmentthe environment used by the current context. This environment contains resources needed by the DWARF reader and by the types and declarations that are to be created later. Note that ABI artifacts that are to be compared all need to be created within the same environment.

Please also note that the life time of this environment object must be greater than the life time of the resulting reader the context uses resources that are allocated in the environment.

Parameters
load_all_typesif set to false only the types that are reachable from publicly exported declarations (of functions and variables) are read. If set to true then all types found in the debug information are loaded.
linux_kernel_modeif set to true, then consider the special linux kernel symbol tables when determining if a symbol is exported or not.
Returns
a smart pointer to the resulting dwarf::reader.

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

◆ is_anonymous_type_die()

bool is_anonymous_type_die ( Dwarf_Die * die)

Test if a given DIE represents an anonymous type.

Anonymous types we are interested in are classes, unions and enumerations.

Parameters
diethe DIE to consider.
Returns
true iff die represents an anonymous type.

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

◆ lookup_public_function_symbol_from_elf()

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.

Parameters
envthe environment we are operating from.
elf_paththe path to the elf file to consider.
symbol_namethe name of the function to look for.
symsthe vector of public function symbols found with the name symname.
Returns
true iff a function with symbol name symbol_name is found.

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

◆ lookup_symbol_from_elf()

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.

Parameters
envthe environment we are operating from.
elf_paththe path to the elf file to consider.
symbol_namethe name of the symbol to look for.
demangleif true, try to demangle the symbol name found in the symbol table.
symsthe vector of symbols found with the name symbol_name.
Returns
true iff the symbol was found among the publicly exported symbols of the ELF file.

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

◆ read_corpus_from_elf()

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.

Parameters
elf_paththe path to the elf file.
debug_info_root_pathsa vector of pointers to root paths under which to look for the debug info of the elf files that are later handled by the Dwfl. This for cases where the debug info is split into a different file from the binary we want to inspect. On Red Hat compatible systems, this root path is usually /usr/lib/debug by default. If this argument is set to NULL, then "./debug" and /usr/lib/debug will be searched for sub-directories containing the debug info file.
environmentthe environment used by the current context. This environment contains resources needed by the DWARF reader and by the types and declarations that are to be created later. Note that ABI artifacts that are to be compared all need to be created within the same environment. Also, the lifetime of the environment must be greater than the lifetime of the resulting corpus because the corpus uses resources that are allocated in the environment.
load_all_typesif set to false only the types that are reachable from publicly exported declarations (of functions and variables) are read. If set to true then all types found in the debug information are loaded.
resulting_corpa pointer to the resulting abigail::corpus.
Returns
the resulting status.

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

◆ reset_reader()

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.

Parameters
rdrthe context to re-initialize.
elf_paththe path to the elf file the context is to be used for.
debug_info_root_patha pointer to the path to the root directory under which the debug info is to be found for elf_path. Leave this to NULL if the debug info is not in a split file.
environmentthe environment used by the current context. This environment contains resources needed by the DWARF reader and by the types and declarations that are to be created later. Note that ABI artifacts that are to be compared all need to be created within the same environment.

Please also note that the life time of this environment object must be greater than the life time of the resulting reader the context uses resources that are allocated in the environment.

Parameters
load_all_typesif set to false only the types that are reachable from publicly exported declarations (of functions and variables) are read. If set to true then all types found in the debug information are loaded.
linux_kernel_modeif set to true, then consider the special linux kernel symbol tables when determining if a symbol is exported or not.
Returns
a smart pointer to the resulting dwarf::reader.

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