28#include "llvm/ADT/ArrayRef.h"
29#include "llvm/ADT/StringRef.h"
30#include "llvm/Support/DJB.h"
73 name_to_index.Clear();
84 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
95 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
100 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
105 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
110 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
123 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
128 llvm::StringRef object_name;
130 object_name =
m_objfile->GetModule()->GetObjectName();
133 s->
Format(
"Symtab, file = {0}{1}{2}{3}, num_symbols = {4}",
134 file_spec.
GetPath(), !object_name.empty() ?
"(" :
"",
135 !object_name.empty() ? object_name :
"",
136 !object_name.empty() ?
")" :
"", (uint64_t)
m_symbols.size());
138 s->
Printf(
"Symtab, num_symbols = %" PRIu64
"", (uint64_t)
m_symbols.size());
141 switch (sort_order) {
149 pos->Dump(s, target, std::distance(begin, pos), name_preference);
160 std::multimap<llvm::StringRef, const Symbol *> name_map;
162 name_map.emplace(symbol.GetName().GetStringRef(), &symbol);
164 for (
const auto &name_to_symbol : name_map) {
165 const Symbol *symbol = name_to_symbol.second;
167 symbol->
Dump(s, target, symbol - &
m_symbols[0], name_preference);
175 std::multimap<size_t, const Symbol *, std::greater<size_t>> size_map;
177 size_map.emplace(symbol.GetByteSize(), &symbol);
180 for (
const auto &size_to_symbol : size_map) {
181 const Symbol *symbol = size_to_symbol.second;
183 symbol->
Dump(s, target, idx++, name_preference);
193 for (
size_t i = 0; i < num_entries; ++i) {
196 m_symbols[symbol_idx].Dump(s, target, symbol_idx, name_preference);
207 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
212 s->
Printf(
"Symtab %" PRIu64
" symbol indexes (%" PRIu64
" symbols total):\n",
213 (uint64_t)indexes.size(), (uint64_t)
m_symbols.size());
216 if (!indexes.empty()) {
217 std::vector<uint32_t>::const_iterator pos;
218 std::vector<uint32_t>::const_iterator end = indexes.end();
220 for (pos = indexes.begin(); pos != end; ++pos) {
222 if (idx < num_symbols) {
224 m_symbols[idx].Dump(s, target, idx, name_preference);
232 s->
Indent(
" Debug symbol\n");
233 s->
Indent(
" |Synthetic symbol\n");
234 s->
Indent(
" ||Externally Visible\n");
236 s->
Indent(
"Index UserID DSX Type File Address/Value Load "
237 "Address Size Flags Name\n");
238 s->
Indent(
"------- ------ --- --------------- ------------------ "
239 "------------------ ------------------ ---------- "
240 "----------------------------------\n");
246 if (match_uid < symbol_uid)
248 if (match_uid > symbol_uid)
254 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
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 std::array<std::unique_ptr<Language::MangledNameParser>,
317 std::bitset<Mangled::g_num_mangling_schemes> created_parsers;
318 auto parse_function_name =
319 [&](
const Mangled &mangled) -> std::optional<Mangled::FunctionNameParts> {
322 if (!created_parsers.test(scheme)) {
323 created_parsers.set(scheme);
325 parsers[scheme] = lang->CreateMangledNameParser(scheme);
327 if (!parsers[scheme])
329 return parsers[scheme]->Parse(mangled);
331 for (
size_t value = 0; value < num_symbols; ++value) {
347 name_to_index.Append(name, value);
353 m_objfile->StripLinkerSymbolAnnotations(name.GetStringRef()));
354 name_to_index.Append(stripped, value);
359 if (std::optional<Mangled::FunctionNameParts> parts =
360 parse_function_name(mangled)) {
370 name_to_index.Append(name, value);
376 m_objfile->StripLinkerSymbolAnnotations(name.GetStringRef()));
377 name_to_index.Append(name, value);
383 for (
auto variant : lang->GetMethodNameVariants(name)) {
384 if (variant.GetType() & lldb::eFunctionNameTypeSelector)
385 selector_to_index.Append(
ConstString(variant.GetName()), value);
386 else if (variant.GetType() & lldb::eFunctionNameTypeFull)
387 name_to_index.Append(
ConstString(variant.GetName()), value);
388 else if (variant.GetType() & lldb::eFunctionNameTypeMethod)
389 method_to_index.Append(
ConstString(variant.GetName()), value);
390 else if (variant.GetType() & lldb::eFunctionNameTypeBase)
391 basename_to_index.Append(
ConstString(variant.GetName()), value);
397 for (
const auto &record : backlog)
400 name_to_index.Sort();
401 name_to_index.SizeToFit();
402 selector_to_index.Sort();
403 selector_to_index.SizeToFit();
404 basename_to_index.Sort();
405 basename_to_index.SizeToFit();
406 method_to_index.Sort();
407 method_to_index.SizeToFit();
412 std::set<const char *> &class_contexts,
413 std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog) {
419 NameToIndexMap::Entry entry(parts.
basename, value);
421 switch (parts.
kind) {
449 if (class_contexts.count(decl_context_ccstr)) {
456 backlog.push_back(std::make_pair(entry, decl_context_ccstr));
460 llvm_unreachable(
"unknown function name kind");
464 const NameToIndexMap::Entry &entry,
const char *decl_context,
465 const std::set<const char *> &class_contexts) {
466 auto &method_to_index =
468 auto it = class_contexts.find(decl_context);
469 if (it != class_contexts.end()) {
470 method_to_index.Append(entry);
474 method_to_index.Append(entry);
475 auto &basename_to_index =
477 basename_to_index.Append(entry);
482 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
487 std::vector<uint32_t> &indexes,
489 uint32_t end_index)
const {
490 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
492 uint32_t prev_size = indexes.size();
494 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
496 for (uint32_t i = start_idx; i < count; ++i) {
498 indexes.push_back(i);
501 return indexes.size() - prev_size;
506 std::vector<uint32_t> &indexes, uint32_t start_idx,
507 uint32_t end_index)
const {
508 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
510 uint32_t prev_size = indexes.size();
512 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
514 for (uint32_t i = start_idx; i < count; ++i) {
516 m_symbols[i].GetType() == symbol_type) &&
518 indexes.push_back(i);
521 return indexes.size() - prev_size;
525 Debug symbol_debug_type,
527 std::vector<uint32_t> &indexes,
529 uint32_t end_index)
const {
530 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
532 uint32_t prev_size = indexes.size();
534 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
536 for (uint32_t i = start_idx; i < count; ++i) {
540 indexes.push_back(i);
544 return indexes.size() - prev_size;
550 if (symbol >= first_symbol && symbol < first_symbol +
m_symbols.size())
551 return symbol - first_symbol;
562struct SymbolIndexComparator {
563 const std::vector<Symbol> &symbols;
564 std::vector<lldb::addr_t> &addr_cache;
577 SymbolIndexComparator(
const std::vector<Symbol> &s,
578 std::vector<lldb::addr_t> &a)
579 : symbols(s), addr_cache(a) {
580 assert(symbols.size() == addr_cache.size());
582 bool operator()(uint32_t index_a, uint32_t index_b) {
583 addr_t value_a = addr_cache[index_a];
585 value_a = symbols[index_a].GetAddressRef().GetFileAddress();
586 addr_cache[index_a] = value_a;
589 addr_t value_b = addr_cache[index_b];
591 value_b = symbols[index_b].GetAddressRef().GetFileAddress();
592 addr_cache[index_b] = value_b;
595 if (value_a == value_b) {
604 }
else if (value_a < value_b)
613 bool remove_duplicates)
const {
614 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
617 if (indexes.size() <= 1)
627 SymbolIndexComparator comparator(
m_symbols, addr_cache);
628 llvm::stable_sort(indexes, comparator);
631 if (remove_duplicates) {
632 auto last = llvm::unique(indexes);
633 indexes.erase(last, indexes.end());
638 std::vector<uint32_t> &indexes) {
640 const uint32_t count = name_to_index.GetValues(symbol_name, indexes);
654 unsigned long long file_address = 0;
655 if (getAsUnsignedInteger(name, 16, file_address))
660 if (symbol ==
nullptr)
665 indexes.push_back(symbol_idx);
670 std::vector<uint32_t> &indexes) {
671 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();
692 std::vector<uint32_t> all_name_indexes;
693 const size_t name_match_count =
695 for (
size_t i = 0; i < name_match_count; ++i) {
698 indexes.push_back(all_name_indexes[i]);
700 return indexes.size() - old_size;
708 std::vector<uint32_t> &indexes) {
709 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
713 llvm::erase_if(indexes, [
this, symbol_type](uint32_t index) {
714 return m_symbols[index].GetType() != symbol_type;
717 return indexes.size();
723 std::vector<uint32_t> &indexes) {
724 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
727 symbol_visibility, indexes) > 0 &&
729 llvm::erase_if(indexes, [
this, symbol_type](uint32_t index) {
730 return m_symbols[index].GetType() != symbol_type;
733 return indexes.size();
739 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
741 uint32_t prev_size = indexes.size();
744 for (uint32_t i = 0; i < sym_end; i++) {
748 m_symbols[i].GetMangled().GetName(name_preference).AsCString(
nullptr);
751 indexes.push_back(i);
755 return indexes.size() - prev_size;
762 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
764 uint32_t prev_size = indexes.size();
767 for (uint32_t i = 0; i < sym_end; i++) {
774 m_symbols[i].GetMangled().GetName(name_preference).AsCString(
nullptr);
777 indexes.push_back(i);
781 return indexes.size() - prev_size;
785 Debug symbol_debug_type,
787 uint32_t &start_idx) {
788 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
791 for (
size_t idx = start_idx; idx < count; ++idx) {
793 m_symbols[idx].GetType() == symbol_type) {
806 std::vector<uint32_t> &symbol_indexes) {
807 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
822 Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
823 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
834 symbol_visibility, symbol_indexes);
841 std::vector<uint32_t> &symbol_indexes,
843 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
846 symbol_visibility, symbol_indexes,
852 Debug symbol_debug_type,
854 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
859 std::vector<uint32_t> matching_indexes;
865 std::vector<uint32_t>::const_iterator pos, end = matching_indexes.end();
866 for (pos = matching_indexes.begin(); pos != end; ++pos) {
869 if (symbol->
Compare(name, symbol_type))
890 for (
int i = 0; i < num_sections; i++) {
893 SectionList &child_sectlist = sect_sp->GetChildren();
902 size_t size = sect_sp->GetByteSize();
903 if (size > 0 && !sect_sp->ContainsOnlyDebugInfo()) {
904 addr_t base_addr = sect_sp->GetFileAddress();
908 section_ranges.
Append(entry);
924 if (pos->ValueIsAddress()) {
925 entry.
SetRangeBase(pos->GetAddressRef().GetFileAddress());
927 entry.
data = std::distance(begin, pos);
932 if (num_entries > 0) {
944 section_ranges.
Sort();
951 for (
size_t i = 0; i < num_entries; i++) {
961 if (containing_section) {
967 for (
size_t j = i; j < num_entries; j++) {
971 if (next_base_addr > curr_base_addr) {
972 addr_t size_to_next_symbol = next_base_addr - curr_base_addr;
976 if (sym_size == 0 || size_to_next_symbol < sym_size) {
977 sym_size = size_to_next_symbol;
999 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1008 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1023 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1039 addr_t file_addr, std::function<
bool(
Symbol *)>
const &callback) {
1040 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1045 std::vector<uint32_t> all_addr_indexes;
1048 const size_t addr_match_count =
1052 for (
size_t i = 0; i < addr_match_count; ++i) {
1055 if (!callback(symbol))
1066 const bool merge_symbol_into_function =
true;
1067 size_t num_indices = symbol_indexes.size();
1068 if (num_indices > 0) {
1071 for (
size_t i = 0; i < num_indices; i++) {
1081 std::vector<uint32_t> symbol_indexes;
1085 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
1087 if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) {
1088 std::vector<uint32_t> temp_symbol_indexes;
1091 unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
1092 if (temp_symbol_indexes_size > 0) {
1093 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1094 for (
unsigned i = 0; i < temp_symbol_indexes_size; i++) {
1103 symbol_indexes.push_back(temp_symbol_indexes[i]);
1113 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1116 for (lldb::FunctionNameType type :
1117 {lldb::eFunctionNameTypeBase, lldb::eFunctionNameTypeMethod,
1118 lldb::eFunctionNameTypeSelector}) {
1119 if (name_type_mask & type) {
1123 for (match = map.FindFirstValueForName(name); match !=
nullptr;
1124 match = map.FindNextValueForName(match)) {
1125 symbol_indexes.push_back(match->
value);
1130 if (!symbol_indexes.empty()) {
1131 llvm::sort(symbol_indexes);
1132 symbol_indexes.erase(llvm::unique(symbol_indexes), symbol_indexes.end());
1139 if (child_idx !=
UINT32_MAX && child_idx > 0) {
1140 for (uint32_t idx = child_idx - 1; idx !=
UINT32_MAX; --idx) {
1143 if (sibling_idx !=
UINT32_MAX && sibling_idx > child_idx)
1152 llvm::raw_string_ostream strm(key);
1156 strm <<
m_objfile->GetModule()->GetCacheKey() <<
"-symtab-"
1157 << llvm::format_hex(
m_objfile->GetCacheHash(), 10);
1164 if (
m_objfile->GetDisableMemorySymtabCaching())
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);
1239#if __SIZEOF_POINTER__ == 8
1242 "Symbol size has changed, DataFileCache version likely needs updating");
1262 if (!signature.
Encode(encoder))
1276 uint8_t symtab_flags = 0;
1281 symtab_encoder.
AppendU8(symtab_flags);
1286 symbol.Encode(symtab_encoder, strtab);
1291 size_t num_cmaps_offset = symtab_encoder.
GetByteSize();
1292 uint8_t num_cmaps = 0;
1295 if (pair.second.IsEmpty())
1298 symtab_encoder.
AppendU8(pair.first);
1302 symtab_encoder.
PutU8(num_cmaps_offset, num_cmaps);
1315 bool has_debug_map =
false;
1316 bool has_source_files =
false;
1319 if (!signature.
Decode(data, offset_ptr))
1324 if (!strtab.
Decode(data, offset_ptr))
1328 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1331 const uint32_t version = data.
GetU32(offset_ptr);
1334 const uint8_t symtab_flags = data.
GetU8(offset_ptr);
1337 const uint32_t num_symbols = data.
GetU32(offset_ptr);
1338 if (num_symbols == 0) {
1345 for (uint32_t i=0; i<num_symbols; ++i) {
1357 const uint8_t num_cstr_maps = data.
GetU8(offset_ptr);
1358 for (uint8_t i=0; i<num_cstr_maps; ++i) {
1359 uint8_t type = data.
GetU8(offset_ptr);
1363 !
DecodeCStrMap(data, offset_ptr, strtab, cstr_map->second)) {
1368 pair.second.Clear();
1382 if (
m_objfile->GetDisableMemorySymtabCaching())
1391 std::unique_ptr<llvm::MemoryBuffer> mem_buffer_up =
1396 mem_buffer_up->getBufferSize(),
1400 const bool result =
Decode(data, &offset);
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 uint8_t kSymtabFlagHasSourceFiles
constexpr uint8_t kSymtabFlagHasDebugMap
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 registered scheme with Mangled::RegisterManglingScheme(),...
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 g_num_mangling_schemes
The number of possible mangling schemes, which sizes the tables that are indexed by ManglingScheme.
static Mangled::ManglingScheme GetManglingScheme(llvm::StringRef name)
Try to identify the mangling scheme used.
@ eLLDBIndexTypeMemoryModuleSymtab
static DataFileCache * GetIndexCache(LLDBIndexType type)
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)
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)
std::optional< bool > m_has_source_files
Set by the object file plug-in, or calculated and cached by HasSourceFiles().
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.
bool HasDebugMap() const
Check if this symbol table has a debug map, see SetHasDebugMap().
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 SetHasDebugMap(bool has_debug_map)
Set whether this symbol table has a debug map.
void SaveToCache()
Save the symbol table data out into a cache.
void SetWasLoadedFromCache()
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module...
bool m_has_debug_map
Set by the object file plug-in, see SetHasDebugMap().
bool Decode(const DataExtractor &data, lldb::offset_t *offset_ptr)
Decode a serialized version of this object from data.
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)
void SetHasSourceFiles(bool has_source_files)
Set whether this symbol table contains any source file symbols.
bool HasSourceFiles() const
Check if this symbol table contains any source file symbols.
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.
void CalculateHasSourceFiles() const
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.
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)