#include <symbol_container.h>
Public Types | |
typedef std::set< symbol_entry, less_symbol > | symbols_t |
container type | |
typedef symbols_t::size_type | size_type |
Public Member Functions | |
size_type | size () const |
return the number of symbols stored | |
symbol_entry const * | insert (symbol_entry const &) |
symbol_collection const | find (debug_name_id filename, size_t linenr) const |
find the symbols at the given filename and line number, if any | |
symbol_collection const | find (debug_name_id filename) const |
find the symbols defined in the given filename, if any | |
symbol_entry const * | find_by_vma (std::string const &image_name, bfd_vma vma) const |
find the symbol with the given image_name vma if any | |
symbol_entry const * | find (symbol_entry const &symbol) const |
Search a symbol. Return NULL if not found. | |
symbols_t::iterator | begin () |
return start of symbols | |
symbols_t::iterator | end () |
return end of symbols | |
Private Types | |
typedef std::multiset < symbol_entry const *, less_by_file_loc > | symbols_by_loc_t |
Private Member Functions | |
void | build_by_loc () const |
build the symbol by file-location cache | |
Private Attributes | |
symbols_t | symbols |
symbols_by_loc_t | symbols_by_loc |
An arbitrary container of symbols. Supports lookup by name, by VMA, and by file location.
Lookup by name or by VMA is O(n). Lookup by file location is O(log(n)).
Definition at line 28 of file symbol_container.h.
typedef symbols_t::size_type symbol_container::size_type |
Definition at line 33 of file symbol_container.h.
typedef std::multiset<symbol_entry const *, less_by_file_loc> symbol_container::symbols_by_loc_t [private] |
Differently-named symbol at same file location are allowed e.g. template instantiation.
Definition at line 83 of file symbol_container.h.
typedef std::set<symbol_entry, less_symbol> symbol_container::symbols_t |
container type
Definition at line 31 of file symbol_container.h.
symbol_container::symbols_t::iterator symbol_container::begin | ( | ) |
void symbol_container::build_by_loc | ( | ) | const [private] |
build the symbol by file-location cache
Definition at line 82 of file symbol_container.cpp.
References end(), symbols, and symbols_by_loc.
Referenced by find().
symbol_container::symbols_t::iterator symbol_container::end | ( | ) |
return end of symbols
Definition at line 115 of file symbol_container.cpp.
References symbols.
Referenced by build_by_loc().
symbol_entry const * symbol_container::find | ( | symbol_entry const & | symbol | ) | const |
Search a symbol. Return NULL if not found.
Definition at line 120 of file symbol_container.cpp.
References symbols.
symbol_collection const symbol_container::find | ( | debug_name_id | filename | ) | const |
find the symbols defined in the given filename, if any
Definition at line 61 of file symbol_container.cpp.
References build_by_loc(), sample_entry::file_loc, file_location::filename, file_location::linenr, symbol_entry::sample, and symbols_by_loc.
symbol_collection const symbol_container::find | ( | debug_name_id | filename, | |
size_t | linenr | |||
) | const |
find the symbols at the given filename and line number, if any
Definition at line 41 of file symbol_container.cpp.
References build_by_loc(), sample_entry::file_loc, file_location::filename, file_location::linenr, symbol_entry::sample, and symbols_by_loc.
symbol_entry const* symbol_container::find_by_vma | ( | std::string const & | image_name, | |
bfd_vma | vma | |||
) | const |
find the symbol with the given image_name vma if any
symbol_entry const * symbol_container::insert | ( | symbol_entry const & | symb | ) |
Insert a new symbol. If the symbol already exists in the container, then the sample counts are accumulated. Returns the newly created symbol or the existing one. This pointer remains valid during the whole life time of a symbol_container object and is warranted unique according to less_symbol comparator. Can only be done before any file-location based lookups, since the two lookup methods are not synchronised.
Definition at line 27 of file symbol_container.cpp.
References sample_entry::counts, symbol_entry::sample, and symbols.
symbol_container::size_type symbol_container::size | ( | ) | const |
return the number of symbols stored
Definition at line 21 of file symbol_container.cpp.
References symbols.
symbols_t symbol_container::symbols [private] |
The main container of symbols. Multiple symbols with the same name are allowed.
Definition at line 76 of file symbol_container.h.
Referenced by begin(), build_by_loc(), end(), find(), insert(), and size().
symbols_by_loc_t symbol_container::symbols_by_loc [mutable, private] |
Symbols sorted by location order. Lazily built on request, so mutable.
Definition at line 91 of file symbol_container.h.
Referenced by build_by_loc(), and find().