|
LLDB mainline
|
#include <UnwindAssemblyInstEmulation.h>
Classes | |
| struct | UnwindState |
Static Public Member Functions | |
| static lldb_private::UnwindAssembly * | CreateInstance (const lldb_private::ArchSpec &arch) |
| static void | Initialize () |
| static void | Terminate () |
| static llvm::StringRef | GetPluginNameStatic () |
| static llvm::StringRef | GetPluginDescriptionStatic () |
| Static Public Member Functions inherited from lldb_private::UnwindAssembly | |
| static lldb::UnwindAssemblySP | FindPlugin (const ArchSpec &arch) |
Private Types | |
| typedef std::map< uint64_t, lldb_private::RegisterValue > | RegisterValueMap |
| typedef std::map< uint64_t, uint64_t > | PushedRegisterToAddrMap |
Static Private Member Functions | |
| static size_t | ReadMemory (lldb_private::EmulateInstruction *instruction, void *baton, const lldb_private::EmulateInstruction::Context &context, lldb::addr_t addr, void *dst, size_t length) |
| static size_t | WriteMemory (lldb_private::EmulateInstruction *instruction, void *baton, const lldb_private::EmulateInstruction::Context &context, lldb::addr_t addr, const void *dst, size_t length) |
| static bool | ReadRegister (lldb_private::EmulateInstruction *instruction, void *baton, const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue ®_value) |
| static bool | WriteRegister (lldb_private::EmulateInstruction *instruction, void *baton, const lldb_private::EmulateInstruction::Context &context, const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue ®_value) |
| static uint64_t | MakeRegisterKindValuePair (const lldb_private::RegisterInfo ®_info) |
| static uint64_t | GetSentinelFor (const lldb_private::RegisterInfo ®_info) |
| The sentinel value for a given register, which is used to determine whether a register contains the same value it did at function entry. | |
Private Attributes | |
| std::unique_ptr< lldb_private::EmulateInstruction > | m_inst_emulator_up |
| lldb_private::AddressRange * | m_range_ptr |
| lldb_private::UnwindPlan * | m_unwind_plan_ptr |
| UnwindState | m_state |
| uint64_t | m_initial_cfa |
| PushedRegisterToAddrMap | m_pushed_regs |
| bool | m_curr_row_modified |
| int64_t | m_branch_offset = 0 |
| bool | m_branch_is_call = false |
Additional Inherited Members | |
| Protected Member Functions inherited from lldb_private::UnwindAssembly | |
| UnwindAssembly (const ArchSpec &arch) | |
| Protected Attributes inherited from lldb_private::UnwindAssembly | |
| ArchSpec | m_arch |
Definition at line 18 of file UnwindAssemblyInstEmulation.h.
|
private |
Definition at line 151 of file UnwindAssemblyInstEmulation.h.
|
private |
Definition at line 131 of file UnwindAssemblyInstEmulation.h.
|
overridedefault |
|
inlineprivate |
Definition at line 63 of file UnwindAssemblyInstEmulation.h.
References lldb_private::UnwindAssembly::m_arch, m_curr_row_modified, m_initial_cfa, m_inst_emulator_up, m_range_ptr, m_unwind_plan_ptr, ReadMemory(), ReadRegister(), lldb_private::UnwindAssembly::UnwindAssembly(), WriteMemory(), and WriteRegister().
Referenced by CreateInstance(), GetNonCallSiteUnwindPlanFromAssembly(), ReadRegister(), WriteMemory(), and WriteRegister().
|
overridevirtual |
Implements lldb_private::UnwindAssembly.
Definition at line 324 of file UnwindAssemblyInstEmulation.cpp.
|
static |
Definition at line 342 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::eInstructionTypePrologueEpilogue, lldb_private::EmulateInstruction::FindPlugin(), and UnwindAssemblyInstEmulation().
Referenced by Initialize(), and Terminate().
|
private |
Follow a call into a compiler-outlined helper and emulate its body in the caller's state.
Outlined functions don't respect ABI, which is why this unwinder must follow outlined function calls. A prime target for outlining is function prologues. This function supports emulating straightline code with no branches, which is the case for prologues.
Definition at line 268 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::ConstString::AsCString(), lldb_private::Address::CalculateSymbolContextSymbol(), lldb_private::Disassembler::DisassembleBytes(), lldb_private::Instruction::GetAddress(), lldb_private::Symbol::GetAddress(), lldb_private::Symbol::GetByteSize(), lldb_private::Address::GetFileAddress(), lldb_private::InstructionList::GetInstructionAtIndex(), lldb_private::GetLog(), lldb_private::Symbol::GetName(), lldb_private::Address::GetOffset(), lldb_private::Instruction::GetOpcode(), lldb_private::Address::GetSection(), lldb_private::InstructionList::GetSize(), lldb_private::ConstString::GetStringRef(), LLDB_LOGF, lldb_private::UnwindAssembly::m_arch, m_inst_emulator_up, and lldb_private::Unwind.
Referenced by GetNonCallSiteUnwindPlanFromAssembly().
|
overridevirtual |
Implements lldb_private::UnwindAssembly.
Definition at line 335 of file UnwindAssemblyInstEmulation.cpp.
|
overridevirtual |
Implements lldb_private::UnwindAssembly.
Definition at line 329 of file UnwindAssemblyInstEmulation.cpp.
|
overridevirtual |
Implements lldb_private::UnwindAssembly.
Definition at line 38 of file UnwindAssemblyInstEmulation.cpp.
References error(), GetNonCallSiteUnwindPlanFromAssembly(), and UnwindAssemblyInstEmulation().
Referenced by GetNonCallSiteUnwindPlanFromAssembly().
| bool UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly | ( | lldb_private::AddressRange & | func, |
| uint8_t * | opcode_data, | ||
| size_t | opcode_size, | ||
| lldb_private::UnwindPlan & | unwind_plan ) |
Definition at line 81 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::AddressRange::ContainsFileAddress(), lldb_private::Disassembler::DisassembleBytes(), DumpInstToLog(), DumpUnwindRowsToLog(), EmulateOutlinedFunction(), lldb_private::Instruction::GetAddress(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::AddressRange::GetByteSize(), lldb_private::Opcode::GetByteSize(), lldb_private::Address::GetFileAddress(), lldb_private::InstructionList::GetIndexOfInstructionAtAddress(), lldb_private::UnwindPlan::GetInitialCFARegister(), lldb_private::InstructionList::GetInstructionAtIndex(), lldb_private::UnwindPlan::GetLastRow(), lldb_private::GetLog(), lldb_private::Instruction::GetOpcode(), lldb_private::UnwindPlan::GetRegisterKind(), lldb_private::UnwindPlan::GetRowCount(), lldb_private::InstructionList::GetSize(), lldb_private::UnwindPlan::InsertRow(), lldb_private::Instruction::IsBarrier(), lldb_private::Address::IsValid(), lldb_private::UnwindAssembly::m_arch, m_branch_is_call, m_branch_offset, m_curr_row_modified, m_initial_cfa, m_inst_emulator_up, m_pushed_regs, m_range_ptr, m_state, m_unwind_plan_ptr, SetRegisterValue(), lldb_private::RegisterValue::SetUInt(), lldb_private::Address::Slide(), lldb_private::EmulateInstruction::UnconditionalCondition, and lldb_private::Unwind.
|
static |
Definition at line 361 of file UnwindAssemblyInstEmulation.cpp.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 59 of file UnwindAssemblyInstEmulation.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 55 of file UnwindAssemblyInstEmulation.h.
Referenced by GetPluginName(), and Initialize().
|
private |
Definition at line 380 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::RegisterInfo::byte_size, GetSentinelFor(), m_state, MakeRegisterKindValuePair(), and lldb_private::RegisterValue::SetUInt().
Referenced by ReadRegister(), RegisterHoldsEntryValue(), and WriteRegister().
|
staticprivate |
The sentinel value for a given register, which is used to determine whether a register contains the same value it did at function entry.
Definition at line 395 of file UnwindAssemblyInstEmulation.cpp.
References MakeRegisterKindValuePair().
Referenced by GetRegisterValue(), and RegisterHoldsEntryValue().
|
static |
Definition at line 352 of file UnwindAssemblyInstEmulation.cpp.
References CreateInstance(), GetPluginDescriptionStatic(), GetPluginNameStatic(), and lldb_private::PluginManager::RegisterPlugin().
|
staticprivate |
Definition at line 365 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::EmulateInstruction::GetBestRegisterKindAndNumber().
Referenced by GetRegisterValue(), GetSentinelFor(), and SetRegisterValue().
|
staticprivate |
Definition at line 408 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::EmulateInstruction::Context::Dump(), lldb_private::GetLog(), lldb_private::StreamString::GetString(), lldb_private::Log::GetVerbose(), lldb_private::Stream::Printf(), lldb_private::Log::PutString(), and lldb_private::Unwind.
Referenced by UnwindAssemblyInstEmulation().
|
private |
Definition at line 522 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::DumpRegisterValue(), lldb::eFormatDefault, lldb_private::GetLog(), GetRegisterValue(), lldb_private::StreamString::GetString(), lldb_private::Log::GetVerbose(), lldb_private::RegisterInfo::name, lldb_private::Stream::Printf(), lldb_private::Log::PutString(), and lldb_private::Unwind.
|
staticprivate |
Definition at line 512 of file UnwindAssemblyInstEmulation.cpp.
References UnwindAssemblyInstEmulation().
Referenced by UnwindAssemblyInstEmulation().
|
private |
Whether reg_info currently holds its sentinel value.
This is not the same as the register being unwritten: a register that was overwritten and then restored (e.g. through a move from another register) holds it again.
Definition at line 401 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::RegisterValue::GetAsUInt64(), GetRegisterValue(), and GetSentinelFor().
Referenced by WriteMemory().
|
private |
Definition at line 375 of file UnwindAssemblyInstEmulation.cpp.
References m_state, and MakeRegisterKindValuePair().
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), and WriteRegister().
|
static |
Definition at line 357 of file UnwindAssemblyInstEmulation.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
private |
Definition at line 437 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::EmulateInstruction::Context::ContextInfo::RegisterToRegisterPlusOffset::data_reg, lldb_private::EmulateInstruction::Context::Dump(), lldb_private::DumpDataExtractor(), lldb_private::EmulateInstruction::eContextAbsoluteBranchRegister, lldb_private::EmulateInstruction::eContextAdjustBaseRegister, lldb_private::EmulateInstruction::eContextAdjustPC, lldb_private::EmulateInstruction::eContextAdjustStackPointer, lldb_private::EmulateInstruction::eContextAdvancePC, lldb_private::EmulateInstruction::eContextArithmetic, lldb_private::EmulateInstruction::eContextImmediate, lldb_private::EmulateInstruction::eContextInvalid, lldb_private::EmulateInstruction::eContextPopRegisterOffStack, lldb_private::EmulateInstruction::eContextPushRegisterOnStack, lldb_private::EmulateInstruction::eContextReadOpcode, lldb_private::EmulateInstruction::eContextRegisterLoad, lldb_private::EmulateInstruction::eContextRegisterPlusOffset, lldb_private::EmulateInstruction::eContextRegisterStore, lldb_private::EmulateInstruction::eContextRelativeBranchImmediate, lldb_private::EmulateInstruction::eContextReturnFromException, lldb_private::EmulateInstruction::eContextSupervisorCall, lldb_private::EmulateInstruction::eContextTableBranchReadMemory, lldb_private::EmulateInstruction::eContextWriteMemoryRandomBits, lldb_private::EmulateInstruction::eContextWriteRegisterRandomBits, lldb::eFormatBytes, lldb_private::EmulateInstruction::eInfoTypeRegisterToRegisterPlusOffset, lldb::eRegisterKindGeneric, lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::EmulateInstruction::GetArchitecture(), lldb_private::ArchSpec::GetByteOrder(), lldb_private::EmulateInstruction::Context::GetInfoType(), lldb_private::GetLog(), lldb_private::StreamString::GetString(), lldb_private::Log::GetVerbose(), lldb_private::EmulateInstruction::Context::info, lldb_private::RegisterInfo::kinds, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_SP, m_curr_row_modified, m_initial_cfa, m_pushed_regs, m_state, m_unwind_plan_ptr, lldb_private::Stream::PutCString(), lldb_private::Log::PutString(), RegisterHoldsEntryValue(), lldb_private::EmulateInstruction::Context::ContextInfo::RegisterToRegisterPlusOffset, lldb_private::EmulateInstruction::Context::type, UINT32_MAX, and lldb_private::Unwind.
|
staticprivate |
Definition at line 427 of file UnwindAssemblyInstEmulation.cpp.
References UnwindAssemblyInstEmulation().
Referenced by UnwindAssemblyInstEmulation().
|
private |
Definition at line 550 of file UnwindAssemblyInstEmulation.cpp.
References lldb_private::EmulateInstruction::Context::ContextInfo::address, lldb_private::EmulateInstruction::Context::Dump(), lldb_private::DumpRegisterValue(), lldb_private::EmulateInstruction::eContextAbsoluteBranchRegister, lldb_private::EmulateInstruction::eContextAdjustBaseRegister, lldb_private::EmulateInstruction::eContextAdjustPC, lldb_private::EmulateInstruction::eContextAdjustStackPointer, lldb_private::EmulateInstruction::eContextAdvancePC, lldb_private::EmulateInstruction::eContextArithmetic, lldb_private::EmulateInstruction::eContextImmediate, lldb_private::EmulateInstruction::eContextInvalid, lldb_private::EmulateInstruction::eContextPopRegisterOffStack, lldb_private::EmulateInstruction::eContextPushRegisterOnStack, lldb_private::EmulateInstruction::eContextReadOpcode, lldb_private::EmulateInstruction::eContextRegisterLoad, lldb_private::EmulateInstruction::eContextRegisterPlusOffset, lldb_private::EmulateInstruction::eContextRegisterStore, lldb_private::EmulateInstruction::eContextRelativeBranchImmediate, lldb_private::EmulateInstruction::eContextRestoreStackPointer, lldb_private::EmulateInstruction::eContextReturnFromException, lldb_private::EmulateInstruction::eContextSetFramePointer, lldb_private::EmulateInstruction::eContextSupervisorCall, lldb_private::EmulateInstruction::eContextTableBranchReadMemory, lldb_private::EmulateInstruction::eContextWriteMemoryRandomBits, lldb_private::EmulateInstruction::eContextWriteRegisterRandomBits, lldb::eFormatDefault, lldb_private::EmulateInstruction::eInfoTypeAddress, lldb_private::EmulateInstruction::eInfoTypeImmediate, lldb_private::EmulateInstruction::eInfoTypeImmediateSigned, lldb_private::EmulateInstruction::eInfoTypeISA, lldb_private::EmulateInstruction::eInfoTypeISAAndImmediate, lldb_private::EmulateInstruction::eInfoTypeISAAndImmediateSigned, lldb_private::EmulateInstruction::eInfoTypeRegisterPlusOffset, lldb::eRegisterKindGeneric, lldb_private::RegisterValue::GetAsUInt64(), lldb_private::EmulateInstruction::Context::GetInfoType(), lldb_private::GetLog(), GetRegisterValue(), lldb_private::StreamString::GetString(), lldb_private::Log::GetVerbose(), lldb_private::EmulateInstruction::Context::info, lldb_private::EmulateInstruction::Context::ContextInfo::ISAAndImmediate, lldb_private::EmulateInstruction::Context::ContextInfo::ISAAndImmediateSigned, lldb_private::RegisterInfo::kinds, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_FLAGS, LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_RA, LLDB_REGNUM_GENERIC_SP, m_branch_is_call, m_branch_offset, m_curr_row_modified, m_initial_cfa, m_inst_emulator_up, m_pushed_regs, m_state, m_unwind_plan_ptr, lldb_private::RegisterInfo::name, lldb_private::Stream::Printf(), lldb_private::Stream::PutCString(), lldb_private::Log::PutString(), lldb_private::EmulateInstruction::Context::ContextInfo::RegisterPlusOffset::reg, lldb_private::EmulateInstruction::Context::ContextInfo::RegisterPlusOffset, SetRegisterValue(), lldb_private::EmulateInstruction::Context::ContextInfo::ISAAndImmediateSigned::signed_data32, lldb_private::EmulateInstruction::Context::ContextInfo::signed_immediate, lldb_private::EmulateInstruction::Context::ContextInfo::RegisterPlusOffset::signed_offset, lldb_private::EmulateInstruction::Context::type, lldb_private::EmulateInstruction::Context::ContextInfo::ISAAndImmediate::unsigned_data32, lldb_private::EmulateInstruction::Context::ContextInfo::unsigned_immediate, and lldb_private::Unwind.
|
staticprivate |
Definition at line 541 of file UnwindAssemblyInstEmulation.cpp.
References UnwindAssemblyInstEmulation().
Referenced by UnwindAssemblyInstEmulation().
|
private |
Definition at line 166 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), and WriteRegister().
|
private |
Definition at line 164 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), and WriteRegister().
|
private |
Definition at line 161 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation(), WriteMemory(), and WriteRegister().
|
private |
Definition at line 150 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation(), WriteMemory(), and WriteRegister().
|
private |
Definition at line 146 of file UnwindAssemblyInstEmulation.h.
Referenced by EmulateOutlinedFunction(), GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation(), and WriteRegister().
|
private |
Definition at line 152 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), WriteMemory(), and WriteRegister().
|
private |
Definition at line 147 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), and UnwindAssemblyInstEmulation().
|
private |
Definition at line 149 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), GetRegisterValue(), SetRegisterValue(), WriteMemory(), and WriteRegister().
|
private |
Definition at line 148 of file UnwindAssemblyInstEmulation.h.
Referenced by GetNonCallSiteUnwindPlanFromAssembly(), UnwindAssemblyInstEmulation(), WriteMemory(), and WriteRegister().