aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Symbol/SymbolFile.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Symbol/SymbolFile.h')
-rw-r--r--include/lldb/Symbol/SymbolFile.h97
1 files changed, 61 insertions, 36 deletions
diff --git a/include/lldb/Symbol/SymbolFile.h b/include/lldb/Symbol/SymbolFile.h
index dbb723e9d369..6724b425abf3 100644
--- a/include/lldb/Symbol/SymbolFile.h
+++ b/include/lldb/Symbol/SymbolFile.h
@@ -16,9 +16,11 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SourceModule.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/TypeList.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/lldb-private.h"
-
#include "llvm/ADT/DenseSet.h"
+#include "llvm/Support/Errc.h"
#include <mutex>
@@ -49,11 +51,12 @@ public:
kAllAbilities = ((1u << 7) - 1u)
};
- static SymbolFile *FindPlugin(ObjectFile *obj_file);
+ static SymbolFile *FindPlugin(lldb::ObjectFileSP objfile_sp);
// Constructors and Destructors
- SymbolFile(ObjectFile *obj_file)
- : m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
+ SymbolFile(lldb::ObjectFileSP objfile_sp)
+ : m_objfile_sp(std::move(objfile_sp)), m_abilities(0),
+ m_calculated_abilities(false) {}
~SymbolFile() override {}
@@ -110,13 +113,18 @@ public:
// Compile Unit function calls
// Approach 1 - iterator
- virtual uint32_t GetNumCompileUnits() = 0;
- virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
+ uint32_t GetNumCompileUnits();
+ lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx);
+
+ Symtab *GetSymtab();
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
virtual bool ParseLineTable(CompileUnit &comp_unit) = 0;
virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0;
+ virtual void
+ ForEachExternalModule(CompileUnit &comp_unit,
+ llvm::function_ref<void(lldb::ModuleSP)> f) {}
virtual bool ParseSupportFiles(CompileUnit &comp_unit,
FileSpecList &support_files) = 0;
virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
@@ -165,43 +173,41 @@ public:
SymbolContextList &sc_list);
virtual void DumpClangAST(Stream &s) {}
- virtual uint32_t
+ virtual void
FindGlobalVariables(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
uint32_t max_matches, VariableList &variables);
- virtual uint32_t FindGlobalVariables(const RegularExpression &regex,
- uint32_t max_matches,
- VariableList &variables);
- virtual uint32_t FindFunctions(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- lldb::FunctionNameType name_type_mask,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
- virtual uint32_t FindFunctions(const RegularExpression &regex,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
- virtual uint32_t
+ virtual void FindGlobalVariables(const RegularExpression &regex,
+ uint32_t max_matches,
+ VariableList &variables);
+ virtual void FindFunctions(ConstString name,
+ const CompilerDeclContext *parent_decl_ctx,
+ lldb::FunctionNameType name_type_mask,
+ bool include_inlines, SymbolContextList &sc_list);
+ virtual void FindFunctions(const RegularExpression &regex,
+ bool include_inlines, SymbolContextList &sc_list);
+ virtual void
FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
- bool append, uint32_t max_matches,
+ uint32_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types);
- virtual size_t FindTypes(const std::vector<CompilerContext> &context,
- bool append, TypeMap &types);
+
+ /// Find types specified by a CompilerContextPattern.
+ /// \param languages Only return results in these languages.
+ virtual void FindTypes(llvm::ArrayRef<CompilerContext> pattern,
+ LanguageSet languages, TypeMap &types);
virtual void
GetMangledNamesForFunction(const std::string &scope_qualified_name,
std::vector<ConstString> &mangled_names);
- // virtual uint32_t FindTypes (const SymbolContext& sc, const
- // RegularExpression& regex, bool append, uint32_t max_matches, TypeList&
- // types) = 0;
- virtual TypeList *GetTypeList();
- virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) = 0;
+
+ virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ lldb::TypeClass type_mask,
+ lldb_private::TypeList &type_list) = 0;
virtual void PreloadSymbols();
- virtual lldb_private::TypeSystem *
+ virtual llvm::Expected<lldb_private::TypeSystem &>
GetTypeSystemForLanguage(lldb::LanguageType language);
virtual CompilerDeclContext
@@ -210,8 +216,9 @@ public:
return CompilerDeclContext();
}
- ObjectFile *GetObjectFile() { return m_obj_file; }
- const ObjectFile *GetObjectFile() const { return m_obj_file; }
+ ObjectFile *GetObjectFile() { return m_objfile_sp.get(); }
+ const ObjectFile *GetObjectFile() const { return m_objfile_sp.get(); }
+ ObjectFile *GetMainObjectFile();
virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
return {};
@@ -221,7 +228,7 @@ public:
/// Notify the SymbolFile that the file addresses in the Sections
/// for this module have been changed.
- virtual void SectionFileAddressesChanged() {}
+ virtual void SectionFileAddressesChanged();
struct RegisterInfoResolver {
virtual ~RegisterInfoResolver(); // anchor
@@ -235,12 +242,30 @@ public:
return nullptr;
}
- virtual void Dump(Stream &s) {}
+ /// Return the number of stack bytes taken up by the parameters to this
+ /// function.
+ virtual llvm::Expected<lldb::addr_t> GetParameterStackSize(Symbol &symbol) {
+ return llvm::createStringError(make_error_code(llvm::errc::not_supported),
+ "Operation not supported.");
+ }
+
+ virtual void Dump(Stream &s);
protected:
void AssertModuleLock();
-
- ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
+ virtual uint32_t CalculateNumCompileUnits() = 0;
+ virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx) = 0;
+ virtual TypeList &GetTypeList() { return m_type_list; }
+
+ void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp);
+
+ lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
+ // case it isn't the same as the module
+ // object file (debug symbols in a separate
+ // file)
+ llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
+ TypeList m_type_list;
+ Symtab *m_symtab = nullptr;
uint32_t m_abilities;
bool m_calculated_abilities;