diff --git a/lldb/include/lldb/Expression/IRExecutionUnit.h b/lldb/include/lldb/Expression/IRExecutionUnit.h --- a/lldb/include/lldb/Expression/IRExecutionUnit.h +++ b/lldb/include/lldb/Expression/IRExecutionUnit.h @@ -18,7 +18,7 @@ #include "llvm/IR/Module.h" #include "lldb/Expression/IRMemoryMap.h" -#include "lldb/Symbol/ObjectFile.h" +#include "lldb/Expression/ObjectFileJIT.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/lldb-forward.h" diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h b/lldb/include/lldb/Expression/ObjectFileJIT.h rename from lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h rename to lldb/include/lldb/Expression/ObjectFileJIT.h --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h +++ b/lldb/include/lldb/Expression/ObjectFileJIT.h @@ -6,15 +6,31 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H -#define LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H +#ifndef LLDB_EXPRESSION_OBJECTFILEJIT_H +#define LLDB_EXPRESSION_OBJECTFILEJIT_H #include "lldb/Core/Address.h" +#include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Symbol/Symtab.h" +#include "lldb/Utility/ArchSpec.h" -// This class needs to be hidden as eventually belongs in a plugin that -// will export the ObjectFile protocol -class ObjectFileJIT : public lldb_private::ObjectFile { +namespace lldb_private { + +class ObjectFileJITDelegate { +public: + ObjectFileJITDelegate() = default; + virtual ~ObjectFileJITDelegate() = default; + virtual lldb::ByteOrder GetByteOrder() const = 0; + virtual uint32_t GetAddressByteSize() const = 0; + virtual void PopulateSymtab(lldb_private::ObjectFile *obj_file, + lldb_private::Symtab &symtab) = 0; + virtual void PopulateSectionList(lldb_private::ObjectFile *obj_file, + lldb_private::SectionList §ion_list) = 0; + virtual ArchSpec GetArchitecture() = 0; +}; + +class ObjectFileJIT : public ObjectFile { public: ObjectFileJIT(const lldb::ModuleSP &module_sp, const lldb::ObjectFileJITDelegateSP &delegate_sp); @@ -85,9 +101,8 @@ lldb::offset_t section_offset, void *dst, size_t dst_len) override; - size_t - ReadSectionData(lldb_private::Section *section, - lldb_private::DataExtractor §ion_data) override; + size_t ReadSectionData(lldb_private::Section *section, + lldb_private::DataExtractor §ion_data) override; lldb_private::Address GetEntryPointAddress() override; @@ -103,5 +118,6 @@ protected: lldb::ObjectFileJITDelegateWP m_delegate_wp; }; +} // namespace lldb_private -#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H +#endif // LLDB_EXPRESSION_OBJECTFILEJIT_H diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -25,25 +25,6 @@ namespace lldb_private { -class ObjectFileJITDelegate { -public: - ObjectFileJITDelegate() = default; - - virtual ~ObjectFileJITDelegate() = default; - - virtual lldb::ByteOrder GetByteOrder() const = 0; - - virtual uint32_t GetAddressByteSize() const = 0; - - virtual void PopulateSymtab(lldb_private::ObjectFile *obj_file, - lldb_private::Symtab &symtab) = 0; - - virtual void PopulateSectionList(lldb_private::ObjectFile *obj_file, - lldb_private::SectionList §ion_list) = 0; - - virtual ArchSpec GetArchitecture() = 0; -}; - /// \class ObjectFile ObjectFile.h "lldb/Symbol/ObjectFile.h" /// A plug-in interface definition class for object file parsers. /// diff --git a/lldb/source/Expression/CMakeLists.txt b/lldb/source/Expression/CMakeLists.txt --- a/lldb/source/Expression/CMakeLists.txt +++ b/lldb/source/Expression/CMakeLists.txt @@ -1,5 +1,5 @@ # TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbExpression -add_lldb_library(lldbExpression +add_lldb_library(lldbExpression NO_PLUGIN_DEPENDENCIES DiagnosticManager.cpp DWARFExpression.cpp DWARFExpressionList.cpp @@ -11,6 +11,7 @@ IRMemoryMap.cpp LLVMUserExpression.cpp Materializer.cpp + ObjectFileJIT.cpp REPL.cpp UserExpression.cpp UtilityFunction.cpp @@ -25,7 +26,6 @@ lldbSymbol lldbTarget lldbUtility - lldbPluginObjectFileJIT LINK_COMPONENTS Core diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -21,6 +21,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" #include "lldb/Expression/IRExecutionUnit.h" +#include "lldb/Expression/ObjectFileJIT.h" #include "lldb/Host/HostInfo.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/SymbolContext.h" @@ -36,7 +37,6 @@ #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" -#include "lldb/../../source/Plugins/ObjectFile/JIT/ObjectFileJIT.h" #include using namespace lldb_private; diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Expression/ObjectFileJIT.cpp rename from lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp rename to lldb/source/Expression/ObjectFileJIT.cpp --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Expression/ObjectFileJIT.cpp @@ -8,17 +8,12 @@ #include "llvm/ADT/StringRef.h" -#include "ObjectFileJIT.h" -#include "lldb/Core/Debugger.h" #include "lldb/Core/FileSpecList.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" -#include "lldb/Core/StreamFile.h" -#include "lldb/Host/Host.h" -#include "lldb/Symbol/ObjectFile.h" -#include "lldb/Target/Platform.h" +#include "lldb/Expression/ObjectFileJIT.h" #include "lldb/Target/Process.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" @@ -27,8 +22,6 @@ #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/RangeMap.h" -#include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "lldb/Utility/UUID.h" @@ -39,8 +32,6 @@ using namespace lldb; using namespace lldb_private; -LLDB_PLUGIN_DEFINE(ObjectFileJIT) - char ObjectFileJIT::ID; void ObjectFileJIT::Initialize() { @@ -217,9 +208,9 @@ return 0; } -size_t ObjectFileJIT::ReadSectionData( - lldb_private::Section *section, - lldb_private::DataExtractor §ion_data) { +size_t +ObjectFileJIT::ReadSectionData(lldb_private::Section *section, + lldb_private::DataExtractor §ion_data) { if (section->GetFileSize()) { const void *src = (void *)(uintptr_t)section->GetFileOffset(); diff --git a/lldb/source/Plugins/ObjectFile/CMakeLists.txt b/lldb/source/Plugins/ObjectFile/CMakeLists.txt --- a/lldb/source/Plugins/ObjectFile/CMakeLists.txt +++ b/lldb/source/Plugins/ObjectFile/CMakeLists.txt @@ -1,6 +1,5 @@ add_subdirectory(Breakpad) add_subdirectory(ELF) -add_subdirectory(JIT) add_subdirectory(JSON) add_subdirectory(Mach-O) add_subdirectory(Minidump) diff --git a/lldb/source/Plugins/ObjectFile/JIT/CMakeLists.txt b/lldb/source/Plugins/ObjectFile/JIT/CMakeLists.txt deleted file mode 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -add_lldb_library(lldbPluginObjectFileJIT PLUGIN - ObjectFileJIT.cpp - - LINK_LIBS - lldbCore - lldbHost - lldbSymbol - lldbTarget - LINK_COMPONENTS - Support - )