diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-09-02 21:17:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-08 17:34:50 +0000 |
commit | 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e (patch) | |
tree | 62f873df87c7c675557a179e0c4c83fe9f3087bc /contrib/llvm-project/lldb/source/API/SBSection.cpp | |
parent | cf037972ea8863e2bab7461d77345367d2c1e054 (diff) | |
parent | 7fa27ce4a07f19b07799a767fc29416f3b625afb (diff) | |
download | src-06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e.tar.gz src-06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e.zip |
Diffstat (limited to 'contrib/llvm-project/lldb/source/API/SBSection.cpp')
-rw-r--r-- | contrib/llvm-project/lldb/source/API/SBSection.cpp | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/contrib/llvm-project/lldb/source/API/SBSection.cpp b/contrib/llvm-project/lldb/source/API/SBSection.cpp index 3a9cf20e484a..b7b94f3ece1a 100644 --- a/contrib/llvm-project/lldb/source/API/SBSection.cpp +++ b/contrib/llvm-project/lldb/source/API/SBSection.cpp @@ -182,35 +182,10 @@ SBData SBSection::GetSectionData(uint64_t offset, uint64_t size) { SBData sb_data; SectionSP section_sp(GetSP()); if (section_sp) { - const uint64_t sect_file_size = section_sp->GetFileSize(); - if (sect_file_size > 0) { - ModuleSP module_sp(section_sp->GetModule()); - if (module_sp) { - ObjectFile *objfile = module_sp->GetObjectFile(); - if (objfile) { - const uint64_t sect_file_offset = - objfile->GetFileOffset() + section_sp->GetFileOffset(); - const uint64_t file_offset = sect_file_offset + offset; - uint64_t file_size = size; - if (file_size == UINT64_MAX) { - file_size = section_sp->GetByteSize(); - if (file_size > offset) - file_size -= offset; - else - file_size = 0; - } - auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer( - objfile->GetFileSpec().GetPath(), file_size, file_offset); - if (data_buffer_sp && data_buffer_sp->GetByteSize() > 0) { - DataExtractorSP data_extractor_sp( - new DataExtractor(data_buffer_sp, objfile->GetByteOrder(), - objfile->GetAddressByteSize())); - - sb_data.SetOpaque(data_extractor_sp); - } - } - } - } + DataExtractor section_data; + section_sp->GetSectionData(section_data); + sb_data.SetOpaque( + std::make_shared<DataExtractor>(section_data, offset, size)); } return sb_data; } |