[lldb] Move ObjectFileJIT to lldbExpression
In the spirit of not having lldbExpression rely on plugins, this move makes the most sense. ObjectFileJIT is not really a "plugin" in the sense that without it, expression evaluation doesn't work at all. This is different than something like ObjectFileELF where lldb can still technically debug non-ELF targets without it. For that reason, moving ObjectFileJIT into Expression where it will be used in conjunction with IRExecutionUnit makes the most sense. Differential Revision: https://reviews.llvm.org/D147084
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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 @@ public:
|
||||
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 @@ public:
|
||||
protected:
|
||||
lldb::ObjectFileJITDelegateWP m_delegate_wp;
|
||||
};
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H
|
||||
#endif // LLDB_EXPRESSION_OBJECTFILEJIT_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.
|
||||
///
|
||||
|
||||
@@ -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 @@ add_lldb_library(lldbExpression
|
||||
IRMemoryMap.cpp
|
||||
LLVMUserExpression.cpp
|
||||
Materializer.cpp
|
||||
ObjectFileJIT.cpp
|
||||
REPL.cpp
|
||||
UserExpression.cpp
|
||||
UtilityFunction.cpp
|
||||
@@ -25,7 +26,6 @@ add_lldb_library(lldbExpression
|
||||
lldbSymbol
|
||||
lldbTarget
|
||||
lldbUtility
|
||||
lldbPluginObjectFileJIT
|
||||
|
||||
LINK_COMPONENTS
|
||||
Core
|
||||
|
||||
@@ -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 <optional>
|
||||
|
||||
using namespace lldb_private;
|
||||
|
||||
@@ -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 @@ size_t ObjectFileJIT::ReadSectionData(lldb_private::Section *section,
|
||||
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();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
add_subdirectory(Breakpad)
|
||||
add_subdirectory(ELF)
|
||||
add_subdirectory(JIT)
|
||||
add_subdirectory(JSON)
|
||||
add_subdirectory(Mach-O)
|
||||
add_subdirectory(Minidump)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
add_lldb_library(lldbPluginObjectFileJIT PLUGIN
|
||||
ObjectFileJIT.cpp
|
||||
|
||||
LINK_LIBS
|
||||
lldbCore
|
||||
lldbHost
|
||||
lldbSymbol
|
||||
lldbTarget
|
||||
LINK_COMPONENTS
|
||||
Support
|
||||
)
|
||||
Reference in New Issue
Block a user