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"
56class SymbolFileDWARFDwp;
59#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
68 bool isA(
const void *ClassID)
const override {
69 return ClassID == &
ID || SymbolFileCommon::isA(ClassID);
133 std::vector<lldb_private::SourceModule> &imported_modules)
override;
148 bool assert_not_being_parsed =
true,
149 bool resolve_function_context =
false);
163 lldb::SymbolContextItem resolve_scope,
171 lldb::SymbolContextItem resolve_scope,
186 bool include_inlines,
190 bool include_inlines,
194 const std::string &scope_qualified_name,
195 std::vector<lldb_private::ConstString> &mangled_names)
override;
201 llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
204 void FindTypes(llvm::ArrayRef<lldb_private::CompilerContext> pattern,
206 llvm::DenseSet<SymbolFile *> &searched_symbol_files,
210 lldb::TypeClass type_mask,
213 llvm::Expected<lldb::TypeSystemSP>
219 bool only_root_namespaces)
override;
246 llvm::function_ref<
bool(
DWARFDIE die)> callback);
256 typedef std::map<lldb_private::ConstString, lldb::ModuleSP>
268 std::shared_ptr<SymbolFileDWARFDwo>
277 const DWARFDIE &die,
bool only_root_namespaces =
false);
279 std::vector<std::unique_ptr<lldb_private::CallEdge>>
325 const uint8_t op)
const {
332 std::vector<lldb_private::Value> &stack)
const {
344 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *>
346 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP>
386 bool parse_siblings,
bool parse_children);
389 const DWARFDIE &die,
bool *type_is_new);
395 bool assert_not_being_parsed);
420 llvm::ArrayRef<DIERef> variable_dies,
445 bool must_be_implementation);
451 bool resolve_function_context =
false);
476 std::vector<std::unique_ptr<lldb_private::CallEdge>>
488 typedef llvm::SetVector<lldb_private::Type *>
TypeSet;
527 std::unordered_map<lldb::CompUnitSP, lldb_private::Args> &args)
override;
540 std::unique_ptr<DWARFDebugAbbrev>
m_abbr;
543 typedef std::unordered_map<lldb::offset_t, lldb_private::DebugMacrosSP>
548 std::unique_ptr<lldb_private::DWARFIndex>
m_index;
561 llvm::DenseMap<dw_offset_t, lldb_private::FileSpecList>
std::vector< DIERef > DIEArray
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...
lldb_private::CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) override
static lldb_private::CompilerDeclContext GetContainingDeclContext(const DWARFDIE &die)
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(const DWARFDIE &die, lldb_private::ConstString type_name, bool must_be_implementation)
static bool SupportedVersion(uint16_t version)
void FindTypes(llvm::ArrayRef< lldb_private::CompilerContext > pattern, lldb_private::LanguageSet languages, llvm::DenseSet< SymbolFile * > &searched_symbol_files, lldb_private::TypeMap &types) override
const SymbolFileDWARF & operator=(const SymbolFileDWARF &)=delete
std::optional< uint32_t > GetDWARFUnitIndex(uint32_t cu_idx)
virtual DIEToVariableSP & GetDIEToVariable()
uint32_t ResolveSymbolContext(const lldb_private::SourceLocationSpec &src_location_spec, lldb::SymbolContextItem resolve_scope, lldb_private::SymbolContextList &sc_list) override
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb::VariableSP > DIEToVariableSP
lldb_private::CompileUnit * GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu)
DWARFDebugRanges * GetDebugRanges()
void BuildCuTranslationTable()
size_t ParseVariablesForContext(const lldb_private::SymbolContext &sc) override
SymbolFileDWARF(const SymbolFileDWARF &)=delete
DWARFDIE FindBlockContainingSpecification(const DIERef &func_die_ref, dw_offset_t spec_block_die_offset)
void Dump(lldb_private::Stream &s) override
size_t ParseVariablesInFunctionContext(const lldb_private::SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
bool HasForwardDeclForClangType(const lldb_private::CompilerType &compiler_type)
void UpdateExternalModuleListIfNeeded()
DIEToVariableSP m_die_to_variable_sp
DebugMacrosMap m_debug_macros_map
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).
const lldb_private::FileSpecList & GetTypeUnitSupportFiles(DWARFTypeUnit &tu)
bool ResolveFunction(const DWARFDIE &die, bool include_inlines, lldb_private::SymbolContextList &sc_list)
static char ID
LLVM RTTI support.
size_t ParseVariablesInFunctionContextRecursive(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb::addr_t func_low_pc, DIEArray &accumulator)
lldb_private::StatsDuration & GetDebugInfoParseTimeRef()
std::map< lldb_private::ConstString, lldb::ModuleSP > ExternalTypeModuleMap
lldb_private::CompilerDeclContext FindNamespace(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, bool only_root_namespaces) override
Finds a namespace of name name and whose parent context is parent_decl_ctx.
static bool DIEInDeclContext(const lldb_private::CompilerDeclContext &parent_decl_ctx, const DWARFDIE &die, bool only_root_namespaces=false)
DWARFDebugAbbrev * DebugAbbrev()
lldb_private::Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb_private::Type * > DIEToTypePtr
virtual lldb::offset_t GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data, const lldb::offset_t data_offset, const uint8_t op) const
ExternalTypeModuleMap m_external_type_modules
bool isA(const void *ClassID) const override
LLVM RTTI support.
std::unique_ptr< DWARFDebugAbbrev > m_abbr
size_t PopulateBlockVariableList(lldb_private::VariableList &variable_list, const lldb_private::SymbolContext &sc, llvm::ArrayRef< DIERef > variable_dies, lldb::addr_t func_low_pc)
lldb_private::Function * ParseFunction(lldb_private::CompileUnit &comp_unit, const DWARFDIE &die)
DWARFUnit * GetNextUnparsedDWARFCompileUnit(DWARFUnit *prev_cu)
lldb::ModuleSP GetExternalModule(lldb_private::ConstString name)
void InitializeFirstCodeAddressRecursive(const lldb_private::SectionList §ion_list)
const std::shared_ptr< SymbolFileDWARFDwo > & GetDwpSymbolFile()
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override
std::recursive_mutex & GetModuleMutex() const override
Symbols file subclasses should override this to return the Module that owns the TypeSystem that this ...
bool ClassContainsSelector(const DWARFDIE &class_die, lldb_private::ConstString selector)
virtual DWARFCompileUnit * GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit)
std::optional< ArrayInfo > GetDynamicArrayInfoForUID(lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) override
If type_uid points to an array type, return its characteristics.
lldb_private::RangeDataVector< lldb::addr_t, lldb::addr_t, lldb_private::Variable * > GlobalVariableMap
uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr, lldb::SymbolContextItem resolve_scope, lldb_private::SymbolContext &sc) override
bool CompleteType(lldb_private::CompilerType &compiler_type) override
GlobalVariableMap & GetGlobalAranges()
lldb::TypeSP GetTypeForDIE(const DWARFDIE &die, bool resolve_function_context=false)
NameToOffsetMap m_function_scope_qualified_name_map
bool ParseImportedModules(const lldb_private::SymbolContext &sc, std::vector< lldb_private::SourceModule > &imported_modules) override
size_t ParseBlocksRecursive(lldb_private::Function &func) override
lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override
lldb_private::ConstString ConstructFunctionDemangledName(const DWARFDIE &die)
std::unique_ptr< GlobalVariableMap > m_global_aranges_up
bool ForEachExternalModule(lldb_private::CompileUnit &, llvm::DenseSet< lldb_private::SymbolFile * > &, llvm::function_ref< bool(lldb_private::Module &)>) override
virtual DIEToClangType & GetForwardDeclDieToClangType()
std::optional< uint64_t > GetFileIndex() const
lldb_private::FileSpec GetFile(DWARFUnit &unit, size_t file_idx)
ClangTypeToDIE m_forward_decl_clang_type_to_die
size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override
static bool classof(const SymbolFile *obj)
virtual DWARFDIE GetDIE(const DIERef &die_ref)
SymbolFileDWARF(lldb::ObjectFileSP objfile_sp, lldb_private::SectionList *dwo_section_list)
void InitializeFirstCodeAddress()
void SetFileIndex(std::optional< uint64_t > file_index)
virtual bool ParseVendorDWARFOpcode(uint8_t op, const lldb_private::DataExtractor &opcodes, lldb::offset_t &offset, std::vector< lldb_private::Value > &stack) const
bool DeclContextMatchesThisSymbolFile(const lldb_private::CompilerDeclContext &decl_ctx)
lldb::TypeSP ParseType(const lldb_private::SymbolContext &sc, const DWARFDIE &die, bool *type_is_new)
static lldb_private::CompilerDecl GetDecl(const DWARFDIE &die)
llvm::StringMap< DIERefSet > NameToOffsetMap
static void DebuggerInitialize(lldb_private::Debugger &debugger)
virtual void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data)
void FindTypes(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, lldb_private::TypeMap &types) override
uint32_t CalculateNumCompileUnits() override
static llvm::StringRef GetPluginNameStatic()
llvm::DenseMap< dw_offset_t, lldb_private::FileSpecList > m_type_unit_support_files
lldb_private::Type * ResolveTypeUID(lldb::user_id_t type_uid) override
static lldb::LanguageType GetLanguage(DWARFUnit &unit)
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,...
bool ClassOrStructIsVirtual(const DWARFDIE &die)
std::shared_ptr< SymbolFileDWARFDwo > m_dwp_symfile
std::unique_ptr< DWARFDebugRanges > m_ranges
void FindGlobalVariables(lldb_private::ConstString name, const lldb_private::CompilerDeclContext &parent_decl_ctx, uint32_t max_matches, lldb_private::VariableList &variables) override
bool GetFunction(const DWARFDIE &die, lldb_private::SymbolContext &sc)
static lldb_private::SymbolFile * CreateInstance(lldb::ObjectFileSP objfile_sp)
lldb_private::XcodeSDK ParseXcodeSDK(lldb_private::CompileUnit &comp_unit) override
Return the Xcode SDK comp_unit was compiled against.
std::unordered_map< lldb::offset_t, lldb_private::DebugMacrosSP > DebugMacrosMap
lldb_private::StatsDuration m_parse_time
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
SymbolFileDWARFDebugMap * GetDebugMapSymfile()
std::shared_ptr< SymbolFileDWARFDwo > GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
std::set< DIERef > DIERefSet
bool ParseSupportFiles(DWARFUnit &dwarf_cu, const lldb::ModuleSP &module, lldb_private::FileSpecList &support_files)
bool m_fetched_external_modules
lldb::addr_t m_first_code_address
DWARF does not provide a good way for traditional (concatenating) linkers to invalidate debug info de...
llvm::StringRef GetPluginName() override
static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE &die)
~SymbolFileDWARF() override
lldb_private::StatsDuration::Duration GetDebugInfoIndexTime() override
Return the time it took to index the debug information in the object file.
lldb_private::DWARFContext m_context
DWARFDebugInfo & DebugInfo()
lldb_private::Status CalculateFrameVariableError(lldb_private::StackFrame &frame) override
Subclasses will override this function to for GetFrameVariableError().
virtual lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(const DWARFDIE &die)
static llvm::StringRef GetPluginDescriptionStatic()
std::vector< std::unique_ptr< lldb_private::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...
DIEArray MergeBlockAbstractParameters(const DWARFDIE &block_die, DIEArray &&variable_dies)
DWARFDIE GetDeclContextDIEContainingDIE(const DWARFDIE &die)
const ExternalTypeModuleMap & getExternalTypeModules() const
Return the list of Clang modules imported by this SymbolFile.
void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block, lldb_private::SymbolContext &sc)
Resolve functions and (possibly) blocks for the given file address and a compile unit.
llvm::once_flag m_info_once_flag
void InitializeObject() override
Initialize the SymbolFile object.
static llvm::Expected< lldb::TypeSystemSP > GetTypeSystem(DWARFUnit &unit)
std::vector< uint32_t > m_lldb_cu_to_dwarf_unit
lldb_private::Symbol * GetObjCClassSymbol(lldb_private::ConstString objc_class_name)
DIEToClangType m_forward_decl_die_to_clang_type
void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector< lldb_private::ConstString > &mangled_names) override
std::atomic_flag m_dwo_warning_issued
void PreloadSymbols() override
lldb::VariableSP ParseVariableDIE(const lldb_private::SymbolContext &sc, const DWARFDIE &die, const lldb::addr_t func_low_pc)
lldb_private::TypeList & GetTypeList() override
std::unique_ptr< lldb_private::DWARFIndex > m_index
std::vector< std::unique_ptr< lldb_private::CallEdge > > ParseCallEdgesInFunction(lldb_private::UserID func_id) override
llvm::once_flag m_dwp_symfile_once_flag
lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu)
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override
llvm::SetVector< lldb_private::Type * > TypeSet
static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val)
void DumpClangAST(lldb_private::Stream &s) override
bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit, lldb_private::FileSpecList &support_files) override
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
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
llvm::DenseMap< const DWARFDebugInfoEntry *, lldb::opaque_compiler_type_t > DIEToClangType
lldb_private::DWARFContext & GetDWARFContext()
lldb_private::CompilerDecl GetDeclForUID(lldb::user_id_t uid) override
std::unique_ptr< DWARFDebugInfo > m_info
virtual void GetObjCMethods(lldb_private::ConstString class_name, llvm::function_ref< bool(DWARFDIE die)> callback)
virtual DIEToTypePtr & GetDIEToType()
void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) override
lldb_private::CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) override
void SetDebugMapModule(const lldb::ModuleSP &module_sp)
void ParseAndAppendGlobalVariable(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb_private::VariableList &cc_variable_list)
virtual ClangTypeToDIE & GetForwardDeclClangTypeToDie()
lldb::ModuleWP m_debug_map_module_wp
lldb::VariableSP ParseVariableDIECached(const lldb_private::SymbolContext &sc, const DWARFDIE &die)
SymbolFileDWARFDebugMap * m_debug_map_symfile
DIEToTypePtr m_die_to_type
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override
UniqueDWARFASTTypeMap m_unique_ast_type_map
void ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override
bool DIEDeclContextsMatch(const DWARFDIE &die1, const DWARFDIE &die2)
bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override
llvm::DenseMap< lldb::opaque_compiler_type_t, DIERef > ClangTypeToDIE
lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type
static lldb_private::CompilerDeclContext GetDeclContext(const DWARFDIE &die)
lldb_private::StatsDuration::Duration GetDebugInfoParseTime() override
Return the time taken to parse the debug information.
bool ParseIsOptimized(lldb_private::CompileUnit &comp_unit) override
virtual UniqueDWARFASTTypeMap & GetUniqueDWARFASTTypeMap()
void FindFunctions(const lldb_private::Module::LookupInfo &lookup_info, const lldb_private::CompilerDeclContext &parent_decl_ctx, bool include_inlines, lldb_private::SymbolContextList &sc_list) override
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.
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.
Provides public interface for all SymbolFiles.
std::unordered_map< lldb::CompUnitSP, Args > GetCompileOptions()
Returns a map of compilation unit to the compile option arguments associated with that compilation un...
An abstraction for Xcode-style SDKs that works like ArchSpec.
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_OFFSET
std::shared_ptr< DebugMacros > DebugMacrosSP
void * opaque_compiler_type_t
LanguageType
Programming language type.
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
A mix in class that contains a generic user ID.