12 #ifndef __ABG_SYMTAB_READER_H__
13 #define __ABG_SYMTAB_READER_H__
20 #include <unordered_map>
28 namespace symtab_reader
51 {functions_ = new_value;};
58 {variables_ = new_value;};
65 {public_symbols_ = new_value;};
72 {undefined_symbols_ = new_value;};
79 {kernel_symbols_ = new_value;};
113 using value_type = base_iterator::value_type;
114 using reference = base_iterator::reference;
115 using pointer = base_iterator::pointer;
116 using difference_type = base_iterator::difference_type;
117 using iterator_category = std::forward_iterator_tag;
118 using iterator_concept = std::forward_iterator_tag;
141 base_iterator::operator++();
169 while (*
this != end_ && !filter_.
matches(***
this))
176 using symtab_ptr = std::unique_ptr<symtab>;
212 {
return is_kernel_binary_ ? has_ksymtab_entries_ : !symbols_.empty();}
246 load(Elf* elf_handle,
248 symbol_predicate is_suppressed = NULL);
265 bool is_kernel_binary_;
272 bool has_ksymtab_entries_;
275 using name_symbol_map_type =
276 std::unordered_map<std::string, std::vector<elf_symbol_sptr>>;
277 name_symbol_map_type name_symbol_map_;
280 using addr_symbol_map_type = std::unordered_map<GElf_Addr, elf_symbol_sptr>;
281 addr_symbol_map_type addr_symbol_map_;
284 addr_symbol_map_type entry_addr_symbol_map_;
287 load_(Elf* elf_handle,
289 symbol_predicate is_suppressed);
296 setup_symbol_lookup_tables(Elf* elf_handle,
301 update_function_entry_address_symbol_map(Elf* elf_handle,
302 GElf_Sym* native_symbol,
306 add_alternative_address_lookups(Elf* elf_handle);
330 : tab_(tab), filter_(filter)
336 {
return tab_.
begin(filter_);}
Types of the main internal representation of libabigail.
Abstraction of an elf symbol.
This is an abstraction of the set of resources necessary to manage several aspects of the internal re...
Helper class to allow range-for loops on symtabs for C++11 and later code. It serves as a proxy for t...
symtab::const_iterator begin() const
Pass through symtab.begin(), but also pass on the filter.
symtab::const_iterator end() const
Pass through symtab.end().
filtered_symtab(const symtab &tab, const symtab_filter &filter)
Construct the proxy object keeping references to the underlying symtab and the filter object.
The symtab filter is the object passed to the symtab object in order to iterate over the symbols in t...
void set_public_symbols(bool new_value=true)
Enable or disable public symbol filtering.
bool matches(const elf_symbol &symbol) const
symtab_filter implementations
void set_functions(bool new_value=true)
Enable or disable function filtering.
void set_kernel_symbols(bool new_value=true)
Enable or disable kernel symbol filtering.
void set_variables(bool new_value=true)
Enable or disable variable filtering.
void set_undefined_symbols(bool new_value=true)
Enable or disable undefined symbol filtering.
An iterator to walk a vector of elf_symbols filtered by symtab_filter.
symtab_iterator(base_iterator begin, base_iterator end, const symtab_filter &filter=symtab_filter())
Construct the iterator based on a pair of underlying iterators and a symtab_filter object....
symtab_iterator operator++(int)
Post-increment operator to advance to the next matching element.
symtab_iterator & operator++()
Pre-increment operator to advance to the next matching element.
symtab is the actual data container of the symtab_reader implementation.
const_iterator begin(const symtab_filter &filter) const
Obtain an iterator to the beginning of the symtab according to the filter criteria....
const elf_symbols & lookup_symbol(const std::string &name) const
Get a vector of symbols that are associated with a certain name.
bool has_symbols() const
Indicate whether any (kernel) symbols have been seen at construction.
symtab_filter make_filter() const
symtab implementations
static symtab_ptr load(Elf *elf_handle, const ir::environment &env, symbol_predicate is_suppressed=NULL)
Construct a symtab object and instantiate it from an ELF handle. Also pass in the ir::environment we ...
const_iterator end() const
Obtain an iterator to the end of the symtab.
void update_main_symbol(GElf_Addr addr, const std::string &name)
Notify the symtab about the name of the main symbol at a given address.
symtab_iterator const_iterator
The (only) iterator type we offer is a const_iterator implemented by the symtab_iterator.
shared_ptr< elf_symbol > elf_symbol_sptr
A convenience typedef for a shared pointer to elf_symbol.
std::vector< elf_symbol_sptr > elf_symbols
Convenience typedef for a vector of elf_symbol.
shared_ptr< string_elf_symbols_map_type > string_elf_symbols_map_sptr
Convenience typedef for a shared pointer to string_elf_symbols_map_type.
Toplevel namespace for libabigail.