9#ifndef LLDB_SYMBOL_SYMBOLFILE_H
10#define LLDB_SYMBOL_SYMBOLFILE_H
28#include "llvm/ADT/DenseSet.h"
29#include "llvm/ADT/SmallSet.h"
30#include "llvm/Support/Errc.h"
34#include <unordered_map>
36#if defined(LLDB_CONFIGURATION_DEBUG)
37#define ASSERT_MODULE_LOCK(expr) (expr->AssertModuleLock())
39#define ASSERT_MODULE_LOCK(expr) ((void)0)
57 virtual bool isA(
const void *ClassID)
const {
return ClassID == &
ID; }
156 virtual llvm::SmallSet<lldb::LanguageType, 4>
158 llvm::SmallSet<lldb::LanguageType, 4> langs;
195 llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files,
196 llvm::function_ref<
bool(
Module &)> lambda) {
206 std::vector<SourceModule> &imported_modules) = 0;
230 virtual std::optional<ArrayInfo>
243 virtual std::vector<CompilerContext>
248 lldb::SymbolContextItem resolve_scope,
296 lldb::SymbolContextItem resolve_scope,
302 uint32_t max_matches,
305 uint32_t max_matches,
329 std::vector<ConstString> &mangled_names);
332 lldb::TypeClass type_mask,
337 virtual llvm::Expected<lldb::TypeSystemSP>
350 bool only_root_namespaces =
false) {
358 virtual std::vector<std::unique_ptr<CallEdge>>
374 uint32_t number)
const = 0;
384 return llvm::createStringError(make_error_code(llvm::errc::not_supported),
385 "Operation not supported.");
479 uint32_t opaque_payload = 0) = 0;
486 std::unordered_map<lldb::CompUnitSP, Args> args;
495 std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args) {}
511 bool isA(
const void *ClassID)
const override {
548 llvm::Expected<lldb::TypeSystemSP>
578 std::optional<uint64_t> byte_size,
585 uint32_t opaque_payload = 0)
override {
587 uid,
this, name, byte_size, context, encoding_uid,
588 encoding_uid_type, decl, compiler_qual_type,
589 compiler_type_resolve_state, opaque_payload));
A section + offset based address class.
A class that describes a compilation unit.
Represents a generic declaration context in a program.
Represents a generic declaration such as a function declaration.
Generic representation of a type in a programming language.
A uniqued constant string class.
A class that describes the declaration location of a lldb object.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class that describes a function.
A collection class for Module objects.
A class that encapsulates name lookup information.
A class that describes an executable image and its associated object and symbol files.
A plug-in interface definition class for object file parsers.
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
This base class provides an interface to stack frames.
std::chrono::duration< double > Duration
bool Fail() const
Test for error condition.
A stream class that can stream formatted output to a file.
A list of support files for a CompileUnit.
Defines a list of symbol context objects.
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Defines a symbol context baton that can be handed other debug core functions.
Containing protected virtual methods for child classes to override.
const SymbolFileCommon & operator=(const SymbolFileCommon &)=delete
~SymbolFileCommon() override=default
bool GetDebugInfoHadFrameVariableErrors() const override
Accessors for the bool that indicates if there was debug info, but errors stopped variables from bein...
void SetDebugInfoIndexWasLoadedFromCache() override
bool GetDebugInfoIndexWasSavedToCache() const override
bool m_index_was_loaded_from_cache
lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx) override
ObjectFile * GetObjectFile() override
bool m_index_was_saved_to_cache
std::optional< std::vector< lldb::CompUnitSP > > m_compile_units
virtual TypeList & GetTypeList()
lldb::ObjectFileSP m_objfile_sp
bool isA(const void *ClassID) const override
LLVM RTTI support.
void SetDebugInfoIndexWasSavedToCache() override
Symtab * GetSymtab() override
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx)=0
ObjectFile * GetMainObjectFile() override
bool m_debug_info_had_variable_errors
Set to true if any variable feteching errors have been found when calling GetFrameVariableError().
Symtab * m_symtab
Do not use m_symtab directly, as it may be freed.
static char ID
LLVM RTTI support.
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp)
SymbolFileCommon(lldb::ObjectFileSP objfile_sp)
void SetDebugInfoHadFrameVariableErrors() override
static bool classof(const SymbolFileCommon *obj)
const ObjectFile * GetObjectFile() const override
bool m_calculated_abilities
uint32_t GetAbilities() override
Get a mask of what this symbol file supports for the object file that it was constructed with.
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
bool GetDebugInfoIndexWasLoadedFromCache() const override
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module...
uint32_t GetNumCompileUnits() override
SymbolFileCommon(const SymbolFileCommon &)=delete
lldb::TypeSP CopyType(const lldb::TypeSP &other_type) override
void SectionFileAddressesChanged() override
Notify the SymbolFile that the file addresses in the Sections for this module have been changed.
virtual uint32_t CalculateNumCompileUnits()=0
void Dump(Stream &s) override
lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, Type::EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, Type::ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0) override
This function is used to create types that belong to a SymbolFile.
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
Provides public interface for all SymbolFiles.
virtual lldb::TypeSP CopyType(const lldb::TypeSP &other_type)=0
virtual llvm::SmallSet< lldb::LanguageType, 4 > ParseAllLanguages(CompileUnit &comp_unit)
This function exists because SymbolFileDWARFDebugMap may extra compile units which aren't exposed as ...
virtual void ParseDeclsForContext(CompilerDeclContext decl_ctx)
virtual uint64_t GetDebugInfoSize(bool load_all_debug_info=false)=0
Metrics gathering functions.
virtual llvm::Expected< lldb::addr_t > GetParameterStackSize(Symbol &symbol)
Return the number of stack bytes taken up by the parameters to this function.
virtual bool GetDebugInfoIndexWasLoadedFromCache() const =0
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module...
virtual XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit)
Return the Xcode SDK comp_unit was compiled against.
virtual void InitializeObject()
Initialize the SymbolFile object.
virtual bool CompleteType(CompilerType &compiler_type)=0
virtual Type * ResolveTypeUID(lldb::user_id_t type_uid)=0
virtual bool ParseIsOptimized(CompileUnit &comp_unit)
virtual bool isA(const void *ClassID) const
LLVM RTTI support.
~SymbolFile() override=default
virtual bool ForEachExternalModule(lldb_private::CompileUnit &comp_unit, llvm::DenseSet< lldb_private::SymbolFile * > &visited_symbol_files, llvm::function_ref< bool(Module &)> lambda)
Apply a lambda to each external lldb::Module referenced by this comp_unit.
virtual std::vector< CompilerContext > GetCompilerContextForUID(lldb::user_id_t uid)
virtual CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid)
virtual std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id)
virtual CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid)
virtual CompilerDecl GetDeclForUID(lldb::user_id_t uid)
virtual const ObjectFile * GetObjectFile() const =0
virtual size_t ParseTypes(CompileUnit &comp_unit)=0
virtual Symtab * GetSymtab()=0
virtual void SectionFileAddressesChanged()=0
Notify the SymbolFile that the file addresses in the Sections for this module have been changed.
virtual void SetLoadDebugInfoEnabled()
Specify debug info should be loaded.
virtual void PreloadSymbols()
virtual lldb::UnwindPlanSP GetUnwindPlan(const Address &address, const RegisterInfoResolver &resolver)
virtual SymbolFile * GetBackingSymbolFile()
SymbolFileOnDemand class overrides this to return the underlying backing SymbolFile implementation th...
virtual void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables)
virtual bool GetDebugInfoIndexWasSavedToCache() const =0
virtual StatsDuration::Duration GetDebugInfoParseTime()
Return the time taken to parse the debug information.
virtual size_t ParseFunctions(CompileUnit &comp_unit)=0
virtual ObjectFile * GetMainObjectFile()=0
virtual size_t ParseBlocksRecursive(Function &func)=0
virtual uint32_t GetNumCompileUnits()=0
virtual bool ParseLineTable(CompileUnit &comp_unit)=0
virtual llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language)=0
virtual bool ParseDebugMacros(CompileUnit &comp_unit)=0
static SymbolFile * FindPlugin(lldb::ObjectFileSP objfile_sp)
virtual std::recursive_mutex & GetModuleMutex() const
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
virtual bool GetLoadDebugInfoEnabled()
Whether debug info will be loaded or not.
SymbolFile(const SymbolFile &)=delete
virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, Type::EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, Type::ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0)=0
Status GetFrameVariableError(StackFrame &frame)
Get an error that describes why variables might be missing for a given symbol context.
virtual bool GetDebugInfoHadFrameVariableErrors() const =0
Accessors for the bool that indicates if there was debug info, but errors stopped variables from bein...
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list)=0
virtual std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx)=0
If type_uid points to an array type, return its characteristics.
virtual void DumpClangAST(Stream &s)
virtual void AddSymbols(Symtab &symtab)
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit)=0
virtual lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx)=0
virtual CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces=false)
Finds a namespace of name name and whose parent context is parent_decl_ctx.
const SymbolFile & operator=(const SymbolFile &)=delete
virtual bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules)=0
virtual void SetDebugInfoIndexWasSavedToCache()=0
virtual void FindTypes(const TypeQuery &query, TypeResults &results)
Find types using a type-matching object that contains all search parameters.
static char ID
LLVM RTTI support.
virtual void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list)
virtual void SetDebugInfoHadFrameVariableErrors()=0
virtual ModuleList GetDebugInfoModules()
Get the additional modules that this symbol file uses to parse debug info.
virtual StatsDuration::Duration GetDebugInfoIndexTime()
Return the time it took to index the debug information in the object file.
virtual size_t ParseVariablesForContext(const SymbolContext &sc)=0
virtual uint32_t GetAbilities()=0
Get a mask of what this symbol file supports for the object file that it was constructed with.
static bool classof(const SymbolFile *obj)
virtual uint32_t CalculateAbilities()=0
virtual void GetCompileOptions(std::unordered_map< lldb::CompUnitSP, lldb_private::Args > &args)
std::unordered_map< lldb::CompUnitSP, Args > GetCompileOptions()
Returns a map of compilation unit to the compile option arguments associated with that compilation un...
virtual Status CalculateFrameVariableError(StackFrame &frame)
Subclasses will override this function to for GetFrameVariableError().
virtual ObjectFile * GetObjectFile()=0
virtual uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc)=0
virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< ConstString > &mangled_names)
virtual bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only)
Return true if separate debug info files are supported and this function succeeded,...
virtual void Dump(Stream &s)=0
virtual void SetDebugInfoIndexWasLoadedFromCache()=0
virtual bool ParseSupportFiles(CompileUnit &comp_unit, SupportFileList &support_files)=0
void Insert(const lldb::TypeSP &type)
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
An abstraction for Xcode-style SDKs that works like ArchSpec.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::UnwindPlan > UnwindPlanSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
RegisterKind
Register numbering types.
Every register is described in detail including its name, alternate name (optional),...
The characteristics of an array type.
llvm::SmallVector< std::optional< uint64_t >, 1 > element_orders
int64_t first_index
Each entry belongs to a distinct DW_TAG_subrange_type.
virtual const RegisterInfo * ResolveNumber(lldb::RegisterKind kind, uint32_t number) const =0
virtual const RegisterInfo * ResolveName(llvm::StringRef name) const =0
virtual ~RegisterInfoResolver()
A mix in class that contains a generic user ID.