27#include "llvm/ADT/ArrayRef.h"
28#include "llvm/ADT/StringRef.h"
29#include "llvm/Support/DJB.h"
66 name_to_index.Clear();
75 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
86 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
91 const char *object_name =
nullptr;
93 object_name =
m_objfile->GetModule()->GetObjectName().GetCString();
96 s->
Printf(
"Symtab, file = %s%s%s%s, num_symbols = %" PRIu64,
97 file_spec.
GetPath().c_str(), object_name ?
"(" :
"",
98 object_name ? object_name :
"", object_name ?
")" :
"",
101 s->
Printf(
"Symtab, num_symbols = %" PRIu64
"", (uint64_t)
m_symbols.size());
104 switch (sort_order) {
112 pos->Dump(s, target, std::distance(begin, pos), name_preference);
123 std::multimap<llvm::StringRef, const Symbol *> name_map;
125 name_map.emplace(symbol.GetName().GetStringRef(), &symbol);
127 for (
const auto &name_to_symbol : name_map) {
128 const Symbol *symbol = name_to_symbol.second;
130 symbol->
Dump(s, target, symbol - &
m_symbols[0], name_preference);
138 std::multimap<size_t, const Symbol *, std::greater<size_t>> size_map;
140 size_map.emplace(symbol.GetByteSize(), &symbol);
143 for (
const auto &size_to_symbol : size_map) {
144 const Symbol *symbol = size_to_symbol.second;
146 symbol->
Dump(s, target, idx++, name_preference);
156 for (
size_t i = 0; i < num_entries; ++i) {
159 m_symbols[symbol_idx].Dump(s, target, symbol_idx, name_preference);
170 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
175 s->
Printf(
"Symtab %" PRIu64
" symbol indexes (%" PRIu64
" symbols total):\n",
176 (uint64_t)indexes.size(), (uint64_t)
m_symbols.size());
179 if (!indexes.empty()) {
180 std::vector<uint32_t>::const_iterator pos;
181 std::vector<uint32_t>::const_iterator end = indexes.end();
183 for (pos = indexes.begin(); pos != end; ++pos) {
185 if (idx < num_symbols) {
187 m_symbols[idx].Dump(s, target, idx, name_preference);
195 s->
Indent(
" Debug symbol\n");
196 s->
Indent(
" |Synthetic symbol\n");
197 s->
Indent(
" ||Externally Visible\n");
199 s->
Indent(
"Index UserID DSX Type File Address/Value Load "
200 "Address Size Flags Name\n");
201 s->
Indent(
"------- ------ --- --------------- ------------------ "
202 "------------------ ------------------ ---------- "
203 "----------------------------------\n");
209 if (match_uid < symbol_uid)
211 if (match_uid > symbol_uid)
217 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
245 if (mangled.size() < 3 || !mangled.starts_with(
"_Z"))
249 switch (mangled[2]) {
275 llvm_unreachable(
"unknown scheme!");
288 std::vector<Language *> languages;
290 languages.push_back(
l);
295 auto &basename_to_index =
297 auto &method_to_index =
299 auto &selector_to_index =
302 const size_t num_symbols =
m_symbols.size();
303 name_to_index.Reserve(num_symbols);
307 std::set<const char *> class_contexts;
308 std::vector<std::pair<NameToIndexMap::Entry, const char *>> backlog;
309 backlog.reserve(num_symbols / 2);
314 for (
size_t value = 0; value < num_symbols; ++value) {
330 name_to_index.Append(name, value);
336 m_objfile->StripLinkerSymbolAnnotations(name.GetStringRef()));
337 name_to_index.Append(stripped, value);
352 name_to_index.Append(name, value);
358 m_objfile->StripLinkerSymbolAnnotations(name.GetStringRef()));
359 name_to_index.Append(name, value);
365 for (
auto variant : lang->GetMethodNameVariants(name)) {
366 if (variant.GetType() & lldb::eFunctionNameTypeSelector)
367 selector_to_index.Append(variant.GetName(), value);
368 else if (variant.GetType() & lldb::eFunctionNameTypeFull)
369 name_to_index.Append(variant.GetName(), value);
370 else if (variant.GetType() & lldb::eFunctionNameTypeMethod)
371 method_to_index.Append(variant.GetName(), value);
372 else if (variant.GetType() & lldb::eFunctionNameTypeBase)
373 basename_to_index.Append(variant.GetName(), value);
379 for (
const auto &record : backlog)
382 name_to_index.Sort();
383 name_to_index.SizeToFit();
384 selector_to_index.Sort();
385 selector_to_index.SizeToFit();
386 basename_to_index.Sort();
387 basename_to_index.SizeToFit();
388 method_to_index.Sort();
389 method_to_index.SizeToFit();
393 uint32_t value, std::set<const char *> &class_contexts,
394 std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog,
398 if (base_name.empty())
402 NameToIndexMap::Entry entry(
ConstString(base_name), value);
406 if (decl_context.empty()) {
408 auto &basename_to_index =
410 basename_to_index.Append(entry);
414 name_to_index.Append(entry);
421 auto it = class_contexts.find(decl_context_ccstr);
423 auto &method_to_index =
428 method_to_index.Append(entry);
429 if (it == class_contexts.end())
430 class_contexts.insert(it, decl_context_ccstr);
435 if (it != class_contexts.end()) {
436 method_to_index.Append(entry);
442 backlog.push_back(std::make_pair(entry, decl_context_ccstr));
446 const NameToIndexMap::Entry &entry,
const char *decl_context,
447 const std::set<const char *> &class_contexts) {
448 auto &method_to_index =
450 auto it = class_contexts.find(decl_context);
451 if (it != class_contexts.end()) {
452 method_to_index.Append(entry);
456 method_to_index.Append(entry);
457 auto &basename_to_index =
459 basename_to_index.Append(entry);
464 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
469 bool add_demangled,
bool add_mangled,
472 if (add_demangled || add_mangled) {
473 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
476 const size_t num_indexes = indexes.size();
477 for (
size_t i = 0; i < num_indexes; ++i) {
478 uint32_t value = indexes[i];
485 name_to_index_map.
Append(name, value);
490 name_to_index_map.
Append(name, value);
497 std::vector<uint32_t> &indexes,
499 uint32_t end_index)
const {
500 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
502 uint32_t prev_size = indexes.size();
504 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
506 for (uint32_t i = start_idx; i < count; ++i) {
508 indexes.push_back(i);
511 return indexes.size() - prev_size;
516 std::vector<uint32_t> &indexes, uint32_t start_idx,
517 uint32_t end_index)
const {
518 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
520 uint32_t prev_size = indexes.size();
522 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
524 for (uint32_t i = start_idx; i < count; ++i) {
526 m_symbols[i].GetType() == symbol_type) &&
528 indexes.push_back(i);
531 return indexes.size() - prev_size;
535 Debug symbol_debug_type,
537 std::vector<uint32_t> &indexes,
539 uint32_t end_index)
const {
540 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
542 uint32_t prev_size = indexes.size();
544 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
546 for (uint32_t i = start_idx; i < count; ++i) {
550 indexes.push_back(i);
554 return indexes.size() - prev_size;
560 if (symbol >= first_symbol && symbol < first_symbol +
m_symbols.size())
561 return symbol - first_symbol;
572struct SymbolIndexComparator {
573 const std::vector<Symbol> &symbols;
574 std::vector<lldb::addr_t> &addr_cache;
587 SymbolIndexComparator(
const std::vector<Symbol> &s,
588 std::vector<lldb::addr_t> &a)
589 : symbols(s), addr_cache(a) {
590 assert(symbols.size() == addr_cache.size());
592 bool operator()(uint32_t index_a, uint32_t index_b) {
593 addr_t value_a = addr_cache[index_a];
595 value_a = symbols[index_a].GetAddressRef().GetFileAddress();
596 addr_cache[index_a] = value_a;
599 addr_t value_b = addr_cache[index_b];
601 value_b = symbols[index_b].GetAddressRef().GetFileAddress();
602 addr_cache[index_b] = value_b;
605 if (value_a == value_b) {
614 }
else if (value_a < value_b)
623 bool remove_duplicates)
const {
624 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
627 if (indexes.size() <= 1)
637 SymbolIndexComparator comparator(
m_symbols, addr_cache);
638 llvm::stable_sort(indexes, comparator);
641 if (remove_duplicates) {
642 auto last = llvm::unique(indexes);
643 indexes.erase(last, indexes.end());
648 std::vector<uint32_t> &indexes) {
650 const uint32_t count = name_to_index.GetValues(symbol_name, indexes);
664 unsigned long long file_address = 0;
665 if (getAsUnsignedInteger(name, 16, file_address))
670 if (symbol ==
nullptr)
675 indexes.push_back(symbol_idx);
680 std::vector<uint32_t> &indexes) {
681 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
692 Debug symbol_debug_type,
694 std::vector<uint32_t> &indexes) {
695 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
699 const size_t old_size = indexes.size();
702 std::vector<uint32_t> all_name_indexes;
703 const size_t name_match_count =
705 for (
size_t i = 0; i < name_match_count; ++i) {
708 indexes.push_back(all_name_indexes[i]);
710 return indexes.size() - old_size;
718 std::vector<uint32_t> &indexes) {
719 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
723 llvm::erase_if(indexes, [
this, symbol_type](uint32_t index) {
724 return m_symbols[index].GetType() != symbol_type;
727 return indexes.size();
733 std::vector<uint32_t> &indexes) {
734 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
737 symbol_visibility, indexes) > 0 &&
739 llvm::erase_if(indexes, [
this, symbol_type](uint32_t index) {
740 return m_symbols[index].GetType() != symbol_type;
743 return indexes.size();
749 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
751 uint32_t prev_size = indexes.size();
754 for (uint32_t i = 0; i < sym_end; i++) {
758 m_symbols[i].GetMangled().GetName(name_preference).AsCString(
nullptr);
761 indexes.push_back(i);
765 return indexes.size() - prev_size;
772 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
774 uint32_t prev_size = indexes.size();
777 for (uint32_t i = 0; i < sym_end; i++) {
784 m_symbols[i].GetMangled().GetName(name_preference).AsCString(
nullptr);
787 indexes.push_back(i);
791 return indexes.size() - prev_size;
795 Debug symbol_debug_type,
797 uint32_t &start_idx) {
798 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
801 for (
size_t idx = start_idx; idx < count; ++idx) {
803 m_symbols[idx].GetType() == symbol_type) {
816 std::vector<uint32_t> &symbol_indexes) {
817 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);
844 symbol_visibility, symbol_indexes);
851 std::vector<uint32_t> &symbol_indexes,
853 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
856 symbol_visibility, symbol_indexes,
862 Debug symbol_debug_type,
864 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
869 std::vector<uint32_t> matching_indexes;
875 std::vector<uint32_t>::const_iterator pos, end = matching_indexes.end();
876 for (pos = matching_indexes.begin(); pos != end; ++pos) {
879 if (symbol->
Compare(name, symbol_type))
900 for (
int i = 0; i < num_sections; i++) {
903 SectionList &child_sectlist = sect_sp->GetChildren();
910 size_t size = sect_sp->GetByteSize();
912 addr_t base_addr = sect_sp->GetFileAddress();
916 section_ranges.
Append(entry);
932 if (pos->ValueIsAddress()) {
933 entry.
SetRangeBase(pos->GetAddressRef().GetFileAddress());
935 entry.
data = std::distance(begin, pos);
940 if (num_entries > 0) {
952 section_ranges.
Sort();
959 for (
size_t i = 0; i < num_entries; i++) {
969 if (containing_section) {
975 for (
size_t j = i; j < num_entries; j++) {
979 if (next_base_addr > curr_base_addr) {
980 addr_t size_to_next_symbol = next_base_addr - curr_base_addr;
984 if (sym_size == 0 || size_to_next_symbol < sym_size) {
985 sym_size = size_to_next_symbol;
1007 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1016 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1031 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1047 addr_t file_addr, std::function<
bool(
Symbol *)>
const &callback) {
1048 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1053 std::vector<uint32_t> all_addr_indexes;
1056 const size_t addr_match_count =
1060 for (
size_t i = 0; i < addr_match_count; ++i) {
1063 if (!callback(symbol))
1074 const bool merge_symbol_into_function =
true;
1075 size_t num_indices = symbol_indexes.size();
1076 if (num_indices > 0) {
1079 for (
size_t i = 0; i < num_indices; i++) {
1089 std::vector<uint32_t> symbol_indexes;
1093 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
1095 if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) {
1096 std::vector<uint32_t> temp_symbol_indexes;
1099 unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
1100 if (temp_symbol_indexes_size > 0) {
1101 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1102 for (
unsigned i = 0; i < temp_symbol_indexes_size; i++) {
1111 symbol_indexes.push_back(temp_symbol_indexes[i]);
1121 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1124 for (lldb::FunctionNameType type :
1125 {lldb::eFunctionNameTypeBase, lldb::eFunctionNameTypeMethod,
1126 lldb::eFunctionNameTypeSelector}) {
1127 if (name_type_mask & type) {
1131 for (match = map.FindFirstValueForName(name); match !=
nullptr;
1132 match = map.FindNextValueForName(match)) {
1133 symbol_indexes.push_back(match->
value);
1138 if (!symbol_indexes.empty()) {
1139 llvm::sort(symbol_indexes);
1140 symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end());
1147 if (child_idx !=
UINT32_MAX && child_idx > 0) {
1148 for (uint32_t idx = child_idx - 1; idx !=
UINT32_MAX; --idx) {
1151 if (sibling_idx !=
UINT32_MAX && sibling_idx > child_idx)
1160 llvm::raw_string_ostream strm(key);
1164 strm <<
m_objfile->GetModule()->GetCacheKey() <<
"-symtab-"
1165 << llvm::format_hex(
m_objfile->GetCacheHash(), 10);
1191 for (
const auto &entry: cstr_map) {
1193 assert((
bool)entry.cstring);
1202 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1205 const uint32_t count = data.
GetU32(offset_ptr);
1207 for (uint32_t i=0; i<count; ++i)
1209 llvm::StringRef str(strtab.
Get(data.
GetU32(offset_ptr)));
1210 uint32_t value = data.
GetU32(offset_ptr);
1248 if (!signature.
Encode(encoder))
1264 symbol.Encode(symtab_encoder, strtab);
1269 size_t num_cmaps_offset = symtab_encoder.
GetByteSize();
1270 uint8_t num_cmaps = 0;
1273 if (pair.second.IsEmpty())
1276 symtab_encoder.
AppendU8(pair.first);
1280 symtab_encoder.
PutU8(num_cmaps_offset, num_cmaps);
1290 bool &signature_mismatch) {
1291 signature_mismatch =
false;
1296 if (!signature.
Decode(data, offset_ptr))
1299 signature_mismatch =
true;
1303 if (!strtab.
Decode(data, offset_ptr))
1307 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1310 const uint32_t version = data.
GetU32(offset_ptr);
1313 const uint32_t num_symbols = data.
GetU32(offset_ptr);
1314 if (num_symbols == 0)
1318 for (uint32_t i=0; i<num_symbols; ++i) {
1326 const uint8_t num_cstr_maps = data.
GetU8(offset_ptr);
1327 for (uint8_t i=0; i<num_cstr_maps; ++i) {
1328 uint8_t type = data.
GetU8(offset_ptr);
1344 std::unique_ptr<llvm::MemoryBuffer> mem_buffer_up =
1349 mem_buffer_up->getBufferSize(),
1352 bool signature_mismatch =
false;
1354 const bool result =
Decode(data, &offset, signature_mismatch);
1355 if (signature_mismatch)
static 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(llvm::function_ref< IterationAction(Language *)> callback)
A class that handles mangled names.
ConstString GetMangledName() const
Mangled name get accessor.
bool GetRichManglingInfo(RichManglingContext &context, SkipMangledNameFn *skip_mangled_name)
Get rich mangling information.
ConstString GetDemangledName() const
Demangled name get accessor.
static DataFileCache * GetIndexCache()
Get the global index file cache.
A plug-in interface definition class for object file parsers.
RangeData< lldb::addr_t, lldb::addr_t, uint32_t > Entry
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
Provide thread safety for this symbol table.
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 > NameToIndexMap
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)