Remove FileSpec::ReadFileContents.
This functionality is subsumed by DataBufferLLVM, which is
also more efficient since it will try to mmap. However, we
don't yet support mmaping writable private sections, and in
some cases we were using ReadFileContents and then modifying
the buffer. To address that I've added a flag to the
DataBufferLLVM methods that allow you to map privately, which
disables the mmaping path entirely. Eventually we should teach
DataBufferLLVM to use mmap with writable private, but that is
orthogonal to this effort.
Differential Revision: https://reviews.llvm.org/D30622
llvm-svn: 297095
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 8a4734b..10213f5 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -388,7 +388,7 @@
lldb::offset_t length) {
if (!data_sp) {
data_sp =
- DataBufferLLVM::CreateFromPath(file->GetPath(), length, file_offset);
+ DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -406,7 +406,7 @@
// Update the data to contain the entire file if it doesn't already
if (data_sp->GetByteSize() < length) {
data_sp =
- DataBufferLLVM::CreateFromPath(file->GetPath(), length, file_offset);
+ DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset);
if (!data_sp)
return nullptr;
data_offset = 0;
@@ -665,7 +665,7 @@
size_t section_header_end = header.e_shoff + header.e_shentsize;
if (header.HasHeaderExtension() &&
section_header_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateFromPath(
+ data_sp = DataBufferLLVM::CreateSliceFromPath(
file.GetPath(), section_header_end, file_offset);
if (data_sp) {
data.SetData(data_sp);
@@ -679,7 +679,7 @@
section_header_end =
header.e_shoff + header.e_shnum * header.e_shentsize;
if (section_header_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateFromPath(
+ data_sp = DataBufferLLVM::CreateSliceFromPath(
file.GetPath(), section_header_end, file_offset);
if (data_sp)
data.SetData(data_sp);
@@ -724,7 +724,7 @@
size_t program_headers_end =
header.e_phoff + header.e_phnum * header.e_phentsize;
if (program_headers_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateFromPath(
+ data_sp = DataBufferLLVM::CreateSliceFromPath(
file.GetPath(), program_headers_end, file_offset);
if (data_sp)
data.SetData(data_sp);
@@ -740,7 +740,7 @@
}
if (segment_data_end > data_sp->GetByteSize()) {
- data_sp = DataBufferLLVM::CreateFromPath(
+ data_sp = DataBufferLLVM::CreateSliceFromPath(
file.GetPath(), segment_data_end, file_offset);
if (data_sp)
data.SetData(data_sp);
@@ -750,7 +750,7 @@
CalculateELFNotesSegmentsCRC32(program_headers, data);
} else {
// Need to map entire file into memory to calculate the crc.
- data_sp = DataBufferLLVM::CreateFromPath(file.GetPath(), -1,
+ data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), -1,
file_offset);
if (data_sp) {
data.SetData(data_sp);