9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
16#include <unordered_map>
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/SetVector.h"
21#include "llvm/Support/Threading.h"
45class DWARFDebugAbbrev;
52class DWARFCompileUnit;
53class DWARFDebugAranges;
55class DWARFDebugInfoEntry;
57class DWARFDebugRanges;
58class DWARFDeclContext;
61class SymbolFileDWARFDebugMap;
62class SymbolFileDWARFDwo;
63class SymbolFileDWARFDwp;
65#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
74 bool isA(
const void *ClassID)
const override {
123 llvm::function_ref<
bool(
Module &)>)
override;
134 std::vector<SourceModule> &imported_modules)
override;
140 std::optional<ArrayInfo>
147 bool resolve_function_context =
false);
155 std::vector<CompilerContext>
161 lldb::SymbolContextItem resolve_scope,
167 lldb::SymbolContextItem resolve_scope,
172 uint32_t max_matches,
187 std::vector<ConstString> &mangled_names)
override;
197 llvm::Expected<lldb::TypeSystemSP>
202 bool only_root_namespaces)
override;
227 llvm::function_ref<
bool(
DWARFDIE die)> callback);
257 std::shared_ptr<SymbolFileDWARFDwo>
277 bool only_root_namespaces =
false);
279 std::vector<std::unique_ptr<CallEdge>>
288 bool errors_only)
override;
324 const uint8_t op)
const {
330 std::vector<Value> &stack)
const {
341 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, Type *>
DIEToTypePtr;
345 virtual llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> &
348 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP>
403 bool parse_siblings,
bool parse_children);
432 llvm::ArrayRef<DIERef> variable_dies,
452 bool resolve_function_context =
false);
470 std::vector<std::unique_ptr<CallEdge>>
520 std::unique_ptr<llvm::DWARFDebugAbbrev>
m_abbr;
542 llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef>
544 llvm::DenseMap<dw_offset_t, std::unique_ptr<SupportFileList>>
A section + offset based address class.
A class that describes a single lexical block.
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 to manage flag bits.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class that describes a function.
A class that encapsulates name lookup information.
A class that describes an executable image and its associated object and symbol files.
"lldb/Core/SourceLocationSpec.h" A source location specifier class.
This base class provides an interface to stack frames.
std::chrono::duration< double > Duration
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.
bool isA(const void *ClassID) const override
LLVM RTTI support.
Provides public interface for all SymbolFiles.
virtual bool isA(const void *ClassID) const
LLVM RTTI support.
std::unordered_map< lldb::CompUnitSP, Args > GetCompileOptions()
Returns a map of compilation unit to the compile option arguments associated with that compilation un...
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.
Identifies a DWARF debug info entry within a given Module.
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
static CompilerDeclContext GetContainingDeclContext(const DWARFDIE &die)
static bool SupportedVersion(uint16_t version)
std::optional< uint32_t > GetDWARFUnitIndex(uint32_t cu_idx)
CompileUnit * GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu)
lldb::ModuleSP GetExternalModule(ConstString name)
DWARFDebugRanges * GetDebugRanges()
void BuildCuTranslationTable()
void FindGlobalVariables(ConstString name, const CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, VariableList &variables) override
virtual DWARFDIE FindDefinitionDIE(const DWARFDIE &die)
DWARFDIE FindBlockContainingSpecification(const DIERef &func_die_ref, dw_offset_t spec_block_die_offset)
llvm::DenseMap< const DWARFDebugInfoEntry *, Type * > DIEToTypePtr
lldb::VariableSP ParseVariableDIE(const SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
void UpdateExternalModuleListIfNeeded()
static DWARFASTParser * GetDWARFParser(DWARFUnit &unit)
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu)
static lldb::LanguageType GetLanguageFamily(DWARFUnit &unit)
Same as GetLanguage() but reports all C++ versions as C++ (no version).
bool ForEachExternalModule(CompileUnit &, llvm::DenseSet< SymbolFile * > &, llvm::function_ref< bool(Module &)>) override
static bool classof(const SymbolFile *obj)
static char ID
LLVM RTTI support.
std::unique_ptr< DWARFDebugInfo > m_info
bool DeclContextMatchesThisSymbolFile(const CompilerDeclContext &decl_ctx)
void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< ConstString > &mangled_names) override
std::map< ConstString, lldb::ModuleSP > ExternalTypeModuleMap
size_t PopulateBlockVariableList(VariableList &variable_list, const SymbolContext &sc, llvm::ArrayRef< DIERef > variable_dies, lldb::addr_t func_low_pc)
Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
virtual llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > & GetForwardDeclCompilerTypeToDIE()
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb::VariableSP > DIEToVariableSP
size_t ParseVariablesInFunctionContextRecursive(const SymbolContext &sc, const DWARFDIE &die, lldb::addr_t func_low_pc, DIEArray &accumulator)
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, ConstString type_name, bool must_be_implementation)
const std::shared_ptr< SymbolFileDWARFDwo > & GetDwpSymbolFile()
std::recursive_mutex & GetModuleMutex() const override
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
uint32_t ResolveSymbolContext(const SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) override
UniqueDWARFASTTypeMap m_unique_ast_type_map
DIEToVariableSP m_die_to_variable_sp
bool m_fetched_external_modules
GlobalVariableMap & GetGlobalAranges()
virtual DWARFCompileUnit * GetDWARFCompileUnit(CompileUnit *comp_unit)
llvm::SetVector< Type * > TypeSet
Function * ParseFunction(CompileUnit &comp_unit, const DWARFDIE &die)
lldb::TypeSP GetTypeForDIE(const DWARFDIE &die, bool resolve_function_context=false)
virtual bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes, lldb::offset_t &offset, std::vector< Value > &stack) const
lldb::addr_t m_first_code_address
DWARF does not provide a good way for traditional (concatenating) linkers to invalidate debug info de...
ConstString ConstructFunctionDemangledName(const DWARFDIE &die)
void SetDebugMapModule(const lldb::ModuleSP &module_sp)
lldb::ModuleWP m_debug_map_module_wp
DWARFUnit * GetSkeletonUnit(DWARFUnit *dwo_unit)
Given a DWO DWARFUnit, find the corresponding skeleton DWARFUnit in the main symbol file.
FileSpec GetFile(DWARFUnit &unit, size_t file_idx)
std::shared_ptr< SymbolFileDWARFDwo > m_dwp_symfile
void InitializeFirstCodeAddressRecursive(const SectionList §ion_list)
std::unique_ptr< llvm::DWARFDebugAbbrev > m_abbr
llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > m_forward_decl_compiler_type_to_die
DWARFUnit * GetNextUnparsedDWARFCompileUnit(DWARFUnit *prev_cu)
void DumpClangAST(Stream &s) override
std::set< DIERef > DIERefSet
std::vector< CompilerContext > GetCompilerContextForUID(lldb::user_id_t uid) override
virtual void GetObjCMethods(ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback)
virtual DWARFDIE GetDIE(const DIERef &die_ref)
static llvm::StringRef GetPluginNameStatic()
void InitializeFirstCodeAddress()
std::unique_ptr< GlobalVariableMap > m_global_aranges_up
llvm::once_flag m_info_once_flag
virtual lldb::offset_t GetVendorDWARFOpcodeSize(const DataExtractor &data, const lldb::offset_t data_offset, const uint8_t op) const
DWARFIndex * getIndex()
Returns the DWARFIndex for this symbol, if it exists.
uint64_t GetDebugInfoSize(bool load_all_debug_info=false) override
Metrics gathering functions.
void FindTypes(const lldb_private::TypeQuery &match, lldb_private::TypeResults &results) override
Find types using a type-matching object that contains all search parameters.
static CompilerDecl GetDecl(const DWARFDIE &die)
void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block, SymbolContext &sc)
Resolve functions and (possibly) blocks for the given file address and a compile unit.
size_t ParseVariablesForContext(const SymbolContext &sc) override
virtual DIEToTypePtr & GetDIEToType()
uint32_t CalculateNumCompileUnits() override
std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
size_t ParseBlocksRecursive(Function &func) override
ExternalTypeModuleMap m_external_type_modules
Type * ResolveTypeUID(lldb::user_id_t type_uid) override
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
LazyBool m_supports_DW_AT_APPLE_objc_complete_type
bool ClassOrStructIsVirtual(const DWARFDIE &die)
llvm::DenseMap< dw_offset_t, std::unique_ptr< SupportFileList > > m_type_unit_support_files
size_t ParseFunctions(CompileUnit &comp_unit) override
bool ParseDebugMacros(CompileUnit &comp_unit) override
NameToOffsetMap m_function_scope_qualified_name_map
static SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
bool ClassContainsSelector(const DWARFDIE &class_die, ConstString selector)
std::atomic_flag m_dwo_warning_issued
bool ParseSupportFiles(CompileUnit &comp_unit, SupportFileList &support_files) override
XcodeSDK ParseXcodeSDK(CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
bool ParseImportedModules(const SymbolContext &sc, std::vector< SourceModule > &imported_modules) override
std::optional< uint64_t > GetDWOId()
If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
uint32_t CalculateAbilities() override
void GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) override
SymbolFileDWARFDebugMap * GetDebugMapSymfile()
void ParseDeclsForContext(CompilerDeclContext decl_ctx) override
std::unordered_map< lldb::offset_t, DebugMacrosSP > DebugMacrosMap
size_t ParseTypes(CompileUnit &comp_unit) override
std::shared_ptr< SymbolFileDWARFDwo > GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
~SymbolFileDWARF() override
lldb::VariableSP ParseVariableDIECached(const SymbolContext &sc, const DWARFDIE &die)
StatsDuration::Duration GetDebugInfoIndexTime() override
Return the time it took to index the debug information in the object file.
StatsDuration & GetDebugInfoParseTimeRef()
bool CompleteType(CompilerType &compiler_type) override
DWARFDebugInfo & DebugInfo()
bool ParseLineTable(CompileUnit &comp_unit) override
bool GetSeparateDebugInfo(StructuredData::Dictionary &d, bool errors_only) override
List separate dwo files.
bool ResolveFunction(const DWARFDIE &die, bool include_inlines, SymbolContextList &sc_list)
bool ParseIsOptimized(CompileUnit &comp_unit) override
static llvm::StringRef GetPluginDescriptionStatic()
std::vector< std::unique_ptr< CallEdge > > CollectCallEdges(lldb::ModuleSP module, DWARFDIE function_die)
Parse call site entries (DW_TAG_call_site), including any nested call site parameters (DW_TAG_call_si...
void Dump(Stream &s) override
DIEArray MergeBlockAbstractParameters(const DWARFDIE &block_die, DIEArray &&variable_dies)
std::unique_ptr< DWARFDebugRanges > m_ranges
DWARFDIE GetDeclContextDIEContainingDIE(const DWARFDIE &die)
SymbolFileDWARFDebugMap * m_debug_map_symfile
void SetFileIndex(std::optional< uint64_t > file_index)
void InitializeObject() override
Initialize the SymbolFile object.
void ParseAndAppendGlobalVariable(const SymbolContext &sc, const DWARFDIE &die, VariableList &cc_variable_list)
static llvm::Expected< lldb::TypeSystemSP > GetTypeSystem(DWARFUnit &unit)
DWARFContext & GetDWARFContext()
std::vector< uint32_t > m_lldb_cu_to_dwarf_unit
void FindFunctions(const Module::LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, bool include_inlines, SymbolContextList &sc_list) override
static bool DIEInDeclContext(const CompilerDeclContext &parent_decl_ctx, const DWARFDIE &die, bool only_root_namespaces=false)
uint32_t ResolveSymbolContext(const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) override
std::unique_ptr< DWARFIndex > m_index
bool HasForwardDeclForCompilerType(const CompilerType &compiler_type)
StatsDuration::Duration GetDebugInfoParseTime() override
Return the time taken to parse the debug information.
void PreloadSymbols() override
llvm::StringRef GetPluginName() override
TypeList & GetTypeList() override
const SymbolFileDWARF & operator=(const SymbolFileDWARF &)=delete
lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu)
CompilerDeclContext FindNamespace(ConstString name, const CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val)
lldb::TypeSP ParseType(const SymbolContext &sc, const DWARFDIE &die, bool *type_is_new)
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
std::vector< std::unique_ptr< CallEdge > > ParseCallEdgesInFunction(UserID func_id) override
lldb::addr_t FixupAddress(lldb::addr_t file_addr)
If this symbol file is linked to by a debug map (see SymbolFileDWARFDebugMap), and file_addr is a fil...
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language) override
bool isA(const void *ClassID) const override
LLVM RTTI support.
CompilerDecl GetDeclForUID(lldb::user_id_t uid) override
virtual SymbolFileDWARF * GetDIERefSymbolFile(const DIERef &die_ref)
Given a DIERef, find the correct SymbolFileDWARF.
std::optional< uint64_t > m_file_index
If this DWARF file a .DWO file or a DWARF .o file on mac when no dSYM file is being used,...
lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override
StatsDuration m_parse_time
llvm::once_flag m_dwp_symfile_once_flag
CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
static void DebuggerInitialize(Debugger &debugger)
RangeDataVector< lldb::addr_t, lldb::addr_t, Variable * > GlobalVariableMap
size_t ParseVariablesInFunctionContext(const SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
DebugMacrosMap m_debug_macros_map
llvm::DWARFDebugAbbrev * DebugAbbrev()
const ExternalTypeModuleMap & getExternalTypeModules() const
Return the list of Clang modules imported by this SymbolFile.
DIEToTypePtr m_die_to_type
SymbolFileDWARF(const SymbolFileDWARF &)=delete
bool GetFunction(const DWARFDIE &die, SymbolContext &sc)
const SupportFileList * GetTypeUnitSupportFiles(DWARFTypeUnit &tu)
llvm::StringMap< DIERefSet > NameToOffsetMap
virtual DIEToVariableSP & GetDIEToVariable()
std::optional< uint64_t > GetFileIndex() const
Symbol * GetObjCClassSymbol(ConstString objc_class_name)
static CompilerDeclContext GetDeclContext(const DWARFDIE &die)
virtual UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
virtual void LoadSectionData(lldb::SectionType sect_type, DWARFDataExtractor &data)
Status CalculateFrameVariableError(StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_OFFSET
std::vector< DIERef > DIEArray
std::shared_ptr< DebugMacros > DebugMacrosSP
std::weak_ptr< lldb_private::Module > ModuleWP
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
A mix in class that contains a generic user ID.