Added the ability for Target::ReadMemory to prefer to read from the file
cache even when a valid process exists. Previously, Target::ReadMemory would
read from the process if there was a valid one and then fallback to the
object file cache.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@122989 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
index d6463e2..fd42948 100644
--- a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
+++ b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
@@ -470,7 +470,8 @@
 
     uint8_t onebyte_buf[1];
     Error error;
-    if (target->ReadMemory (read_addr, onebyte_buf, 1, error) != -1)
+    const bool prefer_file_cache = true;
+    if (target->ReadMemory (read_addr, prefer_file_cache, onebyte_buf, 1, error) != -1)
     {
         *buf = onebyte_buf[0];
         return 0;
@@ -550,6 +551,7 @@
     row.SetRegisterInfo (m_lldb_ip_regnum, initial_regloc);
 
     unwind_plan.AppendRow (row);
+    const bool prefer_file_cache = true;
 
     while (m_func_bounds.ContainsFileAddress (m_cur_insn) && non_prologue_insn_count < 10)
     {
@@ -562,7 +564,7 @@
             // An unrecognized/junk instruction
             break;
         }
-        if (m_target.ReadMemory (m_cur_insn, m_cur_insn_bytes, insn_len, error) == -1)
+        if (m_target.ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1)
         {
            // Error reading the instruction out of the file, stop scanning
            break;
@@ -672,7 +674,7 @@
         Address last_insn (m_func_bounds.GetBaseAddress());
         last_insn.SetOffset (last_insn.GetOffset() + m_func_bounds.GetByteSize() - 1);
         uint8_t bytebuf[1];
-        if (m_target.ReadMemory (last_insn, bytebuf, 1, error) != -1)
+        if (m_target.ReadMemory (last_insn, prefer_file_cache, bytebuf, 1, error) != -1)
         {
             if (bytebuf[0] == 0xc3)   // ret aka retq
             {
@@ -723,7 +725,8 @@
 
     uint8_t bytebuf[4];
     Error error;
-    if (m_target.ReadMemory (func.GetBaseAddress(), bytebuf, sizeof (bytebuf), error) == -1)
+    const bool prefer_file_cache = true;
+    if (m_target.ReadMemory (func.GetBaseAddress(), prefer_file_cache, bytebuf, sizeof (bytebuf), error) == -1)
         return false;
 
     uint8_t i386_prologue[] = {0x55, 0x89, 0xe5};
@@ -781,6 +784,7 @@
         return false;
     }
 
+    const bool prefer_file_cache = true;
     while (m_func_bounds.ContainsFileAddress (m_cur_insn))
     {
         Error error;
@@ -790,7 +794,7 @@
             // An error parsing the instruction, i.e. probably data/garbage - stop scanning
             break;
         }
-        if (m_target.ReadMemory (m_cur_insn, m_cur_insn_bytes, insn_len, error) == -1)
+        if (m_target.ReadMemory (m_cur_insn, prefer_file_cache, m_cur_insn_bytes, insn_len, error) == -1)
         {
            // Error reading the instruction out of the file, stop scanning
            break;