[Lldb-commits] [lldb] r190638 - Disassembler::DisassembleRange() currently calls Target::ReadMemory
Jason Molenda
jmolenda at apple.com
Thu Sep 12 16:23:35 PDT 2013
Author: jmolenda
Date: Thu Sep 12 18:23:35 2013
New Revision: 190638
URL: http://llvm.org/viewvc/llvm-project?rev=190638&view=rev
Log:
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>
Modified:
lldb/trunk/include/lldb/Core/Disassembler.h
lldb/trunk/source/API/SBFunction.cpp
lldb/trunk/source/API/SBSymbol.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
lldb/trunk/source/Target/ThreadPlanStepRange.cpp
Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=190638&r1=190637&r2=190638&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Thu Sep 12 18:23:35 2013
@@ -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,
Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=190638&r1=190637&r2=190638&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Thu Sep 12 18:23:35 2013
@@ -143,11 +143,13 @@ SBFunction::GetInstructions (SBTarget ta
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;
Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=190638&r1=190637&r2=190638&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Thu Sep 12 18:23:35 2013
@@ -139,11 +139,13 @@ SBSymbol::GetInstructions (SBTarget targ
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));
}
}
}
Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=190638&r1=190637&r2=190638&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Thu Sep 12 18:23:35 2013
@@ -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();
Modified: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=190638&r1=190637&r2=190638&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Thu Sep 12 18:23:35 2013
@@ -53,11 +53,13 @@ UnwindAssemblyInstEmulation::GetNonCallS
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));
Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=190638&r1=190637&r2=190638&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Thu Sep 12 18:23:35 2013
@@ -284,11 +284,13 @@ ThreadPlanStepRange::GetInstructionsForA
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])
More information about the lldb-commits
mailing list