This revision was automatically updated to reflect the committed changes.
Closed by commit rGc69307e5eeb5: [lldb] Prevent object file plugins from
changing the data buffer (authored by JDevlieghere).
Herald added a project: LLDB.
Changed prior to commit:
https://reviews.llvm.org/D122944?vs=420193&id=420209#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122944/new/
https://reviews.llvm.org/D122944
Files:
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
Index: lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
===================================================================
--- lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -30,12 +30,12 @@
}
static ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t length);
static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,
- lldb::DataBufferSP &data_sp,
+ lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr);
Index: lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -88,7 +88,7 @@
}
ObjectFile *
-ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP &data_sp,
+ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP data_sp,
offset_t data_offset, const FileSpec *file,
offset_t file_offset, offset_t length) {
Log *log = GetLog(LLDBLog::Object);
@@ -141,7 +141,7 @@
}
ObjectFile *ObjectFileWasm::CreateMemoryInstance(const ModuleSP &module_sp,
- DataBufferSP &data_sp,
+ DataBufferSP data_sp,
const ProcessSP &process_sp,
addr_t header_addr) {
if (!ValidateModuleHeader(data_sp))
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===================================================================
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -62,12 +62,12 @@
static llvm::StringRef GetPluginDescriptionStatic();
static ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t offset, lldb::offset_t length);
static lldb_private::ObjectFile *CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -77,12 +77,10 @@
"(32 and 64 bit)";
}
-ObjectFile *ObjectFilePECOFF::CreateInstance(const lldb::ModuleSP &module_sp,
- DataBufferSP &data_sp,
- lldb::offset_t data_offset,
- const lldb_private::FileSpec *file_p,
- lldb::offset_t file_offset,
- lldb::offset_t length) {
+ObjectFile *ObjectFilePECOFF::CreateInstance(
+ const lldb::ModuleSP &module_sp, DataBufferSP data_sp,
+ lldb::offset_t data_offset, const lldb_private::FileSpec *file_p,
+ lldb::offset_t file_offset, lldb::offset_t length) {
FileSpec file = file_p ? *file_p : FileSpec();
if (!data_sp) {
data_sp = MapFileData(file, length, file_offset);
@@ -113,7 +111,7 @@
}
ObjectFile *ObjectFilePECOFF::CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) {
if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp))
return nullptr;
Index: lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
===================================================================
--- lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
+++ lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
@@ -31,12 +31,12 @@
loadPDBFile(std::string PdbPath, llvm::BumpPtrAllocator &Allocator);
static ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t length);
static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,
- lldb::DataBufferSP &data_sp,
+ lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr);
Index: lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
+++ lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
@@ -87,7 +87,7 @@
}
ObjectFile *
-ObjectFilePDB::CreateInstance(const ModuleSP &module_sp, DataBufferSP &data_sp,
+ObjectFilePDB::CreateInstance(const ModuleSP &module_sp, DataBufferSP data_sp,
offset_t data_offset, const FileSpec *file,
offset_t file_offset, offset_t length) {
auto objfile_up = std::make_unique<ObjectFilePDB>(
@@ -98,7 +98,7 @@
}
ObjectFile *ObjectFilePDB::CreateMemoryInstance(const ModuleSP &module_sp,
- DataBufferSP &data_sp,
+ DataBufferSP data_sp,
const ProcessSP &process_sp,
addr_t header_addr) {
return nullptr;
Index: lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
===================================================================
--- lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
+++ lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
@@ -38,12 +38,12 @@
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
static lldb_private::ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t offset, lldb::offset_t length);
static lldb_private::ObjectFile *CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
Index: lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
+++ lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
@@ -33,14 +33,14 @@
}
ObjectFile *ObjectFileMinidump::CreateInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t offset, lldb::offset_t length) {
return nullptr;
}
ObjectFile *ObjectFileMinidump::CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, DataBufferSP data_sp,
const ProcessSP &process_sp, lldb::addr_t header_addr) {
return nullptr;
}
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
===================================================================
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -44,12 +44,12 @@
}
static lldb_private::ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t length);
static lldb_private::ObjectFile *CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -817,7 +817,7 @@
}
ObjectFile *ObjectFileMachO::CreateInstance(const lldb::ModuleSP &module_sp,
- DataBufferSP &data_sp,
+ DataBufferSP data_sp,
lldb::offset_t data_offset,
const FileSpec *file,
lldb::offset_t file_offset,
@@ -848,7 +848,7 @@
}
ObjectFile *ObjectFileMachO::CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, DataBufferSP data_sp,
const ProcessSP &process_sp, lldb::addr_t header_addr) {
if (ObjectFileMachO::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) {
std::unique_ptr<ObjectFile> objfile_up(
Index: lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
===================================================================
--- lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
+++ lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
@@ -33,12 +33,12 @@
}
static lldb_private::ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t length);
static lldb_private::ObjectFile *CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
Index: lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -54,7 +54,7 @@
}
ObjectFile *ObjectFileJIT::CreateInstance(const lldb::ModuleSP &module_sp,
- DataBufferSP &data_sp,
+ DataBufferSP data_sp,
lldb::offset_t data_offset,
const FileSpec *file,
lldb::offset_t file_offset,
@@ -65,7 +65,7 @@
}
ObjectFile *ObjectFileJIT::CreateMemoryInstance(const lldb::ModuleSP &module_sp,
- DataBufferSP &data_sp,
+ DataBufferSP data_sp,
const ProcessSP &process_sp,
lldb::addr_t header_addr) {
// JIT'ed object file is backed by the ObjectFileJITDelegate, never read from
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
===================================================================
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -68,12 +68,12 @@
}
static lldb_private::ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t length);
static lldb_private::ObjectFile *CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -336,7 +336,7 @@
}
ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp,
- DataBufferSP &data_sp,
+ DataBufferSP data_sp,
lldb::offset_t data_offset,
const lldb_private::FileSpec *file,
lldb::offset_t file_offset,
@@ -379,7 +379,7 @@
}
ObjectFile *ObjectFileELF::CreateMemoryInstance(
- const lldb::ModuleSP &module_sp, DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) {
if (data_sp && data_sp->GetByteSize() > (llvm::ELF::EI_NIDENT)) {
const uint8_t *magic = data_sp->GetBytes();
Index: lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
===================================================================
--- lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
+++ lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
@@ -27,12 +27,12 @@
}
static ObjectFile *
- CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
lldb::offset_t data_offset, const FileSpec *file,
lldb::offset_t file_offset, lldb::offset_t length);
static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,
- lldb::DataBufferSP &data_sp,
+ lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr);
Index: lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
+++ lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
@@ -57,7 +57,7 @@
}
ObjectFile *ObjectFileBreakpad::CreateInstance(
- const ModuleSP &module_sp, DataBufferSP &data_sp, offset_t data_offset,
+ const ModuleSP &module_sp, DataBufferSP data_sp, offset_t data_offset,
const FileSpec *file, offset_t file_offset, offset_t length) {
if (!data_sp) {
data_sp = MapFileData(*file, length, file_offset);
@@ -84,7 +84,7 @@
}
ObjectFile *ObjectFileBreakpad::CreateMemoryInstance(
- const ModuleSP &module_sp, DataBufferSP &data_sp,
+ const ModuleSP &module_sp, DataBufferSP data_sp,
const ProcessSP &process_sp, addr_t header_addr) {
return nullptr;
}
Index: lldb/include/lldb/lldb-private-interfaces.h
===================================================================
--- lldb/include/lldb/lldb-private-interfaces.h
+++ lldb/include/lldb/lldb-private-interfaces.h
@@ -45,13 +45,13 @@
lldb::offset_t data_offset, lldb::offset_t file_offset,
lldb::offset_t length, ModuleSpecList &module_specs);
typedef ObjectFile *(*ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp,
- lldb::DataBufferSP &data_sp,
+ lldb::DataBufferSP data_sp,
lldb::offset_t data_offset,
const FileSpec *file,
lldb::offset_t file_offset,
lldb::offset_t length);
typedef ObjectFile *(*ObjectFileCreateMemoryInstance)(
- const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
+ const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t offset);
typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp,
const FileSpec &outfile,
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits