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;
128 name_map.emplace(symbol.GetName().GetStringRef(), &symbol);
130 for (
const auto &name_to_symbol : name_map) {
131 const Symbol *symbol = name_to_symbol.second;
133 symbol->
Dump(s, target, symbol - &
m_symbols[0], name_preference);
141 std::multimap<size_t, const Symbol *, std::greater<size_t>> size_map;
143 size_map.emplace(symbol.GetByteSize(), &symbol);
146 for (
const auto &size_to_symbol : size_map) {
147 const Symbol *symbol = size_to_symbol.second;
149 symbol->
Dump(s, target, idx++, name_preference);
159 for (
size_t i = 0; i < num_entries; ++i) {
162 m_symbols[symbol_idx].Dump(s, target, symbol_idx, name_preference);
173 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
178 s->
Printf(
"Symtab %" PRIu64
" symbol indexes (%" PRIu64
" symbols total):\n",
179 (uint64_t)indexes.size(), (uint64_t)
m_symbols.size());
182 if (!indexes.empty()) {
183 std::vector<uint32_t>::const_iterator pos;
184 std::vector<uint32_t>::const_iterator end = indexes.end();
186 for (pos = indexes.begin(); pos != end; ++pos) {
188 if (idx < num_symbols) {
190 m_symbols[idx].Dump(s, target, idx, name_preference);
198 s->
Indent(
" Debug symbol\n");
199 s->
Indent(
" |Synthetic symbol\n");
200 s->
Indent(
" ||Externally Visible\n");
202 s->
Indent(
"Index UserID DSX Type File Address/Value Load "
203 "Address Size Flags Name\n");
204 s->
Indent(
"------- ------ --- --------------- ------------------ "
205 "------------------ ------------------ ---------- "
206 "----------------------------------\n");
212 if (match_uid < symbol_uid)
214 if (match_uid > symbol_uid)
220 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
248 if (mangled.size() < 3 || !mangled.starts_with(
"_Z"))
252 switch (mangled[2]) {
278 llvm_unreachable(
"unknown scheme!");
289 std::vector<Language *> languages;
291 languages.push_back(
l);
296 auto &basename_to_index =
298 auto &method_to_index =
300 auto &selector_to_index =
303 const size_t num_symbols =
m_symbols.size();
304 name_to_index.Reserve(num_symbols);
308 std::set<const char *> class_contexts;
309 std::vector<std::pair<NameToIndexMap::Entry, const char *>> backlog;
310 backlog.reserve(num_symbols / 2);
315 for (uint32_t value = 0; value < num_symbols; ++value) {
331 name_to_index.Append(name, value);
338 name_to_index.Append(stripped, value);
353 name_to_index.Append(name, value);
360 name_to_index.Append(name, value);
366 for (
auto variant : lang->GetMethodNameVariants(name)) {
367 if (variant.GetType() & lldb::eFunctionNameTypeSelector)
368 selector_to_index.Append(variant.GetName(), value);
369 else if (variant.GetType() & lldb::eFunctionNameTypeFull)
370 name_to_index.Append(variant.GetName(), value);
371 else if (variant.GetType() & lldb::eFunctionNameTypeMethod)
372 method_to_index.Append(variant.GetName(), value);
373 else if (variant.GetType() & lldb::eFunctionNameTypeBase)
374 basename_to_index.Append(variant.GetName(), value);
380 for (
const auto &record : backlog) {
384 name_to_index.Sort();
385 name_to_index.SizeToFit();
386 selector_to_index.Sort();
387 selector_to_index.SizeToFit();
388 basename_to_index.Sort();
389 basename_to_index.SizeToFit();
390 method_to_index.Sort();
391 method_to_index.SizeToFit();
396 uint32_t value, std::set<const char *> &class_contexts,
397 std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog,
401 if (base_name.empty())
405 NameToIndexMap::Entry entry(
ConstString(base_name), value);
409 if (decl_context.empty()) {
411 auto &basename_to_index =
413 basename_to_index.Append(entry);
417 name_to_index.Append(entry);
424 auto it = class_contexts.find(decl_context_ccstr);
426 auto &method_to_index =
431 method_to_index.Append(entry);
432 if (it == class_contexts.end())
433 class_contexts.insert(it, decl_context_ccstr);
438 if (it != class_contexts.end()) {
439 method_to_index.Append(entry);
445 backlog.push_back(std::make_pair(entry, decl_context_ccstr));
449 const NameToIndexMap::Entry &entry,
const char *decl_context,
450 const std::set<const char *> &class_contexts) {
451 auto &method_to_index =
453 auto it = class_contexts.find(decl_context);
454 if (it != class_contexts.end()) {
455 method_to_index.Append(entry);
459 method_to_index.Append(entry);
460 auto &basename_to_index =
462 basename_to_index.Append(entry);
467 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
472 bool add_demangled,
bool add_mangled,
475 if (add_demangled || add_mangled) {
476 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
479 const size_t num_indexes = indexes.size();
480 for (
size_t i = 0; i < num_indexes; ++i) {
481 uint32_t value = indexes[i];
488 name_to_index_map.
Append(name, value);
493 name_to_index_map.
Append(name, value);
500 std::vector<uint32_t> &indexes,
502 uint32_t end_index)
const {
503 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
505 uint32_t prev_size = indexes.size();
507 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
509 for (uint32_t i = start_idx; i < count; ++i) {
511 indexes.push_back(i);
514 return indexes.size() - prev_size;
519 std::vector<uint32_t> &indexes, uint32_t start_idx,
520 uint32_t end_index)
const {
521 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
523 uint32_t prev_size = indexes.size();
525 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
527 for (uint32_t i = start_idx; i < count; ++i) {
529 m_symbols[i].GetType() == symbol_type) &&
531 indexes.push_back(i);
534 return indexes.size() - prev_size;
538 Debug symbol_debug_type,
540 std::vector<uint32_t> &indexes,
542 uint32_t end_index)
const {
543 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
545 uint32_t prev_size = indexes.size();
547 const uint32_t count = std::min<uint32_t>(
m_symbols.size(), end_index);
549 for (uint32_t i = start_idx; i < count; ++i) {
553 indexes.push_back(i);
557 return indexes.size() - prev_size;
563 if (symbol >= first_symbol && symbol < first_symbol +
m_symbols.size())
564 return symbol - first_symbol;
575struct SymbolIndexComparator {
576 const std::vector<Symbol> &symbols;
577 std::vector<lldb::addr_t> &addr_cache;
590 SymbolIndexComparator(
const std::vector<Symbol> &s,
591 std::vector<lldb::addr_t> &a)
592 : symbols(s), addr_cache(a) {
593 assert(symbols.size() == addr_cache.size());
595 bool operator()(uint32_t index_a, uint32_t index_b) {
596 addr_t value_a = addr_cache[index_a];
598 value_a = symbols[index_a].GetAddressRef().GetFileAddress();
599 addr_cache[index_a] = value_a;
602 addr_t value_b = addr_cache[index_b];
604 value_b = symbols[index_b].GetAddressRef().GetFileAddress();
605 addr_cache[index_b] = value_b;
608 if (value_a == value_b) {
617 }
else if (value_a < value_b)
626 bool remove_duplicates)
const {
627 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
630 if (indexes.size() <= 1)
640 SymbolIndexComparator comparator(
m_symbols, addr_cache);
641 std::stable_sort(indexes.begin(), indexes.end(), comparator);
644 if (remove_duplicates) {
645 auto last = std::unique(indexes.begin(), indexes.end());
646 indexes.erase(last, indexes.end());
651 std::vector<uint32_t> &indexes) {
653 const uint32_t count = name_to_index.GetValues(symbol_name, indexes);
667 unsigned long long uid = 0;
668 if (getAsUnsignedInteger(name, 10, uid))
671 if (symbol ==
nullptr)
676 indexes.push_back(symbol_idx);
681 std::vector<uint32_t> &indexes) {
682 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
694 Debug symbol_debug_type,
696 std::vector<uint32_t> &indexes) {
697 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
701 const size_t old_size = indexes.size();
705 std::vector<uint32_t> all_name_indexes;
706 const size_t name_match_count =
708 for (
size_t i = 0; i < name_match_count; ++i) {
711 indexes.push_back(all_name_indexes[i]);
713 return indexes.size() - old_size;
721 std::vector<uint32_t> &indexes) {
722 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
725 std::vector<uint32_t>::iterator pos = indexes.begin();
726 while (pos != indexes.end()) {
728 m_symbols[*pos].GetType() == symbol_type)
731 pos = indexes.erase(pos);
734 return indexes.size();
740 std::vector<uint32_t> &indexes) {
741 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
744 symbol_visibility, indexes) > 0) {
745 std::vector<uint32_t>::iterator pos = indexes.begin();
746 while (pos != indexes.end()) {
748 m_symbols[*pos].GetType() == symbol_type)
751 pos = indexes.erase(pos);
754 return indexes.size();
760 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
762 uint32_t prev_size = indexes.size();
765 for (uint32_t i = 0; i < sym_end; i++) {
769 m_symbols[i].GetMangled().GetName(name_preference).AsCString();
772 indexes.push_back(i);
776 return indexes.size() - prev_size;
783 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
785 uint32_t prev_size = indexes.size();
788 for (uint32_t i = 0; i < sym_end; i++) {
795 m_symbols[i].GetMangled().GetName(name_preference).AsCString();
798 indexes.push_back(i);
802 return indexes.size() - prev_size;
806 Debug symbol_debug_type,
808 uint32_t &start_idx) {
809 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
812 for (
size_t idx = start_idx; idx < count; ++idx) {
814 m_symbols[idx].GetType() == symbol_type) {
827 std::vector<uint32_t> &symbol_indexes) {
828 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
844 Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
845 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
857 symbol_visibility, symbol_indexes);
864 std::vector<uint32_t> &symbol_indexes,
866 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
869 symbol_visibility, symbol_indexes,
875 Debug symbol_debug_type,
877 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
883 std::vector<uint32_t> matching_indexes;
889 std::vector<uint32_t>::const_iterator pos, end = matching_indexes.end();
890 for (pos = matching_indexes.begin(); pos != end; ++pos) {
893 if (symbol->
Compare(name, symbol_type))
914 for (
int i = 0; i < num_sections; i++) {
917 SectionList &child_sectlist = sect_sp->GetChildren();
924 size_t size = sect_sp->GetByteSize();
926 addr_t base_addr = sect_sp->GetFileAddress();
930 section_ranges.
Append(entry);
946 if (pos->ValueIsAddress()) {
947 entry.
SetRangeBase(pos->GetAddressRef().GetFileAddress());
949 entry.
data = std::distance(begin, pos);
954 if (num_entries > 0) {
966 section_ranges.
Sort();
973 for (
size_t i = 0; i < num_entries; i++) {
983 if (containing_section) {
989 for (
size_t j = i; j < num_entries; j++) {
993 if (next_base_addr > curr_base_addr) {
994 addr_t size_to_next_symbol = next_base_addr - curr_base_addr;
998 if (sym_size == 0 || size_to_next_symbol < sym_size) {
999 sym_size = size_to_next_symbol;
1021 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1030 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1045 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1061 addr_t file_addr, std::function<
bool(
Symbol *)>
const &callback) {
1062 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1067 std::vector<uint32_t> all_addr_indexes;
1070 const size_t addr_match_count =
1074 for (
size_t i = 0; i < addr_match_count; ++i) {
1077 if (!callback(symbol))
1088 const bool merge_symbol_into_function =
true;
1089 size_t num_indices = symbol_indexes.size();
1090 if (num_indices > 0) {
1093 for (
size_t i = 0; i < num_indices; i++) {
1103 std::vector<uint32_t> symbol_indexes;
1107 assert((name_type_mask & eFunctionNameTypeAuto) == 0);
1109 if (name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull)) {
1110 std::vector<uint32_t> temp_symbol_indexes;
1113 unsigned temp_symbol_indexes_size = temp_symbol_indexes.size();
1114 if (temp_symbol_indexes_size > 0) {
1115 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
1116 for (
unsigned i = 0; i < temp_symbol_indexes_size; i++) {
1125 symbol_indexes.push_back(temp_symbol_indexes[i]);
1138 for (lldb::FunctionNameType type :
1139 {lldb::eFunctionNameTypeBase, lldb::eFunctionNameTypeMethod,
1140 lldb::eFunctionNameTypeSelector}) {
1141 if (name_type_mask & type) {
1145 for (match = map.FindFirstValueForName(name); match !=
nullptr;
1146 match = map.FindNextValueForName(match)) {
1147 symbol_indexes.push_back(match->
value);
1152 if (!symbol_indexes.empty()) {
1153 llvm::sort(symbol_indexes);
1154 symbol_indexes.erase(
1155 std::unique(symbol_indexes.begin(), symbol_indexes.end()),
1156 symbol_indexes.end());
1163 if (child_idx !=
UINT32_MAX && child_idx > 0) {
1164 for (uint32_t idx = child_idx - 1; idx !=
UINT32_MAX; --idx) {
1167 if (sibling_idx !=
UINT32_MAX && sibling_idx > child_idx)
1176 llvm::raw_string_ostream strm(key);
1205 for (
const auto &entry: cstr_map) {
1207 assert((
bool)entry.cstring);
1216 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1219 const uint32_t count = data.
GetU32(offset_ptr);
1221 for (uint32_t i=0; i<count; ++i)
1223 llvm::StringRef str(strtab.
Get(data.
GetU32(offset_ptr)));
1224 uint32_t value = data.
GetU32(offset_ptr);
1262 if (!signature.
Encode(encoder))
1278 symbol.Encode(symtab_encoder, strtab);
1283 size_t num_cmaps_offset = symtab_encoder.
GetByteSize();
1284 uint8_t num_cmaps = 0;
1287 if (pair.second.IsEmpty())
1290 symtab_encoder.
AppendU8(pair.first);
1294 symtab_encoder.
PutU8(num_cmaps_offset, num_cmaps);
1304 bool &signature_mismatch) {
1305 signature_mismatch =
false;
1310 if (!signature.
Decode(data, offset_ptr))
1313 signature_mismatch =
true;
1317 if (!strtab.
Decode(data, offset_ptr))
1321 llvm::StringRef identifier((
const char *)data.
GetData(offset_ptr, 4), 4);
1324 const uint32_t version = data.
GetU32(offset_ptr);
1327 const uint32_t num_symbols = data.
GetU32(offset_ptr);
1328 if (num_symbols == 0)
1332 for (uint32_t i=0; i<num_symbols; ++i) {
1340 const uint8_t num_cstr_maps = data.
GetU8(offset_ptr);
1341 for (uint8_t i=0; i<num_cstr_maps; ++i) {
1342 uint8_t type = data.
GetU8(offset_ptr);
1358 std::unique_ptr<llvm::MemoryBuffer> mem_buffer_up =
1363 mem_buffer_up->getBufferSize(),
1366 bool signature_mismatch =
false;
1368 const bool result =
Decode(data, &offset, signature_mismatch);
1369 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)