diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2022-04-04 09:17:01 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2022-04-04 09:24:24 -0700 |
commit | c69307e5eeb585203a68b24f020d17ad75821c8a (patch) | |
tree | 0634aff13e62aa63cffb5d2d892156ae217517bc /lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp | |
parent | b08ede4374dbb6587dc5264a3352cb8463f4691c (diff) | |
download | llvm-c69307e5eeb585203a68b24f020d17ad75821c8a.zip llvm-c69307e5eeb585203a68b24f020d17ad75821c8a.tar.gz llvm-c69307e5eeb585203a68b24f020d17ad75821c8a.tar.bz2 |
[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
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp index ca93374..97fac5c 100644 --- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -54,7 +54,7 @@ void ObjectFileJIT::Terminate() { } 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::CreateInstance(const lldb::ModuleSP &module_sp, } 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 |