#include <map>
#include <set>
#include "lldb/Core/DataFileCache.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/RichManglingContext.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Target/Language.h"
#include "lldb/Utility/DataEncoder.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DJB.h"
usingnamespacelldb;
usingnamespacelldb_private;
Symtab::Symtab(ObjectFile *objfile)
: … { … }
Symtab::~Symtab() = default;
void Symtab::Reserve(size_t count) { … }
Symbol *Symtab::Resize(size_t count) { … }
uint32_t Symtab::AddSymbol(const Symbol &symbol) { … }
size_t Symtab::GetNumSymbols() const { … }
void Symtab::SectionFileAddressesChanged() { … }
void Symtab::Dump(Stream *s, Target *target, SortOrder sort_order,
Mangled::NamePreference name_preference) { … }
void Symtab::Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes,
Mangled::NamePreference name_preference) const { … }
void Symtab::DumpSymbolHeader(Stream *s) { … }
static int CompareSymbolID(const void *key, const void *p) { … }
Symbol *Symtab::FindSymbolByID(lldb::user_id_t symbol_uid) const { … }
Symbol *Symtab::SymbolAtIndex(size_t idx) { … }
const Symbol *Symtab::SymbolAtIndex(size_t idx) const { … }
static bool lldb_skip_name(llvm::StringRef mangled,
Mangled::ManglingScheme scheme) { … }
void Symtab::InitNameIndexes() { … }
void Symtab::RegisterMangledNameEntry(
uint32_t value, std::set<const char *> &class_contexts,
std::vector<std::pair<NameToIndexMap::Entry, const char *>> &backlog,
RichManglingContext &rmc) { … }
void Symtab::RegisterBacklogEntry(
const NameToIndexMap::Entry &entry, const char *decl_context,
const std::set<const char *> &class_contexts) { … }
void Symtab::PreloadSymbols() { … }
void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
bool add_demangled, bool add_mangled,
NameToIndexMap &name_to_index_map) const { … }
uint32_t Symtab::AppendSymbolIndexesWithType(SymbolType symbol_type,
std::vector<uint32_t> &indexes,
uint32_t start_idx,
uint32_t end_index) const { … }
uint32_t Symtab::AppendSymbolIndexesWithTypeAndFlagsValue(
SymbolType symbol_type, uint32_t flags_value,
std::vector<uint32_t> &indexes, uint32_t start_idx,
uint32_t end_index) const { … }
uint32_t Symtab::AppendSymbolIndexesWithType(SymbolType symbol_type,
Debug symbol_debug_type,
Visibility symbol_visibility,
std::vector<uint32_t> &indexes,
uint32_t start_idx,
uint32_t end_index) const { … }
uint32_t Symtab::GetIndexForSymbol(const Symbol *symbol) const { … }
struct SymbolSortInfo { … };
namespace {
struct SymbolIndexComparator { … };
}
void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
bool remove_duplicates) const { … }
uint32_t Symtab::GetNameIndexes(ConstString symbol_name,
std::vector<uint32_t> &indexes) { … }
uint32_t Symtab::AppendSymbolIndexesWithName(ConstString symbol_name,
std::vector<uint32_t> &indexes) { … }
uint32_t Symtab::AppendSymbolIndexesWithName(ConstString symbol_name,
Debug symbol_debug_type,
Visibility symbol_visibility,
std::vector<uint32_t> &indexes) { … }
uint32_t
Symtab::AppendSymbolIndexesWithNameAndType(ConstString symbol_name,
SymbolType symbol_type,
std::vector<uint32_t> &indexes) { … }
uint32_t Symtab::AppendSymbolIndexesWithNameAndType(
ConstString symbol_name, SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &indexes) { … }
uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType(
const RegularExpression ®exp, SymbolType symbol_type,
std::vector<uint32_t> &indexes, Mangled::NamePreference name_preference) { … }
uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType(
const RegularExpression ®exp, SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &indexes, Mangled::NamePreference name_preference) { … }
Symbol *Symtab::FindSymbolWithType(SymbolType symbol_type,
Debug symbol_debug_type,
Visibility symbol_visibility,
uint32_t &start_idx) { … }
void
Symtab::FindAllSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
std::vector<uint32_t> &symbol_indexes) { … }
void Symtab::FindAllSymbolsWithNameAndType(
ConstString name, SymbolType symbol_type, Debug symbol_debug_type,
Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) { … }
void Symtab::FindAllSymbolsMatchingRexExAndType(
const RegularExpression ®ex, SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &symbol_indexes,
Mangled::NamePreference name_preference) { … }
Symbol *Symtab::FindFirstSymbolWithNameAndType(ConstString name,
SymbolType symbol_type,
Debug symbol_debug_type,
Visibility symbol_visibility) { … }
SymbolSearchInfo;
static void AddSectionsToRangeMap(SectionList *sectlist,
RangeVector<addr_t, addr_t> §ion_ranges) { … }
void Symtab::InitAddressIndexes() { … }
void Symtab::Finalize() { … }
Symbol *Symtab::FindSymbolAtFileAddress(addr_t file_addr) { … }
Symbol *Symtab::FindSymbolContainingFileAddress(addr_t file_addr) { … }
void Symtab::ForEachSymbolContainingFileAddress(
addr_t file_addr, std::function<bool(Symbol *)> const &callback) { … }
void Symtab::SymbolIndicesToSymbolContextList(
std::vector<uint32_t> &symbol_indexes, SymbolContextList &sc_list) { … }
void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
SymbolContextList &sc_list) { … }
const Symbol *Symtab::GetParent(Symbol *child_symbol) const { … }
std::string Symtab::GetCacheKey() { … }
void Symtab::SaveToCache() { … }
constexpr llvm::StringLiteral kIdentifierCStrMap("CMAP");
static void EncodeCStrMap(DataEncoder &encoder, ConstStringTable &strtab,
const UniqueCStringMap<uint32_t> &cstr_map) { … }
bool DecodeCStrMap(const DataExtractor &data, lldb::offset_t *offset_ptr,
const StringTableReader &strtab,
UniqueCStringMap<uint32_t> &cstr_map) { … }
constexpr llvm::StringLiteral kIdentifierSymbolTable("SYMB");
constexpr uint32_t CURRENT_CACHE_VERSION = …;
bool Symtab::Encode(DataEncoder &encoder) const { … }
bool Symtab::Decode(const DataExtractor &data, lldb::offset_t *offset_ptr,
bool &signature_mismatch) { … }
bool Symtab::LoadFromCache() { … }