aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Symbol
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
commitead246455adf1a215ec2715dad6533073a6beb4e (patch)
treef3f97a47d77053bf96fe74cdbd6fae74380e8a92 /include/lldb/Symbol
parentfdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff)
downloadsrc-ead246455adf1a215ec2715dad6533073a6beb4e.tar.gz
src-ead246455adf1a215ec2715dad6533073a6beb4e.zip
Vendor import of stripped lldb trunk r375505, the last commit before thevendor/lldb/lldb-trunk-r375505vendor/lldb
upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lldb/trunk@375505
Notes
Notes: svn path=/vendor/lldb/dist/; revision=353952 svn path=/vendor/lldb/lldb-r375505/; revision=353953; tag=vendor/lldb/lldb-trunk-r375505
Diffstat (limited to 'include/lldb/Symbol')
-rw-r--r--include/lldb/Symbol/CallFrameInfo.h28
-rw-r--r--include/lldb/Symbol/ClangASTContext.h132
-rw-r--r--include/lldb/Symbol/ClangASTImporter.h58
-rw-r--r--include/lldb/Symbol/CompileUnit.h10
-rw-r--r--include/lldb/Symbol/CompilerType.h13
-rw-r--r--include/lldb/Symbol/DeclVendor.h24
-rw-r--r--include/lldb/Symbol/FuncUnwinders.h9
-rw-r--r--include/lldb/Symbol/Function.h31
-rw-r--r--include/lldb/Symbol/ObjectFile.h46
-rw-r--r--include/lldb/Symbol/PostfixExpression.h6
-rw-r--r--include/lldb/Symbol/Symbol.h5
-rw-r--r--include/lldb/Symbol/SymbolContext.h2
-rw-r--r--include/lldb/Symbol/SymbolFile.h97
-rw-r--r--include/lldb/Symbol/SymbolVendor.h108
-rw-r--r--include/lldb/Symbol/Symtab.h22
-rw-r--r--include/lldb/Symbol/Type.h21
-rw-r--r--include/lldb/Symbol/TypeList.h5
-rw-r--r--include/lldb/Symbol/TypeSystem.h51
-rw-r--r--include/lldb/Symbol/UnwindPlan.h35
-rw-r--r--include/lldb/Symbol/UnwindTable.h3
-rw-r--r--include/lldb/Symbol/Variable.h79
-rw-r--r--include/lldb/Symbol/VerifyDecl.h18
22 files changed, 411 insertions, 392 deletions
diff --git a/include/lldb/Symbol/CallFrameInfo.h b/include/lldb/Symbol/CallFrameInfo.h
new file mode 100644
index 000000000000..765ddb41ab0c
--- /dev/null
+++ b/include/lldb/Symbol/CallFrameInfo.h
@@ -0,0 +1,28 @@
+//===-- CallFrameInfo.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CallFrameInfo_h_
+#define liblldb_CallFrameInfo_h_
+
+#include "lldb/Core/Address.h"
+
+namespace lldb_private {
+
+class CallFrameInfo {
+public:
+ virtual ~CallFrameInfo() = default;
+
+ virtual bool GetAddressRange(Address addr, AddressRange &range) = 0;
+
+ virtual bool GetUnwindPlan(const Address &addr, UnwindPlan &unwind_plan) = 0;
+ virtual bool GetUnwindPlan(const AddressRange &range, UnwindPlan &unwind_plan) = 0;
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_CallFrameInfo_h_
diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h
index d0a834e01f3a..c5d840973ae6 100644
--- a/include/lldb/Symbol/ClangASTContext.h
+++ b/include/lldb/Symbol/ClangASTContext.h
@@ -26,8 +26,8 @@
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/SmallVector.h"
-#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "lldb/Core/ClangForward.h"
+#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Utility/ConstString.h"
@@ -52,7 +52,14 @@ public:
}
// Constructors and Destructors
- ClangASTContext(const char *triple = nullptr);
+ explicit ClangASTContext(llvm::StringRef triple = "");
+ explicit ClangASTContext(ArchSpec arch);
+
+ /// Constructs a ClangASTContext that uses an existing ASTContext internally.
+ /// Useful when having an existing ASTContext created by Clang.
+ ///
+ /// \param existing_ctxt An existing ASTContext.
+ explicit ClangASTContext(clang::ASTContext &existing_ctxt);
~ClangASTContext() override;
@@ -68,9 +75,8 @@ public:
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
Module *module, Target *target);
- static void EnumerateSupportedLanguages(
- std::set<lldb::LanguageType> &languages_for_types,
- std::set<lldb::LanguageType> &languages_for_expressions);
+ static LanguageSet GetSupportedLanguagesForTypes();
+ static LanguageSet GetSupportedLanguagesForExpressions();
static void Initialize();
@@ -80,8 +86,6 @@ public:
clang::ASTContext *getASTContext();
- void setASTContext(clang::ASTContext *ast_ctx);
-
clang::Builtin::Context *getBuiltinContext();
clang::IdentifierTable *getIdentifierTable();
@@ -107,21 +111,11 @@ public:
void setSema(clang::Sema *s);
clang::Sema *getSema() { return m_sema; }
- void Clear();
-
const char *GetTargetTriple();
- void SetTargetTriple(const char *target_triple);
-
- void SetArchitecture(const ArchSpec &arch);
-
- bool HasExternalSource();
-
void SetExternalSource(
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
- void RemoveExternalSource();
-
bool GetCompleteDecl(clang::Decl *decl) {
return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
}
@@ -229,7 +223,8 @@ public:
if (const RecordDeclType *record_decl =
llvm::dyn_cast<RecordDeclType>(named_decl))
compiler_type.SetCompilerType(
- ast, clang::QualType(record_decl->getTypeForDecl(), 0));
+ this, clang::QualType(record_decl->getTypeForDecl(), 0)
+ .getAsOpaquePtr());
}
}
}
@@ -249,7 +244,7 @@ public:
&type_fields,
bool packed = false);
- static bool IsOperator(const char *name,
+ static bool IsOperator(llvm::StringRef name,
clang::OverloadedOperatorKind &op_kind);
// Structure, Unions, Classes
@@ -395,7 +390,8 @@ public:
clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
const char *name,
const CompilerType &param_type,
- int storage);
+ int storage,
+ bool add_decl=false);
void SetFunctionParameters(clang::FunctionDecl *function_decl,
clang::ParmVarDecl **params, unsigned num_params);
@@ -464,6 +460,8 @@ public:
CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx) override;
+ CompilerType GetTypeForDecl(void *opaque_decl) override;
+
// CompilerDeclContext override functions
std::vector<CompilerDecl>
@@ -605,9 +603,6 @@ public:
static bool GetCXXClassName(const CompilerType &type,
std::string &class_name);
- static bool GetObjCClassName(const CompilerType &type,
- std::string &class_name);
-
// Type Completion
bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
@@ -691,6 +686,8 @@ public:
// Exploring the type
+ const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) override;
+
llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) {
if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
@@ -707,7 +704,9 @@ public:
lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
- size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+ llvm::Optional<size_t>
+ GetTypeBitAlign(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) override;
uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
bool omit_empty_base_classes,
@@ -855,7 +854,6 @@ public:
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
bool has_extern);
- static bool GetHasExternalStorage(const CompilerType &type);
// Tag Declarations
static bool StartTagDeclarationDefinition(const CompilerType &type);
@@ -878,12 +876,6 @@ public:
static CompilerType CreateMemberPointerType(const CompilerType &type,
const CompilerType &pointee_type);
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
- const char *s, uint8_t *dst,
- size_t dst_size) override;
-
// Dumping types
#ifndef NDEBUG
/// Convenience LLVM-style dump method for use in the debugger only.
@@ -894,6 +886,14 @@ public:
void Dump(Stream &s);
+ /// Dump clang AST types from the symbol file.
+ ///
+ /// \param[in] s
+ /// A stream to send the dumped AST node(s) to
+ /// \param[in] symbol_name
+ /// The name of the symbol to dump, if it is empty dump all the symbols
+ void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name);
+
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
Stream *s, lldb::Format format, const DataExtractor &data,
lldb::offset_t data_offset, size_t data_byte_size,
@@ -977,43 +977,45 @@ protected:
GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
// Classes that inherit from ClangASTContext can see and modify these
- // clang-format off
- std::string m_target_triple;
- std::unique_ptr<clang::ASTContext> m_ast_up;
- std::unique_ptr<clang::LangOptions> m_language_options_up;
- std::unique_ptr<clang::FileManager> m_file_manager_up;
- std::unique_ptr<clang::SourceManager> m_source_manager_up;
- std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
- std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
- std::shared_ptr<clang::TargetOptions> m_target_options_rp;
- std::unique_ptr<clang::TargetInfo> m_target_info_up;
- std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
- std::unique_ptr<clang::SelectorTable> m_selector_table_up;
- std::unique_ptr<clang::Builtin::Context> m_builtins_up;
- std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
- std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
- std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
- std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
- CompleteTagDeclCallback m_callback_tag_decl;
- CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
- void * m_callback_baton;
- clang::ExternalASTMerger::OriginMap m_origins;
- uint32_t m_pointer_byte_size;
- bool m_ast_owned;
- /// The sema associated that is currently used to build this ASTContext.
- /// May be null if we are already done parsing this ASTContext or the
- /// ASTContext wasn't created by parsing source code.
- clang::Sema * m_sema = nullptr;
- // clang-format on
+ std::string m_target_triple;
+ std::unique_ptr<clang::ASTContext> m_ast_up;
+ std::unique_ptr<clang::LangOptions> m_language_options_up;
+ std::unique_ptr<clang::FileManager> m_file_manager_up;
+ std::unique_ptr<clang::SourceManager> m_source_manager_up;
+ std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
+ std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
+ std::shared_ptr<clang::TargetOptions> m_target_options_rp;
+ std::unique_ptr<clang::TargetInfo> m_target_info_up;
+ std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
+ std::unique_ptr<clang::SelectorTable> m_selector_table_up;
+ std::unique_ptr<clang::Builtin::Context> m_builtins_up;
+ std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
+ std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
+ std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
+ std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
+ CompleteTagDeclCallback m_callback_tag_decl = nullptr;
+ CompleteObjCInterfaceDeclCallback m_callback_objc_decl = nullptr;
+ void *m_callback_baton = nullptr;
+ clang::ExternalASTMerger::OriginMap m_origins;
+ uint32_t m_pointer_byte_size = 0;
+ bool m_ast_owned = false;
+ /// The sema associated that is currently used to build this ASTContext.
+ /// May be null if we are already done parsing this ASTContext or the
+ /// ASTContext wasn't created by parsing source code.
+ clang::Sema *m_sema = nullptr;
+
private:
// For ClangASTContext only
ClangASTContext(const ClangASTContext &);
const ClangASTContext &operator=(const ClangASTContext &);
+ /// Creates the internal ASTContext.
+ void CreateASTContext();
+ void SetTargetTriple(llvm::StringRef target_triple);
};
class ClangASTContextForExpressions : public ClangASTContext {
public:
- ClangASTContextForExpressions(Target &target);
+ ClangASTContextForExpressions(Target &target, ArchSpec arch);
~ClangASTContextForExpressions() override = default;
@@ -1041,13 +1043,9 @@ public:
}
private:
lldb::TargetWP m_target_wp;
- lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
- ///persistent
- ///variables
- ///associated with
- ///this process for
- ///the expression
- ///parser.
+ std::unique_ptr<PersistentExpressionState>
+ m_persistent_variables; // These are the persistent variables associated
+ // with this process for the expression parser
};
} // namespace lldb_private
diff --git a/include/lldb/Symbol/ClangASTImporter.h b/include/lldb/Symbol/ClangASTImporter.h
index 353b1232d940..f963f9b2b1dc 100644
--- a/include/lldb/Symbol/ClangASTImporter.h
+++ b/include/lldb/Symbol/ClangASTImporter.h
@@ -210,7 +210,7 @@ public:
void ForgetDestination(clang::ASTContext *dst_ctx);
void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
-private:
+public:
struct DeclOrigin {
DeclOrigin() : ctx(nullptr), decl(nullptr) {}
@@ -235,24 +235,32 @@ private:
typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
+ /// Listener interface used by the ASTImporterDelegate to inform other code
+ /// about decls that have been imported the first time.
+ struct NewDeclListener {
+ virtual ~NewDeclListener() = default;
+ /// A decl has been imported for the first time.
+ virtual void NewDeclImported(clang::Decl *from, clang::Decl *to) = 0;
+ };
+
/// ASTImporter that intercepts and records the import process of the
/// underlying ASTImporter.
///
/// This class updates the map from declarations to their original
- /// declarations and can record and complete declarations that have been
- /// imported in a certain interval.
+ /// declarations and can record declarations that have been imported in a
+ /// certain interval.
///
/// When intercepting a declaration import, the ASTImporterDelegate uses the
/// CxxModuleHandler to replace any missing or malformed declarations with
/// their counterpart from a C++ module.
- class ASTImporterDelegate : public clang::ASTImporter {
- public:
+ struct ASTImporterDelegate : public clang::ASTImporter {
ASTImporterDelegate(ClangASTImporter &master, clang::ASTContext *target_ctx,
clang::ASTContext *source_ctx)
: clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
master.m_file_manager, true /*minimal*/),
- m_decls_to_deport(nullptr), m_decls_already_deported(nullptr),
- m_master(master), m_source_ctx(source_ctx) {}
+ m_master(master), m_source_ctx(source_ctx) {
+ setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
+ }
/// Scope guard that attaches a CxxModuleHandler to an ASTImporterDelegate
/// and deattaches it at the end of the scope. Supports being used multiple
@@ -285,43 +293,32 @@ private:
}
};
- protected:
- llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
-
- public:
- // A call to "InitDeportWorkQueues" puts the delegate into deport mode.
- // In deport mode, every copied Decl that could require completion is
- // recorded and placed into the decls_to_deport set.
- //
- // A call to "ExecuteDeportWorkQueues" completes all the Decls that
- // are in decls_to_deport, adding any Decls it sees along the way that it
- // hasn't already deported. It proceeds until decls_to_deport is empty.
- //
- // These calls must be paired. Leaving a delegate in deport mode or trying
- // to start deport delegate with a new pair of queues will result in an
- // assertion failure.
-
- void
- InitDeportWorkQueues(std::set<clang::NamedDecl *> *decls_to_deport,
- std::set<clang::NamedDecl *> *decls_already_deported);
- void ExecuteDeportWorkQueues();
-
void ImportDefinitionTo(clang::Decl *to, clang::Decl *from);
void Imported(clang::Decl *from, clang::Decl *to) override;
clang::Decl *GetOriginalDecl(clang::Decl *To) override;
+ void SetImportListener(NewDeclListener *listener) {
+ assert(m_new_decl_listener == nullptr && "Already attached a listener?");
+ m_new_decl_listener = listener;
+ }
+ void RemoveImportListener() { m_new_decl_listener = nullptr; }
+
+ protected:
+ llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
+
+ private:
/// Decls we should ignore when mapping decls back to their original
/// ASTContext. Used by the CxxModuleHandler to mark declarations that
/// were created from the 'std' C++ module to prevent that the Importer
/// tries to sync them with the broken equivalent in the debug info AST.
std::set<clang::Decl *> m_decls_to_ignore;
- std::set<clang::NamedDecl *> *m_decls_to_deport;
- std::set<clang::NamedDecl *> *m_decls_already_deported;
ClangASTImporter &m_master;
clang::ASTContext *m_source_ctx;
CxxModuleHandler *m_std_handler = nullptr;
+ /// The currently attached listener.
+ NewDeclListener *m_new_decl_listener = nullptr;
};
typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP;
@@ -387,6 +384,7 @@ private:
}
}
+public:
DeclOrigin GetDeclOrigin(const clang::Decl *decl);
clang::FileManager m_file_manager;
diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h
index c3ba2e2176e7..d132c367b999 100644
--- a/include/lldb/Symbol/CompileUnit.h
+++ b/include/lldb/Symbol/CompileUnit.h
@@ -225,6 +225,14 @@ public:
DebugMacros *GetDebugMacros();
+ /// Apply a lambda to each external lldb::Module referenced by this
+ /// compilation unit. Recursively also descends into the referenced external
+ /// modules of any encountered compilation unit.
+ ///
+ /// \param[in] lambda
+ /// The lambda that should be applied to every module.
+ void ForEachExternalModule(llvm::function_ref<void(lldb::ModuleSP)> f);
+
/// Get the compile unit's support file list.
///
/// The support file list is used by the line table, and any objects that
@@ -298,6 +306,8 @@ public:
/// A line table object pointer that this object now owns.
void SetLineTable(LineTable *line_table);
+ void SetSupportFiles(const FileSpecList &support_files);
+
void SetDebugMacros(const DebugMacrosSP &debug_macros);
/// Set accessor for the variable list.
diff --git a/include/lldb/Symbol/CompilerType.h b/include/lldb/Symbol/CompilerType.h
index 98d916597f42..bb9881c0bae3 100644
--- a/include/lldb/Symbol/CompilerType.h
+++ b/include/lldb/Symbol/CompilerType.h
@@ -13,7 +13,6 @@
#include <string>
#include <vector>
-#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -32,7 +31,6 @@ class CompilerType {
public:
// Constructors and Destructors
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
- CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type);
CompilerType(const CompilerType &rhs)
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
@@ -169,8 +167,6 @@ public:
void SetCompilerType(TypeSystem *type_system,
lldb::opaque_compiler_type_t type);
- void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type);
-
unsigned GetTypeQualifiers() const;
// Creating related types
@@ -257,7 +253,7 @@ public:
lldb::Format GetFormat() const;
- size_t GetTypeBitAlign() const;
+ llvm::Optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
uint32_t GetNumChildren(bool omit_empty_base_classes,
const ExecutionContext *exe_ctx) const;
@@ -336,13 +332,6 @@ public:
bool IsMeaninglessWithoutDynamicResolution() const;
- // Pointers & References
-
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- size_t ConvertStringToFloatValue(const char *s, uint8_t *dst,
- size_t dst_size) const;
-
// Dumping types
#ifndef NDEBUG
diff --git a/include/lldb/Symbol/DeclVendor.h b/include/lldb/Symbol/DeclVendor.h
index 9c10fe1177fb..748c0c8ac961 100644
--- a/include/lldb/Symbol/DeclVendor.h
+++ b/include/lldb/Symbol/DeclVendor.h
@@ -9,11 +9,8 @@
#ifndef liblldb_DeclVendor_h_
#define liblldb_DeclVendor_h_
-#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-defines.h"
-#include "clang/AST/ExternalASTMerger.h"
-
#include <vector>
namespace lldb_private {
@@ -22,11 +19,19 @@ namespace lldb_private {
// declarations that are not necessarily backed by a specific symbol file.
class DeclVendor {
public:
+ enum DeclVendorKind {
+ eClangDeclVendor,
+ eClangModuleDeclVendor,
+ eAppleObjCDeclVendor,
+ eLastClangDeclVendor,
+ };
// Constructors and Destructors
- DeclVendor() {}
+ DeclVendor(DeclVendorKind kind) : m_kind(kind) {}
virtual ~DeclVendor() {}
+ DeclVendorKind GetKind() const { return m_kind; }
+
/// Look up the set of Decls that the DeclVendor currently knows about
/// matching a given name.
///
@@ -45,7 +50,7 @@ public:
/// max_matches.
virtual uint32_t FindDecls(ConstString name, bool append,
uint32_t max_matches,
- std::vector<clang::NamedDecl *> &decls) = 0;
+ std::vector<CompilerDecl> &decls) = 0;
/// Look up the types that the DeclVendor currently knows about matching a
/// given name.
@@ -60,16 +65,11 @@ public:
/// The vector of CompilerTypes that was found.
std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);
- /// Interface for ExternalASTMerger. Returns an ImporterSource
- /// allowing type completion.
- ///
- /// \return
- /// An ImporterSource for this DeclVendor.
- virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
-
private:
// For DeclVendor only
DISALLOW_COPY_AND_ASSIGN(DeclVendor);
+
+ const DeclVendorKind m_kind;
};
} // namespace lldb_private
diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h
index cc767d4e1e82..c49f6b0fa942 100644
--- a/include/lldb/Symbol/FuncUnwinders.h
+++ b/include/lldb/Symbol/FuncUnwinders.h
@@ -76,6 +76,11 @@ public:
lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread);
+ lldb::UnwindPlanSP GetObjectFileUnwindPlan(Target &target);
+
+ lldb::UnwindPlanSP GetObjectFileAugmentedUnwindPlan(Target &target,
+ Thread &thread);
+
lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target);
lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target,
@@ -113,10 +118,12 @@ private:
std::recursive_mutex m_mutex;
lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
+ lldb::UnwindPlanSP m_unwind_plan_object_file_sp;
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
lldb::UnwindPlanSP m_unwind_plan_debug_frame_sp;
// augmented by assembly inspection so it's valid everywhere
+ lldb::UnwindPlanSP m_unwind_plan_object_file_augmented_sp;
lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp;
lldb::UnwindPlanSP m_unwind_plan_debug_frame_augmented_sp;
@@ -130,7 +137,9 @@ private:
// Fetching the UnwindPlans can be expensive - if we've already attempted to
// get one & failed, don't try again.
bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1,
+ m_tried_unwind_plan_object_file : 1,
m_tried_unwind_plan_debug_frame : 1,
+ m_tried_unwind_plan_object_file_augmented : 1,
m_tried_unwind_plan_eh_frame_augmented : 1,
m_tried_unwind_plan_debug_frame_augmented : 1,
m_tried_unwind_plan_compact_unwind : 1,
diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h
index f68a16705d93..1b23a99373ca 100644
--- a/include/lldb/Symbol/Function.h
+++ b/include/lldb/Symbol/Function.h
@@ -140,7 +140,7 @@ public:
/// \param[in] call_decl_ptr
/// Optional calling location declaration information that
/// describes from where this inlined function was called.
- InlineFunctionInfo(const char *name, const char *mangled,
+ InlineFunctionInfo(const char *name, llvm::StringRef mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr);
@@ -246,10 +246,22 @@ private:
class Function;
+/// \class CallSiteParameter Function.h "lldb/Symbol/Function.h"
+///
+/// Represent the locations of a parameter at a call site, both in the caller
+/// and in the callee.
+struct CallSiteParameter {
+ DWARFExpression LocationInCallee;
+ DWARFExpression LocationInCaller;
+};
+
+/// A vector of \c CallSiteParameter.
+using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>;
+
/// \class CallEdge Function.h "lldb/Symbol/Function.h"
///
/// Represent a call made within a Function. This can be used to find a path
-/// in the call graph between two functions.
+/// in the call graph between two functions, or to evaluate DW_OP_entry_value.
class CallEdge {
public:
/// Construct a call edge using a symbol name to identify the calling
@@ -259,7 +271,8 @@ public:
/// TODO: A symbol name may not be globally unique. To disambiguate ODR
/// conflicts, it's necessary to determine the \c Target a call edge is
/// associated with before resolving it.
- CallEdge(const char *symbol_name, lldb::addr_t return_pc);
+ CallEdge(const char *symbol_name, lldb::addr_t return_pc,
+ CallSiteParameterArray parameters);
CallEdge(CallEdge &&) = default;
CallEdge &operator=(CallEdge &&) = default;
@@ -279,6 +292,9 @@ public:
/// offset.
lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; }
+ /// Get the call site parameters available at this call edge.
+ llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const;
+
private:
void ParseSymbolFileAndResolve(ModuleList &images);
@@ -294,6 +310,8 @@ private:
/// gives the return PC for the call.
lldb::addr_t return_pc;
+ CallSiteParameterArray parameters;
+
/// Whether or not an attempt was made to find the callee's definition.
bool resolved;
@@ -402,6 +420,11 @@ public:
/// return None.
llvm::MutableArrayRef<CallEdge> GetTailCallingEdges();
+ /// Get the outgoing call edge from this function which has the given return
+ /// address \p return_pc, or return nullptr. Note that this will not return a
+ /// tail-calling edge.
+ CallEdge *GetCallEdgeForReturnAddress(lldb::addr_t return_pc, Target &target);
+
/// Get accessor for the block list.
///
/// \return
@@ -564,6 +587,8 @@ protected:
uint32_t
m_prologue_byte_size; ///< Compute the prologue size once and cache it
+ // TODO: Use a layer of indirection to point to call edges, to save space
+ // when call info hasn't been parsed.
bool m_call_edges_resolved = false; ///< Whether call site info has been
/// parsed.
std::vector<CallEdge> m_call_edges; ///< Outgoing call edges.
diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h
index 84683e3f2a3f..4d04f23a8286 100644
--- a/include/lldb/Symbol/ObjectFile.h
+++ b/include/lldb/Symbol/ObjectFile.h
@@ -63,16 +63,22 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
public:
enum Type {
eTypeInvalid = 0,
- eTypeCoreFile, /// A core file that has a checkpoint of a program's
- /// execution state
- eTypeExecutable, /// A normal executable
- eTypeDebugInfo, /// An object file that contains only debug information
- eTypeDynamicLinker, /// The platform's dynamic linker executable
- eTypeObjectFile, /// An intermediate object file
- eTypeSharedLibrary, /// A shared library that can be used during execution
- eTypeStubLibrary, /// A library that can be linked against but not used for
- /// execution
- eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
+ /// A core file that has a checkpoint of a program's execution state.
+ eTypeCoreFile,
+ /// A normal executable.
+ eTypeExecutable,
+ /// An object file that contains only debug information.
+ eTypeDebugInfo,
+ /// The platform's dynamic linker executable.
+ eTypeDynamicLinker,
+ /// An intermediate object file.
+ eTypeObjectFile,
+ /// A shared library that can be used during execution.
+ eTypeSharedLibrary,
+ /// A library that can be linked against but not used for execution.
+ eTypeStubLibrary,
+ /// JIT code that has symbols, sections and possibly debug info.
+ eTypeJIT,
eTypeUnknown
};
@@ -201,9 +207,13 @@ public:
/// \b false otherwise and \a archive_file and \a archive_object
/// are guaranteed to be remain unchanged.
static bool SplitArchivePathWithObject(
- const char *path_with_object, lldb_private::FileSpec &archive_file,
+ llvm::StringRef path_with_object, lldb_private::FileSpec &archive_file,
lldb_private::ConstString &archive_object, bool must_exist);
+ // LLVM RTTI support
+ static char ID;
+ virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
+
/// Gets the address size in bytes for the current object file.
///
/// \return
@@ -366,17 +376,6 @@ public:
/// returned.
virtual UUID GetUUID() = 0;
- /// Gets the symbol file spec list for this object file.
- ///
- /// If the object file format contains a debug symbol file link, the values
- /// will be returned in the FileSpecList.
- ///
- /// \return
- /// Returns filespeclist.
- virtual lldb_private::FileSpecList GetDebugSymbolFilePaths() {
- return FileSpecList();
- }
-
/// Gets the file spec list of libraries re-exported by this object file.
///
/// If the object file format has the notion of one library re-exporting the
@@ -657,6 +656,9 @@ public:
/// \return
virtual std::vector<LoadableData> GetLoadableData(Target &target);
+ /// Creates a plugin-specific call frame info
+ virtual std::unique_ptr<CallFrameInfo> CreateCallFrameInfo();
+
protected:
// Member variables.
FileSpec m_file;
diff --git a/include/lldb/Symbol/PostfixExpression.h b/include/lldb/Symbol/PostfixExpression.h
index e3a8587a5f84..fa7793315899 100644
--- a/include/lldb/Symbol/PostfixExpression.h
+++ b/include/lldb/Symbol/PostfixExpression.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
+#include <vector>
namespace lldb_private {
@@ -211,7 +212,10 @@ inline T *MakeNode(llvm::BumpPtrAllocator &alloc, Args &&... args) {
/// Parse the given postfix expression. The parsed nodes are placed into the
/// provided allocator.
-Node *Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
+Node *ParseOneExpression(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
+
+std::vector<std::pair<llvm::StringRef, Node *>>
+ParseFPOProgram(llvm::StringRef prog, llvm::BumpPtrAllocator &alloc);
/// Serialize the given expression tree as DWARF. The result is written into the
/// given stream. The AST should not contain any SymbolNodes. If the expression
diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h
index 1cbc2f5492f4..b7f179d1449b 100644
--- a/include/lldb/Symbol/Symbol.h
+++ b/include/lldb/Symbol/Symbol.h
@@ -24,9 +24,8 @@ public:
// drastically different meanings and sorting requirements.
Symbol();
- Symbol(uint32_t symID, const char *name, bool name_is_mangled,
- lldb::SymbolType type, bool external, bool is_debug,
- bool is_trampoline, bool is_artificial,
+ Symbol(uint32_t symID, llvm::StringRef name, lldb::SymbolType type,
+ bool external, bool is_debug, bool is_trampoline, bool is_artificial,
const lldb::SectionSP &section_sp, lldb::addr_t value,
lldb::addr_t size, bool size_is_valid,
bool contains_linker_annotations, uint32_t flags);
diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h
index 55a345489358..76ec1a7de68e 100644
--- a/include/lldb/Symbol/SymbolContext.h
+++ b/include/lldb/Symbol/SymbolContext.h
@@ -470,6 +470,8 @@ public:
/// Returns the number of symbol context objects in the list.
uint32_t GetSize() const;
+ bool IsEmpty() const;
+
uint32_t NumLineEntriesWithLine(uint32_t line) const;
void GetDescription(Stream *s, lldb::DescriptionLevel level,
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;
diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h
index c4015ff03492..96c6ea5c7332 100644
--- a/include/lldb/Symbol/SymbolVendor.h
+++ b/include/lldb/Symbol/SymbolVendor.h
@@ -14,7 +14,6 @@
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/SourceModule.h"
-#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/DenseSet.h"
@@ -40,123 +39,16 @@ public:
void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
- virtual void Dump(Stream *s);
-
- virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit);
-
- virtual size_t ParseFunctions(CompileUnit &comp_unit);
-
- virtual bool ParseLineTable(CompileUnit &comp_unit);
-
- virtual bool ParseDebugMacros(CompileUnit &comp_unit);
-
- virtual bool ParseSupportFiles(CompileUnit &comp_unit,
- FileSpecList &support_files);
-
- virtual bool ParseIsOptimized(CompileUnit &comp_unit);
-
- virtual size_t ParseTypes(CompileUnit &comp_unit);
-
- virtual bool
- ParseImportedModules(const SymbolContext &sc,
- std::vector<SourceModule> &imported_modules);
-
- virtual size_t ParseBlocksRecursive(Function &func);
-
- virtual size_t ParseVariablesForContext(const SymbolContext &sc);
-
- virtual Type *ResolveTypeUID(lldb::user_id_t type_uid);
-
- virtual uint32_t ResolveSymbolContext(const Address &so_addr,
- lldb::SymbolContextItem resolve_scope,
- SymbolContext &sc);
-
- virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
- uint32_t line, bool check_inlines,
- lldb::SymbolContextItem resolve_scope,
- SymbolContextList &sc_list);
-
- virtual size_t FindGlobalVariables(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- size_t max_matches,
- VariableList &variables);
-
- virtual size_t FindGlobalVariables(const RegularExpression &regex,
- size_t max_matches,
- VariableList &variables);
-
- virtual size_t FindFunctions(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
- lldb::FunctionNameType name_type_mask,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
-
- virtual size_t FindFunctions(const RegularExpression &regex,
- bool include_inlines, bool append,
- SymbolContextList &sc_list);
-
- virtual size_t
- FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
- bool append, size_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);
-
- virtual CompilerDeclContext
- FindNamespace(ConstString name,
- const CompilerDeclContext *parent_decl_ctx);
-
- virtual size_t GetNumCompileUnits();
-
- virtual bool SetCompileUnitAtIndex(size_t cu_idx,
- const lldb::CompUnitSP &cu_sp);
-
- virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
-
- TypeList &GetTypeList() { return m_type_list; }
-
- const TypeList &GetTypeList() const { return m_type_list; }
-
- virtual size_t GetTypes(SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask, TypeList &type_list);
-
SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
- FileSpec GetMainFileSpec() const;
-
- // Get module unified section list symbol table.
- virtual Symtab *GetSymtab();
-
- // Clear module unified section list symbol table.
- virtual void ClearSymtab();
-
- /// Notify the SymbolVendor that the file addresses in the Sections
- /// for this module have been changed.
- virtual void SectionFileAddressesChanged();
-
// PluginInterface protocol
ConstString GetPluginName() override;
uint32_t GetPluginVersion() override;
protected:
- // Classes that inherit from SymbolVendor can see and modify these
- typedef std::vector<lldb::CompUnitSP> CompileUnits;
- typedef CompileUnits::iterator CompileUnitIter;
- typedef CompileUnits::const_iterator CompileUnitConstIter;
-
- TypeList m_type_list; // Uniqued types for all parsers owned by this module
- CompileUnits m_compile_units; // The current compile units
- 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)
std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses
// can add more of these if needed.
- Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of
- // the symbol file each time when it is needed
private:
// For SymbolVendor only
diff --git a/include/lldb/Symbol/Symtab.h b/include/lldb/Symbol/Symtab.h
index 868edcdc9290..99d15771ccc5 100644
--- a/include/lldb/Symbol/Symtab.h
+++ b/include/lldb/Symbol/Symtab.h
@@ -92,15 +92,15 @@ public:
const RegularExpression &regex, lldb::SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &indexes);
- size_t FindAllSymbolsWithNameAndType(ConstString name,
- lldb::SymbolType symbol_type,
- std::vector<uint32_t> &symbol_indexes);
- size_t FindAllSymbolsWithNameAndType(ConstString name,
- lldb::SymbolType symbol_type,
- Debug symbol_debug_type,
- Visibility symbol_visibility,
- std::vector<uint32_t> &symbol_indexes);
- size_t FindAllSymbolsMatchingRexExAndType(
+ void FindAllSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &symbol_indexes);
+ void FindAllSymbolsWithNameAndType(ConstString name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &symbol_indexes);
+ void FindAllSymbolsMatchingRexExAndType(
const RegularExpression &regex, lldb::SymbolType symbol_type,
Debug symbol_debug_type, Visibility symbol_visibility,
std::vector<uint32_t> &symbol_indexes);
@@ -112,8 +112,8 @@ public:
Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
void ForEachSymbolContainingFileAddress(
lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
- size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
- SymbolContextList &sc_list);
+ void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
+ SymbolContextList &sc_list);
void CalculateSymbolSizes();
void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h
index efc9bf049a35..446e043a95ee 100644
--- a/include/lldb/Symbol/Type.h
+++ b/include/lldb/Symbol/Type.h
@@ -9,7 +9,6 @@
#ifndef liblldb_Type_h_
#define liblldb_Type_h_
-#include "lldb/Core/ClangForward.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Declaration.h"
@@ -22,22 +21,28 @@
#include <set>
namespace lldb_private {
-// CompilerContext allows an array of these items to be passed to perform
-// detailed lookups in SymbolVendor and SymbolFile functions.
+
+/// CompilerContext allows an array of these items to be passed to perform
+/// detailed lookups in SymbolVendor and SymbolFile functions.
struct CompilerContext {
- CompilerContext(CompilerContextKind t, ConstString n)
- : type(t), name(n) {}
+ CompilerContext(CompilerContextKind t, ConstString n) : kind(t), name(n) {}
bool operator==(const CompilerContext &rhs) const {
- return type == rhs.type && name == rhs.name;
+ return kind == rhs.kind && name == rhs.name;
}
+ bool operator!=(const CompilerContext &rhs) const { return !(*this == rhs); }
void Dump() const;
- CompilerContextKind type;
+ CompilerContextKind kind;
ConstString name;
};
+/// Match \p context_chain against \p pattern, which may contain "Any"
+/// kinds. The \p context_chain should *not* contain any "Any" kinds.
+bool contextMatches(llvm::ArrayRef<CompilerContext> context_chain,
+ llvm::ArrayRef<CompilerContext> pattern);
+
class SymbolFileType : public std::enable_shared_from_this<SymbolFileType>,
public UserID {
public:
@@ -117,8 +122,6 @@ public:
SymbolFile *GetSymbolFile() { return m_symbol_file; }
const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
- TypeList *GetTypeList();
-
ConstString GetName();
llvm::Optional<uint64_t> GetByteSize();
diff --git a/include/lldb/Symbol/TypeList.h b/include/lldb/Symbol/TypeList.h
index 982f673fff6e..38342b6d6f4f 100644
--- a/include/lldb/Symbol/TypeList.h
+++ b/include/lldb/Symbol/TypeList.h
@@ -28,15 +28,14 @@ public:
void Dump(Stream *s, bool show_context);
- // lldb::TypeSP
- // FindType(lldb::user_id_t uid);
-
TypeList FindTypes(ConstString name);
void Insert(const lldb::TypeSP &type);
uint32_t GetSize() const;
+ bool Empty() const { return !GetSize(); }
+
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
typedef std::vector<lldb::TypeSP> collection;
diff --git a/include/lldb/Symbol/TypeSystem.h b/include/lldb/Symbol/TypeSystem.h
index 4bef2a4446eb..07295c244a5d 100644
--- a/include/lldb/Symbol/TypeSystem.h
+++ b/include/lldb/Symbol/TypeSystem.h
@@ -14,8 +14,11 @@
#include <mutex>
#include <string>
+#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/SmallBitVector.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Error.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Expression/Expression.h"
@@ -29,7 +32,24 @@ class PDBASTParser;
namespace lldb_private {
-// Interface for representing the Type Systems in different languages.
+/// A SmallBitVector that represents a set of source languages (\p
+/// lldb::LanguageType). Each lldb::LanguageType is represented by
+/// the bit with the position of its enumerator. The largest
+/// LanguageType is < 64, so this is space-efficient and on 64-bit
+/// architectures a LanguageSet can be completely stack-allocated.
+struct LanguageSet {
+ llvm::SmallBitVector bitvector;
+ LanguageSet();
+
+ /// If the set contains a single language only, return it.
+ llvm::Optional<lldb::LanguageType> GetSingularLanguage();
+ void Insert(lldb::LanguageType language);
+ bool Empty() const;
+ size_t Size() const;
+ bool operator[](unsigned i) const;
+};
+
+/// Interface for representing the Type Systems in different languages.
class TypeSystem : public PluginInterface {
public:
// Intrusive type system that allows us to use llvm casting.
@@ -107,6 +127,8 @@ public:
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx);
+ virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
+
// CompilerDeclContext functions
virtual std::vector<CompilerDecl>
@@ -255,6 +277,8 @@ public:
// Exploring the type
+ virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
+
virtual llvm::Optional<uint64_t>
GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) = 0;
@@ -375,12 +399,6 @@ public:
lldb::offset_t data_offset,
size_t data_byte_size) = 0;
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
- const char *s, uint8_t *dst,
- size_t dst_size) = 0;
-
// TODO: Determine if these methods should move to ClangASTContext.
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
@@ -391,7 +409,9 @@ public:
virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
uint32_t &length) = 0;
- virtual size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) = 0;
+ virtual llvm::Optional<size_t>
+ GetTypeBitAlign(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) = 0;
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0;
@@ -491,18 +511,15 @@ public:
// callback to keep iterating, false to stop iterating.
void ForEach(std::function<bool(TypeSystem *)> const &callback);
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
- Module *module, bool can_create);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language, Module *module,
+ bool can_create);
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
- Target *target, bool can_create);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language, Target *target,
+ bool can_create);
protected:
- // This function does not take the map mutex, and should only be called from
- // functions that do take the mutex.
- void AddToMap(lldb::LanguageType language,
- lldb::TypeSystemSP const &type_system_sp);
-
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
///multi-threaded environments.
diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h
index 2b49acaafa04..fa41ba5d056a 100644
--- a/include/lldb/Symbol/UnwindPlan.h
+++ b/include/lldb/Symbol/UnwindPlan.h
@@ -201,7 +201,8 @@ public:
unspecified, // not specified
isRegisterPlusOffset, // FA = register + offset
isRegisterDereferenced, // FA = [reg]
- isDWARFExpression // FA = eval(dwarf_expr)
+ isDWARFExpression, // FA = eval(dwarf_expr)
+ isRaSearch, // FA = SP + offset + ???
};
FAValue() : m_type(unspecified), m_value() {}
@@ -214,6 +215,11 @@ public:
bool IsUnspecified() const { return m_type == unspecified; }
+ void SetRaSearch(int32_t offset) {
+ m_type = isRaSearch;
+ m_value.ra_search_offset = offset;
+ }
+
bool IsRegisterPlusOffset() const {
return m_type == isRegisterPlusOffset;
}
@@ -250,9 +256,14 @@ public:
ValueType GetValueType() const { return m_type; }
int32_t GetOffset() const {
- if (m_type == isRegisterPlusOffset)
- return m_value.reg.offset;
- return 0;
+ switch (m_type) {
+ case isRegisterPlusOffset:
+ return m_value.reg.offset;
+ case isRaSearch:
+ return m_value.ra_search_offset;
+ default:
+ return 0;
+ }
}
void IncOffset(int32_t delta) {
@@ -304,6 +315,8 @@ public:
const uint8_t *opcodes;
uint16_t length;
} expr;
+ // For m_type == isRaSearch
+ int32_t ra_search_offset;
} m_value;
}; // class FAValue
@@ -370,6 +383,7 @@ public:
m_return_addr_register(LLDB_INVALID_REGNUM), m_source_name(),
m_plan_is_sourced_from_compiler(eLazyBoolCalculate),
m_plan_is_valid_at_all_instruction_locations(eLazyBoolCalculate),
+ m_plan_is_for_signal_trap(eLazyBoolCalculate),
m_lsda_address(), m_personality_func_addr() {}
// Performs a deep copy of the plan, including all the rows (expensive).
@@ -463,6 +477,17 @@ public:
m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn;
}
+ // Is this UnwindPlan for a signal trap frame? If so, then its saved pc
+ // may have been set manually by the signal dispatch code and therefore
+ // not follow a call to the child frame.
+ lldb_private::LazyBool GetUnwindPlanForSignalTrap() const {
+ return m_plan_is_for_signal_trap;
+ }
+
+ void SetUnwindPlanForSignalTrap(lldb_private::LazyBool is_for_signal_trap) {
+ m_plan_is_for_signal_trap = is_for_signal_trap;
+ }
+
int GetRowCount() const;
void Clear() {
@@ -472,6 +497,7 @@ public:
m_source_name.Clear();
m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
+ m_plan_is_for_signal_trap = eLazyBoolCalculate;
m_lsda_address.Clear();
m_personality_func_addr.Clear();
}
@@ -502,6 +528,7 @@ private:
m_source_name; // for logging, where this UnwindPlan originated from
lldb_private::LazyBool m_plan_is_sourced_from_compiler;
lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations;
+ lldb_private::LazyBool m_plan_is_for_signal_trap;
Address m_lsda_address; // Where the language specific data area exists in the
// module - used
diff --git a/include/lldb/Symbol/UnwindTable.h b/include/lldb/Symbol/UnwindTable.h
index b4d7f0661d5b..c1dc519c4b20 100644
--- a/include/lldb/Symbol/UnwindTable.h
+++ b/include/lldb/Symbol/UnwindTable.h
@@ -27,6 +27,8 @@ public:
~UnwindTable();
+ lldb_private::CallFrameInfo *GetObjectFileUnwindInfo();
+
lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo();
@@ -71,6 +73,7 @@ private:
bool m_initialized; // delay some initialization until ObjectFile is set up
std::mutex m_mutex;
+ std::unique_ptr<CallFrameInfo> m_object_file_unwind_up;
std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up;
std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up;
diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h
index 12daecfc04e6..30f57f1f9110 100644
--- a/include/lldb/Symbol/Variable.h
+++ b/include/lldb/Symbol/Variable.h
@@ -26,15 +26,14 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
public:
typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList;
- // Constructors and Destructors
- Variable(lldb::user_id_t uid, const char *name,
- const char
- *mangled, // The mangled or fully qualified name of the variable.
- const lldb::SymbolFileTypeSP &symfile_type_sp,
- lldb::ValueType scope, SymbolContextScope *owner_scope,
- const RangeList &scope_range, Declaration *decl,
- const DWARFExpression &location, bool external, bool artificial,
- bool static_member = false);
+ /// Constructors and Destructors.
+ ///
+ /// \param mangled The mangled or fully qualified name of the variable.
+ Variable(lldb::user_id_t uid, const char *name, const char *mangled,
+ const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope,
+ SymbolContextScope *owner_scope, const RangeList &scope_range,
+ Declaration *decl, const DWARFExpression &location, bool external,
+ bool artificial, bool static_member = false);
virtual ~Variable();
@@ -50,11 +49,11 @@ public:
SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; }
- // Since a variable can have a basename "i" and also a mangled named
- // "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
- // namespace)::i", this function will allow a generic match function that can
- // be called by commands and expression parsers to make sure we match
- // anything we come across.
+ /// Since a variable can have a basename "i" and also a mangled named
+ /// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
+ /// namespace)::i", this function will allow a generic match function that can
+ /// be called by commands and expression parsers to make sure we match
+ /// anything we come across.
bool NameMatches(ConstString name) const;
bool NameMatches(const RegularExpression &regex) const;
@@ -99,34 +98,42 @@ public:
GetVariableCallback callback, void *baton, VariableList &variable_list,
ValueObjectList &valobj_list);
- static size_t AutoComplete(const ExecutionContext &exe_ctx,
- CompletionRequest &request);
+ static void AutoComplete(const ExecutionContext &exe_ctx,
+ CompletionRequest &request);
CompilerDeclContext GetDeclContext();
CompilerDecl GetDecl();
protected:
- ConstString m_name; // The basename of the variable (no namespaces)
- Mangled m_mangled; // The mangled name of the variable
- lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable
- // (int, struct, class, etc)
- lldb::ValueType m_scope; // global, parameter, local
- SymbolContextScope
- *m_owner_scope; // The symbol file scope that this variable was defined in
- RangeList m_scope_range; // The list of ranges inside the owner's scope where
- // this variable is valid
- Declaration m_declaration; // Declaration location for this item.
- DWARFExpression m_location; // The location of this variable that can be fed
- // to DWARFExpression::Evaluate()
- uint8_t m_external : 1, // Visible outside the containing compile unit?
- m_artificial : 1, // Non-zero if the variable is not explicitly declared
- // in source
- m_loc_is_const_data : 1, // The m_location expression contains the
- // constant variable value data, not a DWARF
- // location
- m_static_member : 1; // Non-zero if variable is static member of a class
- // or struct.
+ /// The basename of the variable (no namespaces).
+ ConstString m_name;
+ /// The mangled name of the variable.
+ Mangled m_mangled;
+ /// The type pointer of the variable (int, struct, class, etc)
+ /// global, parameter, local.
+ lldb::SymbolFileTypeSP m_symfile_type_sp;
+ lldb::ValueType m_scope;
+ /// The symbol file scope that this variable was defined in
+ SymbolContextScope *m_owner_scope;
+ /// The list of ranges inside the owner's scope where this variable
+ /// is valid.
+ RangeList m_scope_range;
+ /// Declaration location for this item.
+ Declaration m_declaration;
+ /// The location of this variable that can be fed to
+ /// DWARFExpression::Evaluate().
+ DWARFExpression m_location;
+ /// Visible outside the containing compile unit?
+ unsigned m_external : 1;
+ /// Non-zero if the variable is not explicitly declared in source.
+ unsigned m_artificial : 1;
+ /// The m_location expression contains the constant variable value
+ /// data, not a DWARF location.
+ unsigned m_loc_is_const_data : 1;
+ /// Non-zero if variable is static member of a class or struct.
+ unsigned m_static_member : 1;
+
private:
Variable(const Variable &rhs) = delete;
Variable &operator=(const Variable &rhs) = delete;
diff --git a/include/lldb/Symbol/VerifyDecl.h b/include/lldb/Symbol/VerifyDecl.h
deleted file mode 100644
index f412b94a7859..000000000000
--- a/include/lldb/Symbol/VerifyDecl.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- VerifyDecl.h --------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef lldb_VariableList_h_
-#define lldb_VariableList_h_
-
-#include "lldb/Core/ClangForward.h"
-
-namespace lldb_private {
-void VerifyDecl(clang::Decl *decl);
-}
-
-#endif