aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h117
1 files changed, 69 insertions, 48 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 23e26732453f..76ceb279c718 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -6,17 +6,17 @@
//
//===----------------------------------------------------------------------===//
-#ifndef SymbolFileDWARF_SymbolFileDWARF_h_
-#define SymbolFileDWARF_SymbolFileDWARF_h_
+#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
+#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H
#include <list>
#include <map>
#include <mutex>
-#include <set>
#include <unordered_map>
#include <vector>
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/Support/Threading.h"
#include "lldb/Core/UniqueCStringMap.h"
@@ -90,8 +90,6 @@ public:
static lldb_private::SymbolFile *
CreateInstance(lldb::ObjectFileSP objfile_sp);
- static lldb_private::FileSpecList GetSymlinkPaths();
-
// Constructors and Destructors
SymbolFileDWARF(lldb::ObjectFileSP objfile_sp,
@@ -108,6 +106,9 @@ public:
lldb::LanguageType
ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
+ lldb_private::XcodeSDK
+ ParseXcodeSDK(lldb_private::CompileUnit &comp_unit) override;
+
size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override;
bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override;
@@ -168,7 +169,7 @@ public:
void
FindGlobalVariables(lldb_private::ConstString name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx,
+ const lldb_private::CompilerDeclContext &parent_decl_ctx,
uint32_t max_matches,
lldb_private::VariableList &variables) override;
@@ -177,7 +178,7 @@ public:
lldb_private::VariableList &variables) override;
void FindFunctions(lldb_private::ConstString name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx,
+ const lldb_private::CompilerDeclContext &parent_decl_ctx,
lldb::FunctionNameType name_type_mask,
bool include_inlines,
lldb_private::SymbolContextList &sc_list) override;
@@ -192,7 +193,7 @@ public:
void
FindTypes(lldb_private::ConstString name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx,
+ const lldb_private::CompilerDeclContext &parent_decl_ctx,
uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
lldb_private::TypeMap &types) override;
@@ -211,7 +212,7 @@ public:
lldb_private::CompilerDeclContext FindNamespace(
lldb_private::ConstString name,
- const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
+ const lldb_private::CompilerDeclContext &parent_decl_ctx) override;
void PreloadSymbols() override;
@@ -224,11 +225,7 @@ public:
DWARFDebugAbbrev *DebugAbbrev();
- const DWARFDebugAbbrev *DebugAbbrev() const;
-
- DWARFDebugInfo *DebugInfo();
-
- const DWARFDebugInfo *DebugInfo() const;
+ DWARFDebugInfo &DebugInfo();
DWARFDebugRanges *GetDebugRanges();
@@ -243,8 +240,8 @@ public:
lldb_private::CompileUnit *
GetCompUnitForDWARFCompUnit(DWARFCompileUnit &dwarf_cu);
- virtual size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
- DIEArray &method_die_offsets);
+ virtual void GetObjCMethods(lldb_private::ConstString class_name,
+ llvm::function_ref<bool(DWARFDIE die)> callback);
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFUnit *cu);
@@ -252,8 +249,6 @@ public:
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die);
- virtual lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu);
-
lldb::ModuleSP GetExternalModule(lldb_private::ConstString name);
typedef std::map<lldb_private::ConstString, lldb::ModuleSP>
@@ -278,22 +273,17 @@ public:
lldb::user_id_t GetUID(DIERef ref);
- std::unique_ptr<SymbolFileDWARFDwo>
+ std::shared_ptr<SymbolFileDWARFDwo>
GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu,
const DWARFDebugInfoEntry &cu_die);
- // For regular SymbolFileDWARF instances the method returns nullptr,
- // for the instances of the subclass SymbolFileDWARFDwo
- // the method returns a pointer to the base compile unit.
- virtual DWARFCompileUnit *GetBaseCompileUnit() { return nullptr; }
-
virtual llvm::Optional<uint32_t> GetDwoNum() { return llvm::None; }
/// If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
llvm::Optional<uint64_t> GetDWOId();
static bool
- DIEInDeclContext(const lldb_private::CompilerDeclContext *parent_decl_ctx,
+ DIEInDeclContext(const lldb_private::CompilerDeclContext &parent_decl_ctx,
const DWARFDIE &die);
std::vector<std::unique_ptr<lldb_private::CallEdge>>
@@ -305,8 +295,30 @@ public:
lldb_private::DWARFContext &GetDWARFContext() { return m_context; }
+ const std::shared_ptr<SymbolFileDWARFDwo> &GetDwpSymbolFile();
+
lldb_private::FileSpec GetFile(DWARFUnit &unit, size_t file_idx);
+ static llvm::Expected<lldb_private::TypeSystem &>
+ GetTypeSystem(DWARFUnit &unit);
+
+ static DWARFASTParser *GetDWARFParser(DWARFUnit &unit);
+
+ // CompilerDecl related functions
+
+ static lldb_private::CompilerDecl GetDecl(const DWARFDIE &die);
+
+ static lldb_private::CompilerDeclContext GetDeclContext(const DWARFDIE &die);
+
+ static lldb_private::CompilerDeclContext
+ GetContainingDeclContext(const DWARFDIE &die);
+
+ static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE &die);
+
+ static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
+
+ static lldb::LanguageType GetLanguage(DWARFUnit &unit);
+
protected:
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *>
DIEToTypePtr;
@@ -315,25 +327,16 @@ protected:
typedef llvm::DenseMap<const DWARFDebugInfoEntry *,
lldb::opaque_compiler_type_t>
DIEToClangType;
- typedef llvm::DenseMap<lldb::opaque_compiler_type_t, lldb::user_id_t>
- ClangTypeToDIE;
+ typedef llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> ClangTypeToDIE;
- struct DWARFDataSegment {
- llvm::once_flag m_flag;
- lldb_private::DWARFDataExtractor m_data;
- };
-
- DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF);
-
- const lldb_private::DWARFDataExtractor &
- GetCachedSectionData(lldb::SectionType sect_type,
- DWARFDataSegment &data_segment);
+ SymbolFileDWARF(const SymbolFileDWARF &) = delete;
+ const SymbolFileDWARF &operator=(const SymbolFileDWARF &) = delete;
virtual void LoadSectionData(lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data);
bool DeclContextMatchesThisSymbolFile(
- const lldb_private::CompilerDeclContext *decl_ctx);
+ const lldb_private::CompilerDeclContext &decl_ctx);
uint32_t CalculateNumCompileUnits() override;
@@ -341,6 +344,8 @@ protected:
lldb_private::TypeList &GetTypeList() override;
+ lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu);
+
virtual DWARFUnit *
GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit);
@@ -383,6 +388,13 @@ protected:
bool ResolveFunction(const DWARFDIE &die, bool include_inlines,
lldb_private::SymbolContextList &sc_list);
+ /// Resolve functions and (possibly) blocks for the given file address and a
+ /// compile unit. The compile unit comes from the sc argument and it must be
+ /// set. The results of the lookup (if any) are written back to the symbol
+ /// context.
+ void ResolveFunctionAndBlock(lldb::addr_t file_vm_addr, bool lookup_block,
+ lldb_private::SymbolContext &sc);
+
virtual lldb::TypeSP
FindDefinitionTypeForDWARFDeclContext(const DWARFDeclContext &die_decl_ctx);
@@ -417,9 +429,21 @@ protected:
bool ClassContainsSelector(const DWARFDIE &class_die,
lldb_private::ConstString selector);
+ /// Parse call site entries (DW_TAG_call_site), including any nested call site
+ /// parameters (DW_TAG_call_site_parameter).
+ std::vector<std::unique_ptr<lldb_private::CallEdge>>
+ CollectCallEdges(lldb::ModuleSP module, DWARFDIE function_die);
+
+ /// If this symbol file is linked to by a debug map (see
+ /// SymbolFileDWARFDebugMap), and \p file_addr is a file address relative to
+ /// an object file, adjust \p file_addr so that it is relative to the main
+ /// binary. Returns the adjusted address, or \p file_addr if no adjustment is
+ /// needed, on success and LLDB_INVALID_ADDRESS otherwise.
+ lldb::addr_t FixupAddress(lldb::addr_t file_addr);
+
bool FixupAddress(lldb_private::Address &addr);
- typedef std::set<lldb_private::Type *> TypeSet;
+ typedef llvm::SetVector<lldb_private::Type *> TypeSet;
void GetTypes(const DWARFDIE &die, dw_offset_t min_die_offset,
dw_offset_t max_die_offset, uint32_t type_mask,
@@ -454,7 +478,7 @@ protected:
};
llvm::Optional<DecodedUID> DecodeUID(lldb::user_id_t uid);
- SymbolFileDWARFDwp *GetDwpSymbolFile();
+ void FindDwpSymbolFile();
const lldb_private::FileSpecList &GetTypeUnitSupportFiles(DWARFTypeUnit &tu);
@@ -462,17 +486,14 @@ protected:
SymbolFileDWARFDebugMap *m_debug_map_symfile;
llvm::once_flag m_dwp_symfile_once_flag;
- std::unique_ptr<SymbolFileDWARFDwp> m_dwp_symfile;
+ std::shared_ptr<SymbolFileDWARFDwo> m_dwp_symfile;
lldb_private::DWARFContext m_context;
- DWARFDataSegment m_data_debug_loc;
- DWARFDataSegment m_data_debug_loclists;
+ llvm::once_flag m_info_once_flag;
+ std::unique_ptr<DWARFDebugInfo> m_info;
- // The unique pointer items below are generated on demand if and when someone
- // accesses them through a non const version of this class.
std::unique_ptr<DWARFDebugAbbrev> m_abbr;
- std::unique_ptr<DWARFDebugInfo> m_info;
std::unique_ptr<GlobalVariableMap> m_global_aranges_up;
typedef std::unordered_map<lldb::offset_t, lldb_private::DebugMacrosSP>
@@ -484,7 +505,7 @@ protected:
bool m_fetched_external_modules : 1;
lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
- typedef std::set<lldb::user_id_t> DIERefSet;
+ typedef std::set<DIERef> DIERefSet;
typedef llvm::StringMap<DIERefSet> NameToOffsetMap;
NameToOffsetMap m_function_scope_qualified_name_map;
std::unique_ptr<DWARFDebugRanges> m_ranges;
@@ -498,4 +519,4 @@ protected:
std::vector<uint32_t> m_lldb_cu_to_dwarf_unit;
};
-#endif // SymbolFileDWARF_SymbolFileDWARF_h_
+#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_SYMBOLFILEDWARF_H