mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[lldb] Prevent object file plugins from changing the data buffer
The current design allows that the object file contents could be mapped by one object file plugin and then used by another. Presumably the idea here was to avoid mapping the same file twice. This becomes an issue when one object file plugin wants to map the file differently from the others. For example, ObjectFileELF needs to map its memory as writable while others likeObjectFileMachO needs it to be mapped read-only. This patch prevents plugins from changing the buffer by passing them is by value rather than by reference. Differential revision: https://reviews.llvm.org/D122944
This commit is contained in:
@@ -817,7 +817,7 @@ void ObjectFileMachO::Terminate() {
|
||||
}
|
||||
|
||||
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::CreateInstance(const lldb::ModuleSP &module_sp,
|
||||
}
|
||||
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user