diff options
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index df334f88ee3..e6941c9f6ed 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -38,7 +38,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadList.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/DataBufferLLVM.h" +#include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Status.h" @@ -862,8 +862,7 @@ ObjectFile *ObjectFileMachO::CreateInstance(const lldb::ModuleSP &module_sp, lldb::offset_t file_offset, lldb::offset_t length) { if (!data_sp) { - data_sp = - DataBufferLLVM::CreateSliceFromPath(file->GetPath(), length, file_offset); + data_sp = MapFileData(*file, length, file_offset); if (!data_sp) return nullptr; data_offset = 0; @@ -874,8 +873,7 @@ ObjectFile *ObjectFileMachO::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::CreateSliceFromPath(file->GetPath(), length, file_offset); + data_sp = MapFileData(*file, length, file_offset); if (!data_sp) return nullptr; data_offset = 0; @@ -914,8 +912,7 @@ size_t ObjectFileMachO::GetModuleSpecifications( size_t header_and_load_cmds = header.sizeofcmds + MachHeaderSizeFromMagic(header.magic); if (header_and_load_cmds >= data_sp->GetByteSize()) { - data_sp = DataBufferLLVM::CreateSliceFromPath( - file.GetPath(), header_and_load_cmds, file_offset); + data_sp = MapFileData(file, header_and_load_cmds, file_offset); data.SetData(data_sp); data_offset = MachHeaderSizeFromMagic(header.magic); } @@ -1127,8 +1124,7 @@ bool ObjectFileMachO::ParseHeader() { ReadMemory(process_sp, m_memory_addr, header_and_lc_size); } else { // Read in all only the load command data from the file on disk - data_sp = DataBufferLLVM::CreateSliceFromPath( - m_file.GetPath(), header_and_lc_size, m_file_offset); + data_sp = MapFileData(m_file, header_and_lc_size, m_file_offset); if (data_sp->GetByteSize() != header_and_lc_size) return false; } @@ -2100,9 +2096,8 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache, const ByteOrder byte_order, const uint32_t addr_byte_size) { UUID dsc_uuid; - DataBufferSP DscData = DataBufferLLVM::CreateSliceFromPath( - dyld_shared_cache.GetPath(), - sizeof(struct lldb_copy_dyld_cache_header_v1), 0); + DataBufferSP DscData = MapFileData( + dyld_shared_cache, sizeof(struct lldb_copy_dyld_cache_header_v1), 0); if (!DscData) return dsc_uuid; DataExtractor dsc_header_data(DscData, byte_order, addr_byte_size); @@ -2708,9 +2703,8 @@ size_t ObjectFileMachO::ParseSymtab() { // Process the dyld shared cache header to find the unmapped symbols - DataBufferSP dsc_data_sp = DataBufferLLVM::CreateSliceFromPath( - dsc_filespec.GetPath(), sizeof(struct lldb_copy_dyld_cache_header_v1), - 0); + DataBufferSP dsc_data_sp = MapFileData( + dsc_filespec, sizeof(struct lldb_copy_dyld_cache_header_v1), 0); if (!dsc_uuid.IsValid()) { dsc_uuid = GetSharedCacheUUID(dsc_filespec, byte_order, addr_byte_size); } @@ -2742,11 +2736,9 @@ size_t ObjectFileMachO::ParseSymtab() { if (uuid_match && mappingOffset >= sizeof(struct lldb_copy_dyld_cache_header_v1)) { - DataBufferSP dsc_mapping_info_data_sp = - DataBufferLLVM::CreateSliceFromPath( - dsc_filespec.GetPath(), - sizeof(struct lldb_copy_dyld_cache_mapping_info), - mappingOffset); + DataBufferSP dsc_mapping_info_data_sp = MapFileData( + dsc_filespec, sizeof(struct lldb_copy_dyld_cache_mapping_info), + mappingOffset); DataExtractor dsc_mapping_info_data(dsc_mapping_info_data_sp, byte_order, addr_byte_size); @@ -2770,9 +2762,7 @@ size_t ObjectFileMachO::ParseSymtab() { if (localSymbolsOffset && localSymbolsSize) { // Map the local symbols DataBufferSP dsc_local_symbols_data_sp = - DataBufferLLVM::CreateSliceFromPath(dsc_filespec.GetPath(), - localSymbolsSize, - localSymbolsOffset); + MapFileData(dsc_filespec, localSymbolsSize, localSymbolsOffset); if (dsc_local_symbols_data_sp) { DataExtractor dsc_local_symbols_data(dsc_local_symbols_data_sp, |