[lldb] s/ExecutionContext/Target in Disassembler

Some functions in this file only use the "target" component of an
execution context. Adjust the argument lists to reflect that.

This avoids some defensive null checks and simplifies most of the
callers.
This commit is contained in:
Pavel Labath
2020-03-05 13:03:26 +01:00
parent 29693fc125
commit 04592d5b23
10 changed files with 48 additions and 66 deletions

View File

@@ -126,20 +126,15 @@ SBInstructionList SBFunction::GetInstructions(SBTarget target,
SBInstructionList sb_instructions;
if (m_opaque_ptr) {
ExecutionContext exe_ctx;
TargetSP target_sp(target.GetSP());
std::unique_lock<std::recursive_mutex> lock;
if (target_sp) {
lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
target_sp->CalculateExecutionContext(exe_ctx);
exe_ctx.SetProcessSP(target_sp->GetProcessSP());
}
ModuleSP module_sp(
m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule());
if (module_sp) {
if (target_sp && module_sp) {
lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
const bool prefer_file_cache = false;
sb_instructions.SetDisassembler(Disassembler::DisassembleRange(
module_sp->GetArchitecture(), nullptr, flavor, exe_ctx,
module_sp->GetArchitecture(), nullptr, flavor, *target_sp,
m_opaque_ptr->GetAddressRange(), prefer_file_cache));
}
}