Target::ReadMemory read from read-only binary file Section, not memory

Commiting this patch for Augusto Noronha who is getting set
up still.

This patch changes Target::ReadMemory so the default behavior
when a read is in a Section that is read-only is to fetch the
data from the local binary image, instead of reading it from
memory.  Update all callers to use their old preferences
(the old prefer_file_cache bool) using the new API; we should
revisit these calls and see if they really intend to read
live memory, or if reading from a read-only Section would be
equivalent and important for performance-sensitive cases.

rdar://30634422

Differential revision: https://reviews.llvm.org/D100338
This commit is contained in:
Jason Molenda committed 2021-04-16 16:13:07 -07:00
1 parent 11707435cc
commit e9fe788d32
28 files changed
+122 -133

No files matched your search

+2 -2
View File
@@ -132,10 +132,10 @@ SBInstructionList SBFunction::GetInstructions(SBTarget target,
m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule());
if (target_sp && module_sp) {
lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
const bool prefer_file_cache = false;
const bool force_live_memory = true;
sb_instructions.SetDisassembler(Disassembler::DisassembleRange(
module_sp->GetArchitecture(), nullptr, flavor, *target_sp,
m_opaque_ptr->GetAddressRange(), prefer_file_cache));
m_opaque_ptr->GetAddressRange(), force_live_memory));
}
}
return LLDB_RECORD_RESULT(sb_instructions);