diff options
Diffstat (limited to 'include/lldb/Expression')
-rw-r--r-- | include/lldb/Expression/ClangExpressionParser.h | 3 | ||||
-rw-r--r-- | include/lldb/Expression/ClangExpressionVariable.h | 5 | ||||
-rw-r--r-- | include/lldb/Expression/ClangFunction.h | 8 | ||||
-rw-r--r-- | include/lldb/Expression/ClangModulesDeclVendor.h | 58 | ||||
-rw-r--r-- | include/lldb/Expression/ClangUserExpression.h | 2 | ||||
-rw-r--r-- | include/lldb/Expression/IRExecutionUnit.h | 159 |
6 files changed, 76 insertions, 159 deletions
diff --git a/include/lldb/Expression/ClangExpressionParser.h b/include/lldb/Expression/ClangExpressionParser.h index c79494d1a521..0f578c55942e 100644 --- a/include/lldb/Expression/ClangExpressionParser.h +++ b/include/lldb/Expression/ClangExpressionParser.h @@ -147,6 +147,9 @@ private: std::unique_ptr<clang::SelectorTable> m_selector_table; ///< Selector table for Objective-C methods std::unique_ptr<clang::ASTContext> m_ast_context; ///< The AST context used to hold types and names for the parser std::unique_ptr<clang::CodeGenerator> m_code_generator; ///< The Clang object that generates IR + + class LLDBPreprocessorCallbacks; + LLDBPreprocessorCallbacks *m_pp_callbacks; ///< Called when the preprocessor encounters module imports }; } diff --git a/include/lldb/Expression/ClangExpressionVariable.h b/include/lldb/Expression/ClangExpressionVariable.h index 5ee7a3058946..6c210106d51e 100644 --- a/include/lldb/Expression/ClangExpressionVariable.h +++ b/include/lldb/Expression/ClangExpressionVariable.h @@ -65,6 +65,11 @@ class ClangExpressionVariable public: ClangExpressionVariable(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size); + ClangExpressionVariable (ExecutionContextScope *exe_scope, + Value &value, + const ConstString &name, + uint16_t flags = EVNone); + ClangExpressionVariable(const lldb::ValueObjectSP &valobj_sp); //---------------------------------------------------------------------- diff --git a/include/lldb/Expression/ClangFunction.h b/include/lldb/Expression/ClangFunction.h index 61d56729f93d..c122b21be279 100644 --- a/include/lldb/Expression/ClangFunction.h +++ b/include/lldb/Expression/ClangFunction.h @@ -285,9 +285,9 @@ public: /// True if the thread plan may simply be discarded if an error occurs. /// /// @return - /// A ThreadPlan for executing the function. + /// A ThreadPlan shared pointer for executing the function. //------------------------------------------------------------------ - ThreadPlan * + lldb::ThreadPlanSP GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, lldb::addr_t args_addr, const EvaluateExpressionOptions &options, @@ -411,8 +411,10 @@ private: // For ClangFunction only //------------------------------------------------------------------ - std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function. + // Note: the parser needs to be destructed before the execution unit, so + // declare the the execution unit first. std::shared_ptr<IRExecutionUnit> m_execution_unit_sp; + std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function. lldb::ModuleWP m_jit_module_wp; std::string m_name; ///< The name of this clang function - for debugging purposes. diff --git a/include/lldb/Expression/ClangModulesDeclVendor.h b/include/lldb/Expression/ClangModulesDeclVendor.h new file mode 100644 index 000000000000..a35b86a665ff --- /dev/null +++ b/include/lldb/Expression/ClangModulesDeclVendor.h @@ -0,0 +1,58 @@ +//===-- ClangModulesDeclVendor.h --------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _liblldb_ClangModulesDeclVendor_ +#define _liblldb_ClangModulesDeclVendor_ + +#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/ClangForward.h" +#include "lldb/Symbol/DeclVendor.h" +#include "lldb/Target/Platform.h" + +#include <vector> + +namespace lldb_private +{ + +class ClangModulesDeclVendor : public DeclVendor +{ +public: + //------------------------------------------------------------------ + // Constructors and Destructors + //------------------------------------------------------------------ + ClangModulesDeclVendor(); + + virtual + ~ClangModulesDeclVendor(); + + static ClangModulesDeclVendor * + Create(Target &target); + + //------------------------------------------------------------------ + /// Add a module to the list of modules to search. + /// + /// @param[in] path + /// The path to the exact module to be loaded. E.g., if the desired + /// module is std.io, then this should be { "std", "io" }. + /// + /// @param[in] error_stream + /// A stream to populate with the output of the Clang parser when + /// it tries to load the module. + /// + /// @return + /// True if the module could be loaded; false if not. If the + /// compiler encountered a fatal error during a previous module + /// load, then this will always return false for this ModuleImporter. + //------------------------------------------------------------------ + virtual bool + AddModule(std::vector<llvm::StringRef> &path, Stream &error_stream) = 0; +}; + +} +#endif /* defined(_lldb_ClangModulesDeclVendor_) */ diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/ClangUserExpression.h index 9d2e9093c0bd..f51c9851789a 100644 --- a/include/lldb/Expression/ClangUserExpression.h +++ b/include/lldb/Expression/ClangUserExpression.h @@ -30,8 +30,6 @@ #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/ExecutionContext.h" -#include "llvm/ExecutionEngine/JITMemoryManager.h" - namespace lldb_private { diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index 3f28351a6928..c15c65c92a3b 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -25,7 +25,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/ClangForward.h" #include "lldb/Core/DataBufferHeap.h" -#include "llvm/ExecutionEngine/JITMemoryManager.h" +#include "llvm/ExecutionEngine/SectionMemoryManager.h" #include "lldb/Expression/ClangExpression.h" #include "lldb/Expression/ClangExpressionParser.h" #include "lldb/Expression/IRMemoryMap.h" @@ -56,7 +56,7 @@ class Error; /// then be used as input to the IR interpreter, or the address of the /// executable code can be passed to a thread plan to run in the target. /// -/// This class creates a subclass of LLVM's JITMemoryManager, because that is +/// This class creates a subclass of LLVM's SectionMemoryManager, because that is /// how the JIT emits code. Because LLDB needs to move JIT-compiled code /// into the target process, the IRExecutionUnit knows how to copy the /// emitted code into the target process. @@ -207,101 +207,12 @@ private: DisassembleFunction (Stream &stream, lldb::ProcessSP &process_sp); - class MemoryManager : public llvm::JITMemoryManager + class MemoryManager : public llvm::SectionMemoryManager { public: MemoryManager (IRExecutionUnit &parent); virtual ~MemoryManager(); - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual void setMemoryWritable (); - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual void setMemoryExecutable (); - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual void setPoisonMemory (bool poison) - { - m_default_mm_ap->setPoisonMemory (poison); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual void AllocateGOT() - { - m_default_mm_ap->AllocateGOT(); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual uint8_t *getGOTBase() const - { - return m_default_mm_ap->getGOTBase(); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual uint8_t *startFunctionBody(const llvm::Function *F, - uintptr_t &ActualSize); - - //------------------------------------------------------------------ - /// Allocate room for a dyld stub for a lazy-referenced function, - /// and add it to the m_stubs map - /// - /// @param[in] F - /// The function being referenced. - /// - /// @param[in] StubSize - /// The size of the stub. - /// - /// @param[in] Alignment - /// The required alignment of the stub. - /// - /// @return - /// Allocated space for the stub. - //------------------------------------------------------------------ - virtual uint8_t *allocateStub(const llvm::GlobalValue* F, - unsigned StubSize, - unsigned Alignment); - - //------------------------------------------------------------------ - /// Complete the body of a function, and add it to the m_functions map - /// - /// @param[in] F - /// The function being completed. - /// - /// @param[in] FunctionStart - /// The first instruction of the function. - /// - /// @param[in] FunctionEnd - /// The last byte of the last instruction of the function. - //------------------------------------------------------------------ - virtual void endFunctionBody(const llvm::Function *F, - uint8_t *FunctionStart, - uint8_t *FunctionEnd); - //------------------------------------------------------------------ - /// Allocate space for an unspecified purpose, and add it to the - /// m_spaceBlocks map - /// - /// @param[in] Size - /// The size of the area. - /// - /// @param[in] Alignment - /// The required alignment of the area. - /// - /// @return - /// Allocated space. - //------------------------------------------------------------------ - virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment); //------------------------------------------------------------------ /// Allocate space for executable code, and add it to the @@ -347,22 +258,6 @@ private: bool IsReadOnly); //------------------------------------------------------------------ - /// Allocate space for a global variable, and add it to the - /// m_spaceBlocks map - /// - /// @param[in] Size - /// The size of the variable. - /// - /// @param[in] Alignment - /// The required alignment of the variable. - /// - /// @return - /// Allocated space for the global. - //------------------------------------------------------------------ - virtual uint8_t *allocateGlobal(uintptr_t Size, - unsigned Alignment); - - //------------------------------------------------------------------ /// Called when object loading is complete and section page /// permissions can be applied. Currently unimplemented for LLDB. /// @@ -380,52 +275,8 @@ private: return false; } - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual void deallocateFunctionBody(void *Body); - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual size_t GetDefaultCodeSlabSize() { - return m_default_mm_ap->GetDefaultCodeSlabSize(); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual size_t GetDefaultDataSlabSize() { - return m_default_mm_ap->GetDefaultDataSlabSize(); - } - - virtual size_t GetDefaultStubSlabSize() { - return m_default_mm_ap->GetDefaultStubSlabSize(); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual unsigned GetNumCodeSlabs() { - return m_default_mm_ap->GetNumCodeSlabs(); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual unsigned GetNumDataSlabs() { - return m_default_mm_ap->GetNumDataSlabs(); - } - - //------------------------------------------------------------------ - /// Passthrough interface stub - //------------------------------------------------------------------ - virtual unsigned GetNumStubSlabs() { - return m_default_mm_ap->GetNumStubSlabs(); - } - virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) { - return m_default_mm_ap->registerEHFrames(Addr, LoadAddr, Size); + return; } //------------------------------------------------------------------ @@ -436,7 +287,7 @@ private: return m_default_mm_ap->getPointerToNamedFunction(Name, AbortOnFailure); } private: - std::unique_ptr<JITMemoryManager> m_default_mm_ap; ///< The memory allocator to use in actually creating space. All calls are passed through to it. + std::unique_ptr<SectionMemoryManager> m_default_mm_ap; ///< The memory allocator to use in actually creating space. All calls are passed through to it. IRExecutionUnit &m_parent; ///< The execution unit this is a proxy for. }; |