diff options
author | Pavel Labath <labath@google.com> | 2018-02-28 20:42:29 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-02-28 20:42:29 +0000 |
commit | ec03d7e3babb18f222d9b83a04e747f206f416a5 (patch) | |
tree | 242cc79fe6f09deb8ff99826bfb123cc331a4e65 /lldb/source/Symbol/ObjectFile.cpp | |
parent | fde8b042358ac2b8ac0b7c3a590e9471d3515462 (diff) | |
download | bcm5719-llvm-ec03d7e3babb18f222d9b83a04e747f206f416a5.tar.gz bcm5719-llvm-ec03d7e3babb18f222d9b83a04e747f206f416a5.zip |
Revert "[lldb] Use vFlash commands when writing to target's flash memory regions"
This reverts commit r326261 as it introduces inconsistencies in the
handling of load addresses for ObjectFileELF -- some parts of the class
use physical addresses, and some use virtual. This has manifested itself
as us not being able to set the load address of the vdso "module" on
android.
llvm-svn: 326367
Diffstat (limited to 'lldb/source/Symbol/ObjectFile.cpp')
-rw-r--r-- | lldb/source/Symbol/ObjectFile.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index ce8f04a9ff1..2129a4463cd 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -659,31 +659,22 @@ Status ObjectFile::LoadInMemory(Target &target, bool set_pc) { SectionList *section_list = GetSectionList(); if (!section_list) return Status("No section in object file"); - - std::vector<Process::WriteEntry> writeEntries; - - // Create a list of write entries from loadable sections size_t section_count = section_list->GetNumSections(0); for (size_t i = 0; i < section_count; ++i) { - Process::WriteEntry entry; SectionSP section_sp = section_list->GetSectionAtIndex(i); - entry.Dest = target.GetSectionLoadList().GetSectionLoadAddress(section_sp); - if (entry.Dest == LLDB_INVALID_ADDRESS) - continue; - // We can skip sections like bss - if (section_sp->GetFileSize() == 0) - continue; - DataExtractor section_data; - section_sp->GetSectionData(section_data); - entry.Contents = llvm::ArrayRef<uint8_t>(section_data.GetDataStart(), - section_data.GetByteSize()); - writeEntries.push_back(entry); + addr_t addr = target.GetSectionLoadList().GetSectionLoadAddress(section_sp); + if (addr != LLDB_INVALID_ADDRESS) { + DataExtractor section_data; + // We can skip sections like bss + if (section_sp->GetFileSize() == 0) + continue; + section_sp->GetSectionData(section_data); + lldb::offset_t written = process->WriteMemory( + addr, section_data.GetDataStart(), section_data.GetByteSize(), error); + if (written != section_data.GetByteSize()) + return error; + } } - - error = process->WriteObjectFile(std::move(writeEntries)); - if (!error.Success()) - return error; - if (set_pc) { ThreadList &thread_list = process->GetThreadList(); ThreadSP curr_thread(thread_list.GetSelectedThread()); |