27#include "llvm/ADT/ArrayRef.h"
28#include "llvm/ADT/StringRef.h"
29#include "llvm/Support/DJB.h"
35 : m_objfile(objfile), m_symbols(), m_file_addr_to_index(*this),
36 m_name_to_symbol_indices(), m_mutex(),
37 m_file_addr_to_index_computed(false), m_name_indexes_computed(false),
38 m_loaded_from_cache(false), m_saved_to_cache(false) {
69 name_to_index.Clear();
78 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
89 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
94 const char *object_name =
nullptr;
99 s->
Printf(
"Symtab, file = %s%s%s%s, num_symbols = %" PRIu64,
100 file_spec.
GetPath().c_str(), object_name ?
"(" :
"",
101 object_name ? object_name :
"", object_name ?
")" :
"",
104 s->
Printf(
"Symtab, num_symbols = %" PRIu64
"", (uint64_t)
m_symbols.size());
107 switch (sort_order) {
115 pos->Dump(s, target, std::distance(begin, pos), name_preference);
126 std::multimap<llvm::StringRef, const Symbol *> name_map;
129 const char *name = pos->GetName().AsCString();
131 name_map.insert(std::make_pair(name, &(*pos)));
134 for (
const auto &name_to_symbol : name_map) {
135 const Symbol *symbol = name_to_symbol.second;
137 symbol->
Dump(s, target, symbol - &
m_symbols[0], name_preference);
147 for (
size_t i = 0; i < num_entries; ++i) {
150 m_symbols[symbol_idx].Dump(s, target, symbol_idx, name_preference);
161 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
166 s->
Printf(
"Symtab %" PRIu64
" symbol indexes (%" PRIu64
" symbols total):\n",
167 (uint64_t)indexes.size(), (uint64_t)
m_symbols.size());
170 if (!indexes.empty()) {
171 std::vector<uint32_t>::const_iterator pos;
172 std::vector<uint32_t>::const_iterator end = indexes.end();
174 for (pos = indexes.begin(); pos != end; ++pos) {
176 if (idx < num_symbols) {
178 m_symbols[idx].Dump(s, target, idx, name_preference);
186 s->
Indent(
" Debug symbol\n");
187 s->
Indent(
" |Synthetic symbol\n");
188 s->
Indent(
" ||Externally Visible\n");
190 s->
Indent(
"Index UserID DSX Type File Address/Value Load "
191 "Address Size Flags Name\n");
192 s->
Indent(
"------- ------ --- --------------- ------------------ "
193 "------------------ ------------------ ---------- "
194 "----------------------------------\n");
200 if (match_uid < symbol_uid)
202 if (match_uid > symbol_uid)
208 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
236 if (mangled.size() < 3 || !mangled.startswith(
"_Z"))
240 switch (mangled[2]) {
266 llvm_unreachable(
"unknown scheme!");
277 std::vector<Language *> languages;
279 languages.push_back(
l);
284 auto &basename_to_index =
286 auto &method_to_index =
288 auto &selector_to_index =
291 const size_t num_symbols =
m_symbols.size();
292 name_to_index.Reserve(num_symbols);
296 std::set<const char *> class_contexts;
297 std::vector<std::pair<NameToIndexMap::Entry, const char *>> backlog;
298 backlog.reserve(num_symbols / 2);
303 for (uint32_t value = 0; value < num_symbols; ++value) {
319 name_to_index.Append(name, value);
326 name_to_index.Append(stripped, value);
341 name_to_index.Append(name, value);
348 name_to_index.Append(name, value);
354 for (
auto variant : lang->GetMethodNameVariants(name)) {
355 if (variant.GetType() & lldb::eFunctionNameTypeSelector)
356 selector_to_index.Append(variant.GetName(), value);
357 else if (variant.GetType() & lldb::eFunctionNameTypeFull)
358 name_to_index.Append(variant.GetName(), value);
359 else if (variant.GetType() & lldb::eFunctionNameTypeMethod)
360 method_to_index.Append(variant.GetName(), value);
361 else if (variant.GetType() & lldb::eFunctionNameTypeBase)
362 basename_to_index.Append(variant.GetName(), value);
368 for (
const auto &record : backlog) {
372 name_to_index.Sort();
373 name_to_index.SizeToFit();
374 selector_to_index.Sort();
375 selector_to_index.SizeToFit();
376 basename_to_index.Sort();
377 basename_to_index.SizeToFit();
378 method_to_index.Sort();
379 method_to_index.SizeToFit();
384 uint32_t value, std::set<const char *> &class_contexts,
385 std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog,
389 if (base_name.empty())
393 NameToIndexMap::Entry entry(
ConstString(base_name), value);
397 if (decl_context.empty()) {
399 auto &basename_to_index =
401 basename_to_index.Append(entry);
405 name_to_index.Append(entry);
412 auto it = class_contexts.find(decl_context_ccstr);
414 auto &method_to_index =
419 method_to_index.Append(entry);
420 if (it == class_contexts.end())
421 class_contexts.insert(it, decl_context_ccstr);
426 if (it != class_contexts.end()) {
427 method_to_index.Append(entry);
433 backlog.push_back(std::make_pair(entry, decl_context_ccstr));
437 const NameToIndexMap::Entry &entry,
const char *decl_context,
438 const std::set<const char *> &class_contexts) {
439 auto &method_to_index =
441 auto it = class_contexts.find(decl_context);
442 if (it != class_contexts.end()) {
443 method_to_index.Append(entry);
447 method_to_index.Append(entry);
448 auto &basename_to_index =
450 basename_to_index.Append(entry);
455 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
460 bool add_demangled,
bool add_mangled,
463 if (add_demangled || add_mangled) {
464 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
467 const size_t num_indexes = indexes.size();
468 for (
size_t i = 0; i < num_indexes; ++i) {
469 uint32_t value = indexes[i];
476 name_to_index_map.
Append(name, value);
481 name_to_index_map.
Append(name, value);
488 std::vector<uint32_t> &indexes,
490 uint32_t end_index)
const {
491 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
493 uint32_t prev_size = indexes.size();
495 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
497 for (uint32_t i = start_idx; i < count; ++i) {
499 indexes.push_back(i);
502 return indexes.size() - prev_size;
507 std::vector<uint32_t> &indexes, uint32_t start_idx,
508 uint32_t end_index)
const {
509 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
511 uint32_t prev_size = indexes.size();
513 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
515 for (uint32_t i = start_idx; i < count; ++i) {
517 m_symbols[i].GetType() == symbol_type) &&
519 indexes.push_back(i);
522 return indexes.size() - prev_size;
526 Debug symbol_debug_type,
528 std::vector<uint32_t> &indexes,
530 uint32_t end_index)
const {
531 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
533 uint32_t prev_size = indexes.size();
535 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
537 for (uint32_t i = start_idx; i < count; ++i) {
541 indexes.push_back(i);
545 return indexes.size() - prev_size;
551 if (symbol >= first_symbol && symbol < first_symbol +
m_symbols.size())
552 return symbol - first_symbol;
563struct SymbolIndexComparator {
564 const std::vector<Symbol> &symbols;
565 std::vector<lldb::addr_t> &addr_cache;
578 SymbolIndexComparator(
const std::vector<Symbol> &s,
579 std::vector<lldb::addr_t> &a)
580 : symbols(s), addr_cache(a) {
581 assert(symbols.size() == addr_cache.size());
583 bool operator()(uint32_t index_a, uint32_t index_b) {
584 addr_t value_a = addr_cache[index_a];
586 value_a = symbols[index_a].GetAddressRef().GetFileAddress();
587 addr_cache[index_a] = value_a;
590 addr_t value_b = addr_cache[index_b];
592 value_b = symbols[index_b].GetAddressRef().GetFileAddress();
593 addr_cache[index_b] = value_b;
596 if (value_a == value_b) {
605 }
else if (value_a < value_b)
614 bool remove_duplicates)
const {
615 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
618 if (indexes.size() <= 1)
628 SymbolIndexComparator comparator(
m_symbols, addr_cache);
629 std::stable_sort(indexes.begin(), indexes.end(), comparator);
632 if (remove_duplicates) {
633 auto last = std::unique(indexes.begin(), indexes.end());
634 indexes.erase(last, indexes.end());
639 std::vector<uint32_t> &indexes) {
641 const uint32_t count = name_to_index.GetValues(symbol_name, indexes);
655 unsigned long long uid = 0;
656 if (getAsUnsignedInteger(name, 10, uid))
659 if (symbol ==
nullptr)
664 indexes.push_back(symbol_idx);
669 std::vector<uint32_t> &indexes) {
670 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
682 Debug symbol_debug_type,
684 std::vector<uint32_t> &indexes) {
685 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
689 const size_t old_size = indexes.size();
693 std::vector<uint32_t> all_name_indexes;
694 const size_t name_match_count =
696 for (
size_t i = 0; i < name_match_count; ++i) {
699 indexes.push_back(all_name_indexes[i]);
701 return indexes.size() - old_size;
709 std::vector<uint32_t> &indexes) {
710 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
713 std::vector<uint32_t>::iterator pos = indexes.begin();
714 while (pos != indexes.end()) {
716 m_symbols[*pos].GetType() == symbol_type)
719 pos = indexes.erase(pos);
722 return indexes.size();
728 std::vector<uint32_t> &indexes) {
729 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
732 symbol_visibility, indexes) > 0) {
733 std::vector<uint32_t>::iterator pos = indexes.begin();
734 while (pos != indexes.end()) {
736 m_symbols[*pos].GetType() == symbol_type)
739 pos = indexes.erase(pos);
742 return indexes.size();
748 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
750 uint32_t prev_size = indexes.size();
753 for (uint32_t i = 0; i < sym_end; i++) {
757 m_symbols[i].GetMangled().GetName(name_preference).AsCString();
760 indexes.push_back(i);
764 return indexes.size() - prev_size;
771 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
773 uint32_t prev_size = indexes.size();
776 for (uint32_t i = 0; i < sym_end; i++) {
783 m_symbols[i].GetMangled().GetName(name_preference).AsCString();
786 indexes.push_back(i);
790 return indexes.size() - prev_size;
794 Debug symbol_debug_type,
796 uint32_t &start_idx) {
797 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
800 for (
size_t idx = start_idx; idx < count; ++idx) {
802 m_symbols[idx].GetType() == symbol_type) {
815 std::vector<uint32_t> &symbol_indexes) {
816 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
832 Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
833 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
845 symbol_visibility, symbol_indexes);
852 std::vector<uint32_t> &symbol_indexes,
854 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
857 symbol_visibility, symbol_indexes,
863 Debug symbol_debug_type,
865 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
871 std::vector<uint32_t> matching_indexes;
877 std::vector<uint32_t>::const_iterator pos, end = matching_indexes.end();
878 for (pos = matching_indexes.begin(); pos != end; ++pos) {
881 if (symbol->
Compare(name, symbol_type))
902 for (
int i = 0; i < num_sections; i++) {
905 SectionList &child_sectlist = sect_sp->GetChildren();
912 size_t size = sect_sp->GetByteSize();
914 addr_t base_addr = sect_sp->GetFileAddress();
918 section_ranges.
Append(entry);
934 if (pos->ValueIsAddress()) {
935 entry.
SetRangeBase(pos->GetAddressRef().GetFileAddress());
937 entry.
data = std::distance(begin, pos);
942 if (num_entries > 0) {
954 section_ranges.
Sort();
961 for (
size_t i = 0; i < num_entries; i++) {
971 if (containing_section) {
977 for (
size_t j = i; j < num_entries; j++) {
981 if (next_base_addr > curr_base_addr) {
982 addr_t size_to_next_symbol = next_base_addr - curr_base_addr;
986 if (sym_size == 0 || size_to_next_symbol < sym_size) {
987 sym_size = size_to_next_symbol;
1009 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1018 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1033 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1049 addr_t file_addr, std::function<
bool(
Symbol *)>
const &callback) {
1050 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1055 std::vector<uint32_t> all_addr_indexes;
1058 const size_t addr_match_count =
1062 for (
size_t i = 0; i < addr_match_count; ++i) {
1065 if (!callback(symbol))
1076 const bool merge_symbol_into_function =
true;
1077 size_t num_indices = symbol_indexes.size();
1078 if (num_indices > 0) {
1081 for (
size_t i = 0; i < num_indices; i++) {
1091 std::vector<uint32_t> symbol_indexes;
1095 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
1097 if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) {
1098 std::vector<uint32_t> temp_symbol_indexes;
1101 unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
1102 if (temp_symbol_indexes_size > 0) {
1103 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1104 for (
unsigned i = 0; i < temp_symbol_indexes_size; i++) {
1113 symbol_indexes.push_back(temp_symbol_indexes[i]);
1126 for (lldb::FunctionNameType type :
1127 {lldb::eFunctionNameTypeBase, lldb::eFunctionNameTypeMethod,
1128 lldb::eFunctionNameTypeSelector}) {
1129 if (name_type_mask & type) {
1133 for (match = map.FindFirstValueForName(name); match !=
nullptr;
1134 match = map.FindNextValueForName(match)) {
1135 symbol_indexes.push_back(match->
value);
1140 if (!symbol_indexes.empty()) {
1141 llvm::sort(symbol_indexes);
1142 symbol_indexes.erase(
1143 std::unique(symbol_indexes.begin(), symbol_indexes.end()),
1144 symbol_indexes.end());
1151 if (child_idx !=
UINT32_MAX && child_idx > 0) {
1152 for (uint32_t idx = child_idx - 1; idx !=
UINT32_MAX; --idx) {
1155 if (sibling_idx !=
UINT32_MAX && sibling_idx > child_idx)
1164 llvm::raw_string_ostream strm(key);
1193 for (
const auto &entry: cstr_map) {
1195 assert((
bool)entry.cstring);
1204 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1207 const uint32_t count = data.
GetU32(offset_ptr);
1209 for (uint32_t i=0; i<count; ++i)
1211 llvm::StringRef str(strtab.
Get(data.
GetU32(offset_ptr)));
1212 uint32_t value = data.
GetU32(offset_ptr);
1250 if (!signature.
Encode(encoder))
1266 symbol.Encode(symtab_encoder, strtab);
1271 size_t num_cmaps_offset = symtab_encoder.
GetByteSize();
1272 uint8_t num_cmaps = 0;
1275 if (pair.second.IsEmpty())
1278 symtab_encoder.
AppendU8(pair.first);
1282 symtab_encoder.
PutU8(num_cmaps_offset, num_cmaps);
1292 bool &signature_mismatch) {
1293 signature_mismatch =
false;
1298 if (!signature.
Decode(data, offset_ptr))
1301 signature_mismatch =
true;
1305 if (!strtab.
Decode(data, offset_ptr))
1309 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1312 const uint32_t version = data.
GetU32(offset_ptr);
1315 const uint32_t num_symbols = data.
GetU32(offset_ptr);
1316 if (num_symbols == 0)
1320 for (uint32_t i=0; i<num_symbols; ++i) {
1328 const uint8_t num_cstr_maps = data.
GetU8(offset_ptr);
1329 for (uint8_t i=0; i<num_cstr_maps; ++i) {
1330 uint8_t type = data.
GetU8(offset_ptr);
1346 std::unique_ptr<llvm::MemoryBuffer> mem_buffer_up =
1351 mem_buffer_up->getBufferSize(),
1354 bool signature_mismatch =
false;
1356 const bool result =
Decode(data, &offset, signature_mismatch);
1357 if (signature_mismatch)
constexpr uint32_t CURRENT_CACHE_VERSION
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
constexpr llvm::StringLiteral kIdentifierSymbolTable("SYMB")
bool DecodeCStrMap(const DataExtractor &data, lldb::offset_t *offset_ptr, const StringTableReader &strtab, UniqueCStringMap< uint32_t > &cstr_map)
static int CompareSymbolID(const void *key, const void *p)
static void EncodeCStrMap(DataEncoder &encoder, ConstStringTable &strtab, const UniqueCStringMap< uint32_t > &cstr_map)
static bool lldb_skip_name(llvm::StringRef mangled, Mangled::ManglingScheme scheme)
static void AddSectionsToRangeMap(SectionList *sectlist, RangeVector< addr_t, addr_t > §ion_ranges)
constexpr llvm::StringLiteral kIdentifierCStrMap("CMAP")
#define LLDB_SCOPED_TIMER()
Many cache files require string tables to store data efficiently.
bool Encode(DataEncoder &encoder)
uint32_t Add(ConstString s)
Add a string into the string table.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
An binary data encoding class.
lldb::ByteOrder GetByteOrder() const
uint32_t PutU8(uint32_t offset, uint8_t value)
Encode an unsigned integer at offset offset.
llvm::ArrayRef< uint8_t > GetData() const
Get a access to the bytes that this references.
void AppendU32(uint32_t value)
size_t GetByteSize() const
Get the number of bytes contained in this object.
void AppendU8(uint8_t value)
Append a unsigned integer to the end of the owned data.
void AppendData(llvm::StringRef data)
Append a bytes to the end of the owned data.
uint8_t GetAddressByteSize() const
The address size to use when encoding pointers or addresses.
This class enables data to be cached into a directory using the llvm caching code.
std::unique_ptr< llvm::MemoryBuffer > GetCachedData(llvm::StringRef key)
Get cached data from the cache directory for the specified key.
bool SetCachedData(llvm::StringRef key, llvm::ArrayRef< uint8_t > data)
Set cached data for the specified key.
Status RemoveCacheFile(llvm::StringRef key)
Remove the cache file associated with the key.
A class that measures elapsed time in an exception safe way.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
static void ForEach(std::function< bool(Language *)> callback)
A class that handles mangled names.
bool GetRichManglingInfo(RichManglingContext &context, SkipMangledNameFn *skip_mangled_name)
Get rich mangling information.
ConstString GetDemangledName() const
Demangled name get accessor.
ConstString & GetMangledName()
Mangled name get accessor.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
static DataFileCache * GetIndexCache()
Get the global index file cache.
A plug-in interface definition class for object file parsers.
virtual llvm::StringRef StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
virtual lldb::ByteOrder GetByteOrder() const =0
Gets whether endian swapping should occur when extracting data from this object file.
virtual uint32_t GetAddressByteSize() const =0
Gets the address size in bytes for the current object file.
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
uint32_t GetCacheHash()
Get a hash that can be used for caching object file releated information.
uint32_t FindEntryIndexesThatContain(B addr, std::vector< uint32_t > &indexes)
Entry & GetEntryRef(size_t i)
Entry * GetMutableEntryAtIndex(size_t i)
const Entry * FindEntryStartsAt(B addr) const
void Append(const Entry &entry)
Entry * FindEntryThatContains(B addr)
const Entry * FindEntryThatContains(B addr) const
void Append(const Entry &entry)
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
Uniform wrapper for access to rich mangling information from different providers.
llvm::StringRef ParseFunctionDeclContextName()
Get the context name for a function.
llvm::StringRef ParseFunctionBaseName()
Get the base name of a function.
bool IsCtorOrDtor() const
If this symbol describes a constructor or destructor.
size_t GetNumSections(uint32_t depth) const
lldb::SectionSP GetSectionAtIndex(size_t idx) const
A stream class that can stream formatted output to a file.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Many cache files require string tables to store data efficiently.
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr)
llvm::StringRef Get(uint32_t offset) const
Defines a list of symbol context objects.
bool AppendIfUnique(const SymbolContext &sc, bool merge_symbol_into_function)
Defines a symbol context baton that can be handed other debug core functions.
lldb::ModuleSP module_sp
The Module for a given query.
Symbol * symbol
The Symbol for a given query.
uint32_t GetSiblingIndex() const
void SetSizeIsSynthesized(bool b)
bool ContainsLinkerAnnotations() const
lldb::addr_t GetFileAddress() const
bool ContainsFileAddress(lldb::addr_t file_addr) const
bool IsTrampoline() const
bool IsSyntheticWithAutoGeneratedName() const
bool Compare(ConstString name, lldb::SymbolType type) const
static llvm::StringRef GetSyntheticSymbolPrefix()
lldb::SymbolType GetType() const
void SetByteSize(lldb::addr_t size)
void Dump(Stream *s, Target *target, uint32_t index, Mangled::NamePreference name_preference=Mangled::ePreferDemangled) const
Symbol * FindSymbolByID(lldb::user_id_t uid) const
Symbol * SymbolAtIndex(size_t idx)
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
bool m_name_indexes_computed
void ForEachSymbolContainingFileAddress(lldb::addr_t file_addr, std::function< bool(Symbol *)> const &callback)
void AppendSymbolNamesToMap(const IndexCollection &indexes, bool add_demangled, bool add_mangled, NameToIndexMap &name_to_index_map) const
Symbol * Resize(size_t count)
Symbol * FindSymbolAtFileAddress(lldb::addr_t file_addr)
Symbol * FindSymbolContainingFileAddress(lldb::addr_t file_addr)
FileRangeToIndexMap m_file_addr_to_index
std::recursive_mutex m_mutex
Symbol * FindSymbolWithType(lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx)
void SortSymbolIndexesByValue(std::vector< uint32_t > &indexes, bool remove_duplicates) const
uint32_t AddSymbol(const Symbol &symbol)
void FindAllSymbolsMatchingRexExAndType(const RegularExpression ®ex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &symbol_indexes, Mangled::NamePreference name_preference=Mangled::ePreferDemangled)
uint32_t GetNameIndexes(ConstString symbol_name, std::vector< uint32_t > &indexes)
A helper function that looks up full function names.
void Dump(Stream *s, Target *target, SortOrder sort_type, Mangled::NamePreference name_preference=Mangled::ePreferDemangled)
uint32_t AppendSymbolIndexesWithName(ConstString symbol_name, std::vector< uint32_t > &matches)
void RegisterBacklogEntry(const NameToIndexMap::Entry &entry, const char *decl_context, const std::set< const char * > &class_contexts)
static void DumpSymbolHeader(Stream *s)
uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const
void RegisterMangledNameEntry(uint32_t value, std::set< const char * > &class_contexts, std::vector< std::pair< NameToIndexMap::Entry, const char * > > &backlog, RichManglingContext &rmc)
void SaveToCache()
Save the symbol table data out into a cache.
void SetWasLoadedFromCache()
std::vector< uint32_t > IndexCollection
size_t GetNumSymbols() const
uint32_t GetIndexForSymbol(const Symbol *symbol) const
void SectionFileAddressesChanged()
bool m_file_addr_to_index_computed
bool CheckSymbolAtIndex(size_t idx, Debug symbol_debug_type, Visibility symbol_visibility) const
Symtab(ObjectFile *objfile)
std::map< lldb::FunctionNameType, UniqueCStringMap< uint32_t > > m_name_to_symbol_indices
Maps function names to symbol indices (grouped by FunctionNameTypes)
void FindAllSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes)
uint32_t AppendSymbolIndexesWithTypeAndFlagsValue(lldb::SymbolType symbol_type, uint32_t flags_value, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const
void InitAddressIndexes()
std::string GetCacheKey()
Get the cache key string for this symbol table.
void Reserve(size_t count)
const Symbol * GetParent(Symbol *symbol) const
Get the parent symbol for the given symbol.
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr, bool &uuid_mismatch)
Decode a serialized version of this object from data.
void SetWasSavedToCache()
bool Encode(DataEncoder &encoder) const
Encode this object into a data encoder object.
collection::const_iterator const_iterator
uint32_t AppendSymbolIndexesWithNameAndType(ConstString symbol_name, lldb::SymbolType symbol_type, std::vector< uint32_t > &matches)
void SymbolIndicesToSymbolContextList(std::vector< uint32_t > &symbol_indexes, SymbolContextList &sc_list)
bool LoadFromCache()
Load the symbol table from the index cache.
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list)
UniqueCStringMap< uint32_t > & GetNameToSymbolIndexMap(lldb::FunctionNameType type)
uint32_t AppendSymbolIndexesMatchingRegExAndType(const RegularExpression ®ex, lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, Mangled::NamePreference name_preference=Mangled::ePreferDemangled)
void Append(ConstString unique_cstr, const T &value)
#define LLDB_INVALID_ADDRESS
lldb::ByteOrder InlHostByteOrder()
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Section > SectionSP
const uint32_t * match_index_ptr
const bool sort_by_load_addr
A signature for a given file on disk.
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr)
Decode a serialized version of this object from data.
bool Encode(DataEncoder &encoder) const
Encode this object into a data encoder object.
BaseType GetRangeBase() const
SizeType GetByteSize() const
void SetRangeBase(BaseType b)
Set the start value for the range, and keep the same size.
void SetByteSize(SizeType s)