Disassembler::DisassembleRange() currently calls Target::ReadMemory

with prefer_file_cache == false.  This is what we want to do when
the user is doing a disassemble command -- show the actual memory
contents in case the memory has been corrupted or something -- but
when we're profiling functions for stepping or unwinding
(ThreadPlanStepRange::GetInstructionsForAddress,
UnwindAssemblyInstEmulation::GetNonCallSiteUnwindP) we can read
__TEXT instructions directly out of the file, if it exists.
<rdar://problem/14397491> 

llvm-svn: 190638
This commit is contained in:
Jason Molenda committed 2013-09-12 23:23:35 +00:00
1 parent a5ebe426a5
commit 6b3e6d5487
6 files changed
+16 -7

No files matched your search

+2 -1
View File
@@ -270,7 +270,8 @@ public:
const char *plugin_name,
const char *flavor,
const ExecutionContext &exe_ctx,
const AddressRange &disasm_range);
const AddressRange &disasm_range,
bool prefer_file_cache);
static lldb::DisassemblerSP
DisassembleBytes (const ArchSpec &arch,
+3 -1
View File
@@ -143,11 +143,13 @@ SBFunction::GetInstructions (SBTarget target, const char *flavor)
ModuleSP module_sp (m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule());
if (module_sp)
{
const bool prefer_file_cache = false;
sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture(),
NULL,
flavor,
exe_ctx,
m_opaque_ptr->GetAddressRange()));
m_opaque_ptr->GetAddressRange(),
prefer_file_cache));
}
}
return sb_instructions;
+3 -1
View File
@@ -139,11 +139,13 @@ SBSymbol::GetInstructions (SBTarget target, const char *flavor_string)
if (module_sp)
{
AddressRange symbol_range (m_opaque_ptr->GetAddress(), m_opaque_ptr->GetByteSize());
const bool prefer_file_cache = false;
sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture (),
NULL,
flavor_string,
exe_ctx,
symbol_range));
symbol_range,
prefer_file_cache));
}
}
}
+2 -2
View File
@@ -235,7 +235,8 @@ Disassembler::DisassembleRange
const char *plugin_name,
const char *flavor,
const ExecutionContext &exe_ctx,
const AddressRange &range
const AddressRange &range,
bool prefer_file_cache
)
{
lldb::DisassemblerSP disasm_sp;
@@ -245,7 +246,6 @@ Disassembler::DisassembleRange
if (disasm_sp)
{
const bool prefer_file_cache = false;
size_t bytes_disassembled = disasm_sp->ParseInstructions (&exe_ctx, range, NULL, prefer_file_cache);
if (bytes_disassembled == 0)
disasm_sp.reset();
@@ -53,11 +53,13 @@ UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly (AddressRange&
ExecutionContext exe_ctx;
thread.CalculateExecutionContext(exe_ctx);
const bool prefer_file_cache = true;
DisassemblerSP disasm_sp (Disassembler::DisassembleRange (m_arch,
NULL,
NULL,
exe_ctx,
range));
range,
prefer_file_cache));
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
+3 -1
View File
@@ -284,11 +284,13 @@ ThreadPlanStepRange::GetInstructionsForAddress(lldb::addr_t addr, size_t &range_
ExecutionContext exe_ctx (m_thread.GetProcess());
const char *plugin_name = NULL;
const char *flavor = NULL;
const bool prefer_file_cache = true;
m_instruction_ranges[i] = Disassembler::DisassembleRange(GetTarget().GetArchitecture(),
plugin_name,
flavor,
exe_ctx,
m_address_ranges[i]);
m_address_ranges[i],
prefer_file_cache);
}
if (!m_instruction_ranges[i])