28#include "llvm/ADT/ArrayRef.h"
29#include "llvm/ADT/StringRef.h"
30#include "llvm/Support/DJB.h"
67 name_to_index.Clear();
76 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
87 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
92 llvm::StringRef object_name;
94 object_name =
m_objfile->GetModule()->GetObjectName();
97 s->
Format(
"Symtab, file = {0}{1}{2}{3}, num_symbols = {4}",
98 file_spec.
GetPath(), !object_name.empty() ?
"(" :
"",
99 !object_name.empty() ? object_name :
"",
100 !object_name.empty() ?
")" :
"", (uint64_t)
m_symbols.size());
102 s->
Printf(
"Symtab, num_symbols = %" PRIu64
"", (uint64_t)
m_symbols.size());
105 switch (sort_order) {
113 pos->Dump(s, target, std::distance(begin, pos), name_preference);
124 std::multimap<llvm::StringRef, const Symbol *> name_map;
126 name_map.emplace(symbol.GetName().GetStringRef(), &symbol);
128 for (
const auto &name_to_symbol : name_map) {
129 const Symbol *symbol = name_to_symbol.second;
131 symbol->
Dump(s, target, symbol - &
m_symbols[0], name_preference);
139 std::multimap<size_t, const Symbol *, std::greater<size_t>> size_map;
141 size_map.emplace(symbol.GetByteSize(), &symbol);
144 for (
const auto &size_to_symbol : size_map) {
145 const Symbol *symbol = size_to_symbol.second;
147 symbol->
Dump(s, target, idx++, name_preference);
157 for (
size_t i = 0; i < num_entries; ++i) {
160 m_symbols[symbol_idx].Dump(s, target, symbol_idx, name_preference);
171 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
176 s->
Printf(
"Symtab %" PRIu64
" symbol indexes (%" PRIu64
" symbols total):\n",
177 (uint64_t)indexes.size(), (uint64_t)
m_symbols.size());
180 if (!indexes.empty()) {
181 std::vector<uint32_t>::const_iterator pos;
182 std::vector<uint32_t>::const_iterator end = indexes.end();
184 for (pos = indexes.begin(); pos != end; ++pos) {
186 if (idx < num_symbols) {
188 m_symbols[idx].Dump(s, target, idx, name_preference);
196 s->
Indent(
" Debug symbol\n");
197 s->
Indent(
" |Synthetic symbol\n");
198 s->
Indent(
" ||Externally Visible\n");
200 s->
Indent(
"Index UserID DSX Type File Address/Value Load "
201 "Address Size Flags Name\n");
202 s->
Indent(
"------- ------ --- --------------- ------------------ "
203 "------------------ ------------------ ---------- "
204 "----------------------------------\n");
210 if (match_uid < symbol_uid)
212 if (match_uid > symbol_uid)
218 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
252 std::vector<Language *> languages;
254 languages.push_back(
l);
259 auto &basename_to_index =
261 auto &method_to_index =
263 auto &selector_to_index =
266 const size_t num_symbols =
m_symbols.size();
267 name_to_index.Reserve(num_symbols);
271 std::set<const char *> class_contexts;
272 std::vector<std::pair<NameToIndexMap::Entry, const char *>> backlog;
273 backlog.reserve(num_symbols / 2);
278 std::array<std::unique_ptr<Language::MangledNameParser>,
281 std::bitset<Mangled::kNumManglingSchemes> created_parsers;
282 auto parse_function_name =
283 [&](
const Mangled &mangled) -> std::optional<Mangled::FunctionNameParts> {
286 if (!created_parsers.test(scheme)) {
287 created_parsers.set(scheme);
289 parsers[scheme] = lang->CreateMangledNameParser(scheme);
291 if (!parsers[scheme])
293 return parsers[scheme]->Parse(mangled);
295 for (
size_t value = 0; value < num_symbols; ++value) {
311 name_to_index.Append(name, value);
317 m_objfile->StripLinkerSymbolAnnotations(name.GetStringRef()));
318 name_to_index.Append(stripped, value);
323 if (std::optional<Mangled::FunctionNameParts> parts =
324 parse_function_name(mangled)) {
334 name_to_index.Append(name, value);
340 m_objfile->StripLinkerSymbolAnnotations(name.GetStringRef()));
341 name_to_index.Append(name, value);
347 for (
auto variant : lang->GetMethodNameVariants(name)) {
348 if (variant.GetType() & lldb::eFunctionNameTypeSelector)
349 selector_to_index.Append(
ConstString(variant.GetName()), value);
350 else if (variant.GetType() & lldb::eFunctionNameTypeFull)
351 name_to_index.Append(
ConstString(variant.GetName()), value);
352 else if (variant.GetType() & lldb::eFunctionNameTypeMethod)
353 method_to_index.Append(
ConstString(variant.GetName()), value);
354 else if (variant.GetType() & lldb::eFunctionNameTypeBase)
355 basename_to_index.Append(
ConstString(variant.GetName()), value);
361 for (
const auto &record : backlog)
364 name_to_index.Sort();
365 name_to_index.SizeToFit();
366 selector_to_index.Sort();
367 selector_to_index.SizeToFit();
368 basename_to_index.Sort();
369 basename_to_index.SizeToFit();
370 method_to_index.Sort();
371 method_to_index.SizeToFit();
376 std::set<const char *> &class_contexts,
377 std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog) {
383 NameToIndexMap::Entry entry(parts.
basename, value);
385 switch (parts.
kind) {
413 if (class_contexts.count(decl_context_ccstr)) {
420 backlog.push_back(std::make_pair(entry, decl_context_ccstr));
424 llvm_unreachable(
"unknown function name kind");
428 const NameToIndexMap::Entry &entry,
const char *decl_context,
429 const std::set<const char *> &class_contexts) {
430 auto &method_to_index =
432 auto it = class_contexts.find(decl_context);
433 if (it != class_contexts.end()) {
434 method_to_index.Append(entry);
438 method_to_index.Append(entry);
439 auto &basename_to_index =
441 basename_to_index.Append(entry);
446 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
451 bool add_demangled,
bool add_mangled,
454 if (add_demangled || add_mangled) {
455 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
458 const size_t num_indexes = indexes.size();
459 for (
size_t i = 0; i < num_indexes; ++i) {
460 uint32_t value = indexes[i];
467 name_to_index_map.
Append(name, value);
472 name_to_index_map.
Append(name, value);
479 std::vector<uint32_t> &indexes,
481 uint32_t end_index)
const {
482 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
484 uint32_t prev_size = indexes.size();
486 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
488 for (uint32_t i = start_idx; i < count; ++i) {
490 indexes.push_back(i);
493 return indexes.size() - prev_size;
498 std::vector<uint32_t> &indexes, uint32_t start_idx,
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 m_symbols[i].GetType() == symbol_type) &&
510 indexes.push_back(i);
513 return indexes.size() - prev_size;
517 Debug symbol_debug_type,
519 std::vector<uint32_t> &indexes,
521 uint32_t end_index)
const {
522 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
524 uint32_t prev_size = indexes.size();
526 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
528 for (uint32_t i = start_idx; i < count; ++i) {
532 indexes.push_back(i);
536 return indexes.size() - prev_size;
542 if (symbol >= first_symbol && symbol < first_symbol +
m_symbols.size())
543 return symbol - first_symbol;
554struct SymbolIndexComparator {
555 const std::vector<Symbol> &symbols;
556 std::vector<lldb::addr_t> &addr_cache;
569 SymbolIndexComparator(
const std::vector<Symbol> &s,
570 std::vector<lldb::addr_t> &a)
571 : symbols(s), addr_cache(a) {
572 assert(symbols.size() == addr_cache.size());
574 bool operator()(uint32_t index_a, uint32_t index_b) {
575 addr_t value_a = addr_cache[index_a];
577 value_a = symbols[index_a].GetAddressRef().GetFileAddress();
578 addr_cache[index_a] = value_a;
581 addr_t value_b = addr_cache[index_b];
583 value_b = symbols[index_b].GetAddressRef().GetFileAddress();
584 addr_cache[index_b] = value_b;
587 if (value_a == value_b) {
596 }
else if (value_a < value_b)
605 bool remove_duplicates)
const {
606 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
609 if (indexes.size() <= 1)
619 SymbolIndexComparator comparator(
m_symbols, addr_cache);
620 llvm::stable_sort(indexes, comparator);
623 if (remove_duplicates) {
624 auto last = llvm::unique(indexes);
625 indexes.erase(last, indexes.end());
630 std::vector<uint32_t> &indexes) {
632 const uint32_t count = name_to_index.GetValues(symbol_name, indexes);
646 unsigned long long file_address = 0;
647 if (getAsUnsignedInteger(name, 16, file_address))
652 if (symbol ==
nullptr)
657 indexes.push_back(symbol_idx);
662 std::vector<uint32_t> &indexes) {
663 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
674 Debug symbol_debug_type,
676 std::vector<uint32_t> &indexes) {
677 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
681 const size_t old_size = indexes.size();
684 std::vector<uint32_t> all_name_indexes;
685 const size_t name_match_count =
687 for (
size_t i = 0; i < name_match_count; ++i) {
690 indexes.push_back(all_name_indexes[i]);
692 return indexes.size() - old_size;
700 std::vector<uint32_t> &indexes) {
701 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
705 llvm::erase_if(indexes, [
this, symbol_type](uint32_t index) {
706 return m_symbols[index].GetType() != symbol_type;
709 return indexes.size();
715 std::vector<uint32_t> &indexes) {
716 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
719 symbol_visibility, indexes) > 0 &&
721 llvm::erase_if(indexes, [
this, symbol_type](uint32_t index) {
722 return m_symbols[index].GetType() != symbol_type;
725 return indexes.size();
731 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
733 uint32_t prev_size = indexes.size();
736 for (uint32_t i = 0; i < sym_end; i++) {
740 m_symbols[i].GetMangled().GetName(name_preference).AsCString(
nullptr);
743 indexes.push_back(i);
747 return indexes.size() - prev_size;
754 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
756 uint32_t prev_size = indexes.size();
759 for (uint32_t i = 0; i < sym_end; i++) {
766 m_symbols[i].GetMangled().GetName(name_preference).AsCString(
nullptr);
769 indexes.push_back(i);
773 return indexes.size() - prev_size;
777 Debug symbol_debug_type,
779 uint32_t &start_idx) {
780 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
783 for (
size_t idx = start_idx; idx < count; ++idx) {
785 m_symbols[idx].GetType() == symbol_type) {
798 std::vector<uint32_t> &symbol_indexes) {
799 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
814 Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
815 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
826 symbol_visibility, symbol_indexes);
833 std::vector<uint32_t> &symbol_indexes,
835 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
838 symbol_visibility, symbol_indexes,
844 Debug symbol_debug_type,
846 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
851 std::vector<uint32_t> matching_indexes;
857 std::vector<uint32_t>::const_iterator pos, end = matching_indexes.end();
858 for (pos = matching_indexes.begin(); pos != end; ++pos) {
861 if (symbol->
Compare(name, symbol_type))
882 for (
int i = 0; i < num_sections; i++) {
885 SectionList &child_sectlist = sect_sp->GetChildren();
892 size_t size = sect_sp->GetByteSize();
894 addr_t base_addr = sect_sp->GetFileAddress();
898 section_ranges.
Append(entry);
914 if (pos->ValueIsAddress()) {
915 entry.
SetRangeBase(pos->GetAddressRef().GetFileAddress());
917 entry.
data = std::distance(begin, pos);
922 if (num_entries > 0) {
934 section_ranges.
Sort();
941 for (
size_t i = 0; i < num_entries; i++) {
951 if (containing_section) {
957 for (
size_t j = i; j < num_entries; j++) {
961 if (next_base_addr > curr_base_addr) {
962 addr_t size_to_next_symbol = next_base_addr - curr_base_addr;
966 if (sym_size == 0 || size_to_next_symbol < sym_size) {
967 sym_size = size_to_next_symbol;
989 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
998 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1013 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1029 addr_t file_addr, std::function<
bool(
Symbol *)>
const &callback) {
1030 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1035 std::vector<uint32_t> all_addr_indexes;
1038 const size_t addr_match_count =
1042 for (
size_t i = 0; i < addr_match_count; ++i) {
1045 if (!callback(symbol))
1056 const bool merge_symbol_into_function =
true;
1057 size_t num_indices = symbol_indexes.size();
1058 if (num_indices > 0) {
1061 for (
size_t i = 0; i < num_indices; i++) {
1071 std::vector<uint32_t> symbol_indexes;
1075 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
1077 if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) {
1078 std::vector<uint32_t> temp_symbol_indexes;
1081 unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
1082 if (temp_symbol_indexes_size > 0) {
1083 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1084 for (
unsigned i = 0; i < temp_symbol_indexes_size; i++) {
1093 symbol_indexes.push_back(temp_symbol_indexes[i]);
1103 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1106 for (lldb::FunctionNameType type :
1107 {lldb::eFunctionNameTypeBase, lldb::eFunctionNameTypeMethod,
1108 lldb::eFunctionNameTypeSelector}) {
1109 if (name_type_mask & type) {
1113 for (match = map.FindFirstValueForName(name); match !=
nullptr;
1114 match = map.FindNextValueForName(match)) {
1115 symbol_indexes.push_back(match->
value);
1120 if (!symbol_indexes.empty()) {
1121 llvm::sort(symbol_indexes);
1122 symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end());
1129 if (child_idx !=
UINT32_MAX && child_idx > 0) {
1130 for (uint32_t idx = child_idx - 1; idx !=
UINT32_MAX; --idx) {
1133 if (sibling_idx !=
UINT32_MAX && sibling_idx > child_idx)
1142 llvm::raw_string_ostream strm(key);
1146 strm <<
m_objfile->GetModule()->GetCacheKey() <<
"-symtab-"
1147 << llvm::format_hex(
m_objfile->GetCacheHash(), 10);
1173 for (
const auto &entry: cstr_map) {
1175 assert((
bool)entry.cstring);
1184 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1187 const uint32_t count = data.
GetU32(offset_ptr);
1189 for (uint32_t i=0; i<count; ++i)
1191 llvm::StringRef str(strtab.
Get(data.
GetU32(offset_ptr)));
1192 uint32_t value = data.
GetU32(offset_ptr);
1217#if __SIZEOF_POINTER__ == 8
1220 "Symbol size has changed, DataFileCache version likely needs updating");
1239 if (!signature.
Encode(encoder))
1255 symbol.Encode(symtab_encoder, strtab);
1260 size_t num_cmaps_offset = symtab_encoder.
GetByteSize();
1261 uint8_t num_cmaps = 0;
1264 if (pair.second.IsEmpty())
1267 symtab_encoder.
AppendU8(pair.first);
1271 symtab_encoder.
PutU8(num_cmaps_offset, num_cmaps);
1281 bool &signature_mismatch) {
1282 signature_mismatch =
false;
1287 if (!signature.
Decode(data, offset_ptr))
1290 signature_mismatch =
true;
1294 if (!strtab.
Decode(data, offset_ptr))
1298 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1301 const uint32_t version = data.
GetU32(offset_ptr);
1304 const uint32_t num_symbols = data.
GetU32(offset_ptr);
1305 if (num_symbols == 0)
1309 for (uint32_t i=0; i<num_symbols; ++i) {
1317 const uint8_t num_cstr_maps = data.
GetU8(offset_ptr);
1318 for (uint8_t i=0; i<num_cstr_maps; ++i) {
1319 uint8_t type = data.
GetU8(offset_ptr);
1335 std::unique_ptr<llvm::MemoryBuffer> mem_buffer_up =
1340 mem_buffer_up->getBufferSize(),
1343 bool signature_mismatch =
false;
1345 const bool result =
Decode(data, &offset, signature_mismatch);
1346 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 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 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)
static Language * FindPluginForManglingScheme(Mangled::ManglingScheme scheme)
Returns the Language that handles names mangled with scheme, or a nullptr if there is none.
A class that handles mangled names.
ConstString GetMangledName() const
Mangled name get accessor.
@ ConstructorOrDestructor
ConstString GetDemangledName() const
Demangled name get accessor.
static constexpr size_t kNumManglingSchemes
The number of mangling schemes.
static Mangled::ManglingScheme GetManglingScheme(llvm::StringRef name)
Try to identify the mangling scheme used.
static DataFileCache * GetIndexCache(bool memory_module)
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...
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.
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
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
void RegisterMangledNameEntry(uint32_t value, const Mangled::FunctionNameParts &parts, std::set< const char * > &class_contexts, std::vector< std::pair< NameToIndexMap::Entry, const char * > > &backlog)
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 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.
The parts of a mangled function name used in the symbol table's indices.
ConstString basename
If empty, the symbol is only indexed by its mangled name.
ConstString decl_context
The enclosing context.
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)