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
This commit is contained in:
@@ -388,7 +388,7 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp,
|
||||
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 @@ ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp,
|
||||
// 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 ObjectFileELF::GetModuleSpecifications(
|
||||
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 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
||||
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 ObjectFileELF::GetModuleSpecifications(
|
||||
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 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
||||
}
|
||||
|
||||
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 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user