LLDB mainline
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
lldb_private::RegisterContextUnwind Class Reference

#include <RegisterContextUnwind.h>

Inheritance diagram for lldb_private::RegisterContextUnwind:
Inheritance graph
[legend]

Public Types

typedef std::shared_ptr< RegisterContextUnwindSharedPtr
 

Public Member Functions

 RegisterContextUnwind (lldb_private::Thread &thread, const SharedPtr &next_frame, lldb_private::SymbolContext &sym_ctx, uint32_t frame_number, lldb_private::UnwindLLDB &unwind_lldb)
 
 ~RegisterContextUnwind () override=default
 
void InvalidateAllRegisters () override
 
size_t GetRegisterCount () override
 
const lldb_private::RegisterInfoGetRegisterInfoAtIndex (size_t reg) override
 
size_t GetRegisterSetCount () override
 
const lldb_private::RegisterSetGetRegisterSet (size_t reg_set) override
 
bool ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
 
bool WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
 
bool ReadAllRegisterValues (lldb::WritableDataBufferSP &data_sp) override
 
bool WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) override
 
uint32_t ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num) override
 Convert from a given register numbering scheme to the lldb register numbering scheme.
 
bool IsValid () const
 
bool IsTrapHandlerFrame () const
 
bool GetCFA (lldb::addr_t &cfa)
 
bool GetStartPC (lldb::addr_t &start_pc)
 
bool ReadPC (lldb::addr_t &start_pc)
 
bool BehavesLikeZerothFrame () const override
 Indicates that this frame is currently executing code, that the PC value is not a return-pc but an actual executing instruction.
 
- Public Member Functions inherited from lldb_private::RegisterContext
 RegisterContext (Thread &thread, uint32_t concrete_frame_idx)
 
 ~RegisterContext () override
 
void InvalidateIfNeeded (bool force)
 
virtual void InvalidateAllRegisters ()=0
 
virtual size_t GetRegisterCount ()=0
 
virtual const RegisterInfoGetRegisterInfoAtIndex (size_t reg)=0
 
virtual size_t GetRegisterSetCount ()=0
 
virtual const RegisterSetGetRegisterSet (size_t reg_set)=0
 
virtual lldb::ByteOrder GetByteOrder ()
 
virtual bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value)=0
 
virtual bool WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value)=0
 
virtual bool ReadAllRegisterValues (lldb::WritableDataBufferSP &data_sp)
 
virtual bool WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)
 
virtual bool RegisterWriteCausesReconfigure (const llvm::StringRef name)
 
virtual bool ReconfigureRegisterInfo ()
 
virtual bool ReadAllRegisterValues (lldb_private::RegisterCheckpoint &reg_checkpoint)
 
virtual bool WriteAllRegisterValues (const lldb_private::RegisterCheckpoint &reg_checkpoint)
 
bool CopyFromRegisterContext (lldb::RegisterContextSP context)
 
virtual uint32_t ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num)
 Convert from a given register numbering scheme to the lldb register numbering scheme.
 
virtual uint32_t NumSupportedHardwareBreakpoints ()
 
virtual uint32_t SetHardwareBreakpoint (lldb::addr_t addr, size_t size)
 
virtual bool ClearHardwareBreakpoint (uint32_t hw_idx)
 
virtual uint32_t NumSupportedHardwareWatchpoints ()
 
virtual uint32_t SetHardwareWatchpoint (lldb::addr_t addr, size_t size, bool read, bool write)
 
virtual bool ClearHardwareWatchpoint (uint32_t hw_index)
 
virtual bool HardwareSingleStep (bool enable)
 
virtual Status ReadRegisterValueFromMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue &reg_value)
 
virtual Status WriteRegisterValueToMemory (const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue &reg_value)
 
virtual lldb::tid_t GetThreadID () const
 
virtual ThreadGetThread ()
 
const RegisterInfoGetRegisterInfoByName (llvm::StringRef reg_name, uint32_t start_idx=0)
 
const RegisterInfoGetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num)
 
uint64_t GetPC (uint64_t fail_value=LLDB_INVALID_ADDRESS)
 
uint64_t GetThreadPointer (uint64_t fail_value=LLDB_INVALID_ADDRESS)
 
bool GetPCForSymbolication (Address &address)
 Get an address suitable for symbolication.
 
bool SetPC (uint64_t pc)
 
bool SetPC (Address addr)
 
uint64_t GetSP (uint64_t fail_value=LLDB_INVALID_ADDRESS)
 
bool SetSP (uint64_t sp)
 
uint64_t GetFP (uint64_t fail_value=LLDB_INVALID_ADDRESS)
 
bool SetFP (uint64_t fp)
 
const char * GetRegisterName (uint32_t reg)
 
uint64_t GetReturnAddress (uint64_t fail_value=LLDB_INVALID_ADDRESS)
 
uint64_t GetFlags (uint64_t fail_value=0)
 
uint64_t ReadRegisterAsUnsigned (uint32_t reg, uint64_t fail_value)
 
uint64_t ReadRegisterAsUnsigned (const RegisterInfo *reg_info, uint64_t fail_value)
 
bool WriteRegisterFromUnsigned (uint32_t reg, uint64_t uval)
 
bool WriteRegisterFromUnsigned (const RegisterInfo *reg_info, uint64_t uval)
 
bool ConvertBetweenRegisterKinds (lldb::RegisterKind source_rk, uint32_t source_regnum, lldb::RegisterKind target_rk, uint32_t &target_regnum)
 
lldb::TargetSP CalculateTarget () override
 
lldb::ProcessSP CalculateProcess () override
 
lldb::ThreadSP CalculateThread () override
 
lldb::StackFrameSP CalculateStackFrame () override
 
void CalculateExecutionContext (ExecutionContext &exe_ctx) override
 Reconstruct the object's execution context into sc.
 
uint32_t GetStopID () const
 
void SetStopID (uint32_t stop_id)
 
- Public Member Functions inherited from lldb_private::ExecutionContextScope
virtual ~ExecutionContextScope ()=default
 
virtual lldb::TargetSP CalculateTarget ()=0
 
virtual lldb::ProcessSP CalculateProcess ()=0
 
virtual lldb::ThreadSP CalculateThread ()=0
 
virtual lldb::StackFrameSP CalculateStackFrame ()=0
 
virtual void CalculateExecutionContext (ExecutionContext &exe_ctx)=0
 Reconstruct the object's execution context into sc.
 

Private Types

enum  FrameType {
  eNormalFrame , eTrapHandlerFrame , eDebuggerFrame , eSkipFrame ,
  eNotAValidFrame
}
 

Private Member Functions

bool CheckIfLoopingStack ()
 
bool IsFrameZero () const
 
void InitializeZerothFrame ()
 
void InitializeNonZerothFrame ()
 
SharedPtr GetNextFrame () const
 
SharedPtr GetPrevFrame () const
 
bool IsSkipFrame () const
 
bool IsTrapHandlerSymbol (lldb_private::Process *process, const lldb_private::SymbolContext &m_sym_ctx) const
 Determines if a SymbolContext is a trap handler or not.
 
void PropagateTrapHandlerFlagFromUnwindPlan (lldb::UnwindPlanSP unwind_plan)
 Check if the given unwind plan indicates a signal trap handler, and update frame type and symbol context if so.
 
lldb_private::UnwindLLDB::RegisterSearchResult SavedLocationForRegister (uint32_t lldb_regnum, lldb_private::UnwindLLDB::RegisterLocation &regloc)
 
bool ReadRegisterValueFromRegisterLocation (lldb_private::UnwindLLDB::RegisterLocation regloc, const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value)
 
bool WriteRegisterValueToRegisterLocation (lldb_private::UnwindLLDB::RegisterLocation regloc, const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value)
 
bool TryFallbackUnwindPlan ()
 If the unwind has to the caller frame has failed, try something else.
 
bool ForceSwitchToFallbackUnwindPlan ()
 Switch to the fallback unwind plan unconditionally without any safety checks that it is providing better results than the normal unwind plan.
 
bool ReadGPRValue (lldb::RegisterKind register_kind, uint32_t regnum, lldb::addr_t &value)
 
bool ReadGPRValue (const RegisterNumber &reg_num, lldb::addr_t &value)
 
bool ReadFrameAddress (lldb::RegisterKind register_kind, UnwindPlan::Row::FAValue &fa, lldb::addr_t &address)
 
lldb::UnwindPlanSP GetFastUnwindPlanForFrame ()
 
lldb::UnwindPlanSP GetFullUnwindPlanForFrame ()
 
void UnwindLogMsg (const char *fmt,...) __attribute__((format(printf
 
void void UnwindLogMsgVerbose (const char *fmt,...) __attribute__((format(printf
 
void void bool IsUnwindPlanValidForCurrentPC (lldb::UnwindPlanSP unwind_plan_sp)
 
lldb::addr_t GetReturnAddressHint (int32_t plan_offset)
 
 RegisterContextUnwind (const RegisterContextUnwind &)=delete
 
const RegisterContextUnwindoperator= (const RegisterContextUnwind &)=delete
 

Private Attributes

lldb_private::Threadm_thread
 
lldb::UnwindPlanSP m_fast_unwind_plan_sp
 
lldb::UnwindPlanSP m_full_unwind_plan_sp
 
lldb::UnwindPlanSP m_fallback_unwind_plan_sp
 
bool m_all_registers_available
 
int m_frame_type
 
lldb::addr_t m_cfa
 
lldb::addr_t m_afa
 
lldb_private::Address m_start_pc
 
lldb_private::Address m_current_pc
 
int m_current_offset
 
int m_current_offset_backed_up_one
 
bool m_behaves_like_zeroth_frame
 
lldb_private::SymbolContextm_sym_ctx
 
bool m_sym_ctx_valid
 
uint32_t m_frame_number
 
std::map< uint32_t, lldb_private::UnwindLLDB::RegisterLocationm_registers
 
lldb_private::UnwindLLDBm_parent_unwind
 

Friends

class UnwindLLDB
 

Additional Inherited Members

virtual bool BehavesLikeZerothFrame () const
 Indicates that this frame is currently executing code, that the PC value is not a return-pc but an actual executing instruction.
 
- Protected Attributes inherited from lldb_private::RegisterContext
Threadm_thread
 
uint32_t m_concrete_frame_idx
 
uint32_t m_stop_id
 

Detailed Description

Definition at line 25 of file RegisterContextUnwind.h.

Member Typedef Documentation

◆ SharedPtr

Definition at line 27 of file RegisterContextUnwind.h.

Member Enumeration Documentation

◆ FrameType

Enumerator
eNormalFrame 
eTrapHandlerFrame 
eDebuggerFrame 
eSkipFrame 
eNotAValidFrame 

Definition at line 76 of file RegisterContextUnwind.h.

Constructor & Destructor Documentation

◆ RegisterContextUnwind() [1/2]

RegisterContextUnwind::RegisterContextUnwind ( lldb_private::Thread thread,
const SharedPtr next_frame,
lldb_private::SymbolContext sym_ctx,
uint32_t  frame_number,
lldb_private::UnwindLLDB unwind_lldb 
)

◆ ~RegisterContextUnwind()

lldb_private::RegisterContextUnwind::~RegisterContextUnwind ( )
overridedefault

◆ RegisterContextUnwind() [2/2]

lldb_private::RegisterContextUnwind::RegisterContextUnwind ( const RegisterContextUnwind )
privatedelete

Member Function Documentation

◆ BehavesLikeZerothFrame()

bool RegisterContextUnwind::BehavesLikeZerothFrame ( ) const
overridevirtual

Indicates that this frame is currently executing code, that the PC value is not a return-pc but an actual executing instruction.

Some places in lldb will treat a return-pc value differently than the currently-executing-pc value, and this method can indicate if that should be done. The base class implementation only uses the frame index, but subclasses may have additional information that they can use to detect frames in this state, for instance a frame above a trap handler (sigtramp etc)..

Reimplemented from lldb_private::RegisterContext.

Definition at line 734 of file RegisterContextUnwind.cpp.

References m_behaves_like_zeroth_frame, and m_frame_number.

◆ CheckIfLoopingStack()

bool RegisterContextUnwind::CheckIfLoopingStack ( )
private

Definition at line 703 of file RegisterContextUnwind.cpp.

References GetNextFrame(), LLDB_INVALID_ADDRESS, and m_cfa.

Referenced by InitializeNonZerothFrame().

◆ ConvertRegisterKindToRegisterNumber()

uint32_t RegisterContextUnwind::ConvertRegisterKindToRegisterNumber ( lldb::RegisterKind  kind,
uint32_t  num 
)
overridevirtual

Convert from a given register numbering scheme to the lldb register numbering scheme.

There may be multiple ways to enumerate the registers for a given architecture. ABI references will specify one to be used with DWARF, the register numberings from process plugin, there may be a variation used for eh_frame unwind instructions (e.g. on Darwin), and so on. Register 5 by itself is meaningless - RegisterKind enumeration tells you what context that number should be translated as.

Inside lldb, register numbers are in the eRegisterKindLLDB scheme; arguments which take a register number should take one in that scheme.

eRegisterKindGeneric is a special numbering scheme which gives us constant values for the pc, frame register, stack register, etc., for use within lldb. They may not be defined for all architectures but it allows generic code to translate these common registers into the lldb numbering scheme.

This method translates a given register kind + register number into the eRegisterKindLLDB register numbering.

Parameters
[in]kindThe register numbering scheme (RegisterKind) that the following register number is in.
[in]numA register number in the 'kind' register numbering scheme.
Returns
The equivalent register number in the eRegisterKindLLDB numbering scheme, if possible, else LLDB_INVALID_REGNUM.

Reimplemented from lldb_private::RegisterContext.

Definition at line 1104 of file RegisterContextUnwind.cpp.

References lldb_private::Thread::GetRegisterContext(), and m_thread.

◆ ForceSwitchToFallbackUnwindPlan()

bool RegisterContextUnwind::ForceSwitchToFallbackUnwindPlan ( )
private

Switch to the fallback unwind plan unconditionally without any safety checks that it is providing better results than the normal unwind plan.

The only time it is valid to call this method is if the full unwindplan is found to be fundamentally incorrect/impossible.

Returns true if it was able to install the fallback unwind plan.

Definition at line 1860 of file RegisterContextUnwind.cpp.

References LLDB_INVALID_ADDRESS, m_afa, m_cfa, m_current_offset, m_fallback_unwind_plan_sp, m_full_unwind_plan_sp, m_registers, PropagateTrapHandlerFlagFromUnwindPlan(), ReadFrameAddress(), lldb_private::UnwindPlan::Row::FAValue::unspecified, and UnwindLogMsg().

Referenced by SavedLocationForRegister().

◆ GetCFA()

bool RegisterContextUnwind::GetCFA ( lldb::addr_t cfa)

Definition at line 2286 of file RegisterContextUnwind.cpp.

References IsValid(), LLDB_INVALID_ADDRESS, and m_cfa.

◆ GetFastUnwindPlanForFrame()

UnwindPlanSP RegisterContextUnwind::GetFastUnwindPlanForFrame ( )
private

◆ GetFullUnwindPlanForFrame()

UnwindPlanSP RegisterContextUnwind::GetFullUnwindPlanForFrame ( )
private

Definition at line 797 of file RegisterContextUnwind.cpp.

References lldb_private::DynamicLoader::AlwaysRelyOnEHUnwindInfo(), lldb_private::ABI::CreateDefaultUnwindPlan(), lldb_private::ABI::CreateFunctionEntryUnwindPlan(), eDebuggerFrame, lldb_private::eLazyBoolNo, lldb_private::eLazyBoolYes, eNormalFrame, lldb::eRegisterKindGeneric, eTrapHandlerFrame, lldb_private::SymbolContext::function, lldb_private::Process::GetABI(), lldb_private::Target::GetArchitecture(), lldb_private::Process::GetDynamicLoader(), lldb_private::Address::GetLoadAddress(), lldb_private::Process::GetLoadAddressPermissions(), lldb_private::Address::GetModule(), GetNextFrame(), lldb_private::Target::GetPlatform(), lldb_private::ExecutionContext::GetProcessPtr(), GetSymbolOrFunctionName(), lldb_private::Process::GetTarget(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::ExecutionContext::GetTargetRef(), lldb_private::ArchSpec::GetTriple(), lldb_private::DWARFCallFrameInfo::GetUnwindPlan(), lldb_private::CallFrameInfo::GetUnwindPlan(), lldb_private::ArmUnwindInfo::GetUnwindPlan(), IsFrameZero(), IsUnwindPlanValidForCurrentPC(), lldb_private::Address::IsValid(), m_all_registers_available, m_behaves_like_zeroth_frame, m_current_offset, m_current_pc, m_fallback_unwind_plan_sp, m_fast_unwind_plan_sp, m_frame_type, m_sym_ctx, m_sym_ctx_valid, m_thread, lldb_private::SymbolContext::symbol, UnwindLogMsg(), and UnwindLogMsgVerbose().

Referenced by InitializeNonZerothFrame(), InitializeZerothFrame(), and SavedLocationForRegister().

◆ GetNextFrame()

RegisterContextUnwind::SharedPtr RegisterContextUnwind::GetNextFrame ( ) const
private

◆ GetPrevFrame()

RegisterContextUnwind::SharedPtr RegisterContextUnwind::GetPrevFrame ( ) const
private

◆ GetRegisterCount()

size_t RegisterContextUnwind::GetRegisterCount ( )
overridevirtual

◆ GetRegisterInfoAtIndex()

const RegisterInfo * RegisterContextUnwind::GetRegisterInfoAtIndex ( size_t  reg)
overridevirtual

◆ GetRegisterSet()

const RegisterSet * RegisterContextUnwind::GetRegisterSet ( size_t  reg_set)
overridevirtual

◆ GetRegisterSetCount()

size_t RegisterContextUnwind::GetRegisterSetCount ( )
overridevirtual

◆ GetReturnAddressHint()

lldb::addr_t RegisterContextUnwind::GetReturnAddressHint ( int32_t  plan_offset)
private

◆ GetStartPC()

bool RegisterContextUnwind::GetStartPC ( lldb::addr_t start_pc)

◆ InitializeNonZerothFrame()

void RegisterContextUnwind::InitializeNonZerothFrame ( )
private

Definition at line 311 of file RegisterContextUnwind.cpp.

References CheckIfLoopingStack(), lldb_private::SymbolContext::Clear(), eDebuggerFrame, eNormalFrame, eNotAValidFrame, lldb::eRegisterKindGeneric, eSkipFrame, eTrapHandlerFrame, lldb_private::SymbolContext::function, lldb_private::Process::GetABI(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::StreamString::GetData(), GetFastUnwindPlanForFrame(), GetFullUnwindPlanForFrame(), lldb_private::Address::GetLoadAddress(), lldb_private::Process::GetLoadAddressPermissions(), lldb_private::GetLog(), lldb_private::Address::GetModule(), GetNextFrame(), lldb_private::Address::GetOffset(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::Thread::GetRegisterContext(), lldb_private::LanguageRuntime::GetRuntimeUnwindPlan(), lldb_private::Address::GetSection(), GetSymbolOrFunctionName(), lldb_private::Process::GetTarget(), lldb_private::ExecutionContext::GetTargetPtr(), IsFrameZero(), IsTrapHandlerFrame(), IsTrapHandlerSymbol(), IsUnwindPlanValidForCurrentPC(), lldb_private::Address::IsValid(), IsValid(), LLDB_INVALID_ADDRESS, LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_SP, m_afa, m_all_registers_available, m_behaves_like_zeroth_frame, m_cfa, m_current_offset, m_current_offset_backed_up_one, m_current_pc, m_fast_unwind_plan_sp, m_frame_type, m_full_unwind_plan_sp, m_start_pc, m_sym_ctx, m_sym_ctx_valid, m_thread, pc, PropagateTrapHandlerFlagFromUnwindPlan(), ReadFrameAddress(), ReadGPRValue(), lldb_private::Address::ResolveFunctionScope(), lldb_private::Address::SetLoadAddress(), lldb_private::SymbolContext::symbol, TryFallbackUnwindPlan(), lldb_private::Unwind, and UnwindLogMsg().

Referenced by RegisterContextUnwind().

◆ InitializeZerothFrame()

void RegisterContextUnwind::InitializeZerothFrame ( )
private

◆ InvalidateAllRegisters()

void RegisterContextUnwind::InvalidateAllRegisters ( )
overridevirtual

Implements lldb_private::RegisterContext.

Definition at line 1084 of file RegisterContextUnwind.cpp.

References eNotAValidFrame, and m_frame_type.

◆ IsFrameZero()

bool RegisterContextUnwind::IsFrameZero ( ) const
private

◆ IsSkipFrame()

bool RegisterContextUnwind::IsSkipFrame ( ) const
private

Definition at line 1227 of file RegisterContextUnwind.cpp.

References eSkipFrame, and m_frame_type.

◆ IsTrapHandlerFrame()

bool RegisterContextUnwind::IsTrapHandlerFrame ( ) const

Definition at line 1215 of file RegisterContextUnwind.cpp.

References eTrapHandlerFrame, and m_frame_type.

Referenced by InitializeNonZerothFrame(), and ReadPC().

◆ IsTrapHandlerSymbol()

bool RegisterContextUnwind::IsTrapHandlerSymbol ( lldb_private::Process process,
const lldb_private::SymbolContext m_sym_ctx 
) const
private

◆ IsUnwindPlanValidForCurrentPC()

bool RegisterContextUnwind::IsUnwindPlanValidForCurrentPC ( lldb::UnwindPlanSP  unwind_plan_sp)
private

◆ IsValid()

bool RegisterContextUnwind::IsValid ( ) const

◆ operator=()

const RegisterContextUnwind & lldb_private::RegisterContextUnwind::operator= ( const RegisterContextUnwind )
privatedelete

◆ PropagateTrapHandlerFlagFromUnwindPlan()

void RegisterContextUnwind::PropagateTrapHandlerFlagFromUnwindPlan ( lldb::UnwindPlanSP  unwind_plan)
private

◆ ReadAllRegisterValues()

bool RegisterContextUnwind::ReadAllRegisterValues ( lldb::WritableDataBufferSP data_sp)
overridevirtual

Reimplemented from lldb_private::RegisterContext.

Definition at line 2273 of file RegisterContextUnwind.cpp.

◆ ReadFrameAddress()

bool RegisterContextUnwind::ReadFrameAddress ( lldb::RegisterKind  register_kind,
UnwindPlan::Row::FAValue fa,
lldb::addr_t address 
)
private

Definition at line 1954 of file RegisterContextUnwind.cpp.

References lldb_private::Status::AsCString(), lldb_private::RegisterInfo::byte_size, lldb::eRegisterKindLLDB, error(), lldb_private::DWARFExpressionList::Evaluate(), lldb_private::Status::Fail(), lldb_private::Process::GetAddressByteSize(), RegisterNumber::GetAsKind(), lldb_private::RegisterValue::GetAsUInt64(), lldb_private::Process::GetByteOrder(), lldb_private::UnwindPlan::Row::FAValue::GetDWARFExpressionBytes(), lldb_private::UnwindPlan::Row::FAValue::GetDWARFExpressionLength(), lldb_private::Process::GetLoadAddressPermissions(), lldb_private::DWARFExpressionList::GetMutableExpressionAtAddress(), RegisterNumber::GetName(), lldb_private::UnwindPlan::Row::FAValue::GetOffset(), lldb_private::Thread::GetProcess(), lldb_private::ExecutionContext::GetProcessPtr(), GetRegisterInfoAtIndex(), lldb_private::UnwindPlan::Row::FAValue::GetRegisterNumber(), GetReturnAddressHint(), lldb_private::Value::GetScalar(), lldb_private::UnwindPlan::Row::FAValue::GetValueType(), lldb_private::UnwindPlan::Row::FAValue::isDWARFExpression, lldb_private::UnwindPlan::Row::FAValue::isRaSearch, lldb_private::UnwindPlan::Row::FAValue::isRegisterDereferenced, lldb_private::UnwindPlan::Row::FAValue::isRegisterPlusOffset, LLDB_INVALID_ADDRESS, m_thread, ReadGPRValue(), lldb_private::Process::ReadPointerFromMemory(), lldb_private::RegisterContext::ReadRegisterValueFromMemory(), lldb_private::DWARFExpression::SetRegisterKind(), lldb_private::Scalar::ULongLong(), and UnwindLogMsg().

Referenced by ForceSwitchToFallbackUnwindPlan(), InitializeNonZerothFrame(), InitializeZerothFrame(), SavedLocationForRegister(), and TryFallbackUnwindPlan().

◆ ReadGPRValue() [1/2]

bool RegisterContextUnwind::ReadGPRValue ( const RegisterNumber reg_num,
lldb::addr_t value 
)
private

◆ ReadGPRValue() [2/2]

bool RegisterContextUnwind::ReadGPRValue ( lldb::RegisterKind  register_kind,
uint32_t  regnum,
lldb::addr_t value 
)
private

◆ ReadPC()

bool RegisterContextUnwind::ReadPC ( lldb::addr_t start_pc)

◆ ReadRegister()

bool RegisterContextUnwind::ReadRegister ( const lldb_private::RegisterInfo reg_info,
lldb_private::RegisterValue value 
)
overridevirtual

◆ ReadRegisterValueFromRegisterLocation()

bool RegisterContextUnwind::ReadRegisterValueFromRegisterLocation ( lldb_private::UnwindLLDB::RegisterLocation  regloc,
const lldb_private::RegisterInfo reg_info,
lldb_private::RegisterValue value 
)
private

◆ SavedLocationForRegister()

enum UnwindLLDB::RegisterSearchResult RegisterContextUnwind::SavedLocationForRegister ( uint32_t  lldb_regnum,
lldb_private::UnwindLLDB::RegisterLocation regloc 
)
private

Definition at line 1261 of file RegisterContextUnwind.cpp.

References lldb_private::eLazyBoolYes, lldb_private::UnwindLLDB::eRegisterFound, lldb_private::UnwindLLDB::RegisterLocation::eRegisterInLiveRegisterContext, lldb_private::UnwindLLDB::RegisterLocation::eRegisterInRegister, lldb_private::UnwindLLDB::eRegisterIsVolatile, lldb::eRegisterKindGeneric, lldb::eRegisterKindLLDB, lldb_private::UnwindLLDB::eRegisterNotFound, lldb_private::UnwindLLDB::RegisterLocation::eRegisterNotSaved, lldb_private::UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation, lldb_private::UnwindLLDB::RegisterLocation::eRegisterValueInferred, error(), eTrapHandlerFrame, lldb_private::DWARFExpressionList::Evaluate(), ForceSwitchToFallbackUnwindPlan(), lldb_private::Process::GetABI(), lldb_private::Process::GetAddressByteSize(), RegisterNumber::GetAsKind(), lldb_private::Process::GetByteOrder(), lldb_private::StreamString::GetData(), lldb_private::UnwindPlan::Row::RegisterLocation::GetDWARFExpressionBytes(), lldb_private::UnwindPlan::Row::RegisterLocation::GetDWARFExpressionLength(), lldb_private::ABI::GetFallbackRegisterLocation(), GetFullUnwindPlanForFrame(), lldb_private::Address::GetLoadAddress(), lldb_private::GetLog(), lldb_private::DWARFExpressionList::GetMutableExpressionAtAddress(), RegisterNumber::GetName(), lldb_private::UnwindPlan::Row::RegisterLocation::GetOffset(), lldb_private::ExecutionContext::GetProcessPtr(), GetRegisterInfoAtIndex(), lldb_private::UnwindPlan::Row::RegisterLocation::GetRegisterNumber(), lldb_private::Value::GetScalar(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::UnwindLLDB::RegisterLocation::inferred_value, RegisterNumber::init(), lldb_private::UnwindPlan::Row::RegisterLocation::IsAFAPlusOffset(), lldb_private::UnwindPlan::Row::RegisterLocation::IsAtAFAPlusOffset(), lldb_private::UnwindPlan::Row::RegisterLocation::IsAtCFAPlusOffset(), lldb_private::UnwindPlan::Row::RegisterLocation::IsAtDWARFExpression(), lldb_private::UnwindPlan::Row::RegisterLocation::IsCFAPlusOffset(), lldb_private::UnwindPlan::Row::RegisterLocation::IsDWARFExpression(), IsFrameZero(), lldb_private::UnwindPlan::Row::RegisterLocation::IsInOtherRegister(), lldb_private::UnwindPlan::Row::RegisterLocation::IsSame(), lldb_private::UnwindPlan::Row::RegisterLocation::IsUndefined(), lldb_private::UnwindPlan::Row::RegisterLocation::IsUnspecified(), RegisterNumber::IsValid(), lldb::kNumRegisterKinds, LLDB_INVALID_ADDRESS, LLDB_INVALID_REGNUM, LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_RA, lldb_private::Value::LoadAddress, lldb_private::UnwindLLDB::RegisterLocation::location, m_afa, m_all_registers_available, m_cfa, m_current_offset, m_current_offset_backed_up_one, m_fast_unwind_plan_sp, m_frame_type, m_full_unwind_plan_sp, m_registers, m_start_pc, m_thread, ReadFrameAddress(), lldb_private::UnwindLLDB::RegisterLocation::register_number, lldb_private::DWARFExpression::SetRegisterKind(), lldb_private::Value::SetValueType(), lldb_private::UnwindLLDB::RegisterLocation::target_memory_location, lldb_private::UnwindLLDB::RegisterLocation::type, lldb_private::Scalar::ULongLong(), lldb_private::Unwind, and UnwindLogMsg().

Referenced by TryFallbackUnwindPlan().

◆ TryFallbackUnwindPlan()

bool RegisterContextUnwind::TryFallbackUnwindPlan ( )
private

If the unwind has to the caller frame has failed, try something else.

If lldb is using an assembly language based UnwindPlan for a frame and the unwind to the caller frame fails, try falling back to a generic UnwindPlan (architecture default unwindplan) to see if that might work better. This is mostly helping to work around problems where the assembly language inspection fails on hand-written assembly code.

Returns
Returns true if a fallback unwindplan was found & was installed.

Definition at line 1721 of file RegisterContextUnwind.cpp.

References lldb_private::eLazyBoolYes, lldb_private::UnwindLLDB::eRegisterFound, lldb::eRegisterKindGeneric, lldb::eRegisterKindLLDB, RegisterNumber::GetAsKind(), lldb_private::RegisterValue::GetAsUInt64(), lldb_private::Thread::GetProcess(), GetRegisterInfoAtIndex(), LLDB_INVALID_ADDRESS, LLDB_REGNUM_GENERIC_PC, m_afa, m_cfa, m_current_offset_backed_up_one, m_fallback_unwind_plan_sp, m_full_unwind_plan_sp, m_registers, m_thread, PropagateTrapHandlerFlagFromUnwindPlan(), ReadFrameAddress(), ReadRegisterValueFromRegisterLocation(), SavedLocationForRegister(), lldb_private::UnwindPlan::Row::FAValue::unspecified, and UnwindLogMsg().

Referenced by InitializeNonZerothFrame(), and InitializeZerothFrame().

◆ UnwindLogMsg()

void RegisterContextUnwind::UnwindLogMsg ( const char *  fmt,
  ... 
)
private

◆ UnwindLogMsgVerbose()

void RegisterContextUnwind::UnwindLogMsgVerbose ( const char *  fmt,
  ... 
)
private

◆ WriteAllRegisterValues()

bool RegisterContextUnwind::WriteAllRegisterValues ( const lldb::DataBufferSP data_sp)
overridevirtual

Reimplemented from lldb_private::RegisterContext.

Definition at line 2279 of file RegisterContextUnwind.cpp.

◆ WriteRegister()

bool RegisterContextUnwind::WriteRegister ( const lldb_private::RegisterInfo reg_info,
const lldb_private::RegisterValue value 
)
overridevirtual

◆ WriteRegisterValueToRegisterLocation()

bool RegisterContextUnwind::WriteRegisterValueToRegisterLocation ( lldb_private::UnwindLLDB::RegisterLocation  regloc,
const lldb_private::RegisterInfo reg_info,
const lldb_private::RegisterValue value 
)
private

Friends And Related Function Documentation

◆ UnwindLLDB

friend class UnwindLLDB
friend

Definition at line 88 of file RegisterContextUnwind.h.

Member Data Documentation

◆ m_afa

lldb::addr_t lldb_private::RegisterContextUnwind::m_afa
private

◆ m_all_registers_available

bool lldb_private::RegisterContextUnwind::m_all_registers_available
private

◆ m_behaves_like_zeroth_frame

bool lldb_private::RegisterContextUnwind::m_behaves_like_zeroth_frame
private

◆ m_cfa

lldb::addr_t lldb_private::RegisterContextUnwind::m_cfa
private

◆ m_current_offset

int lldb_private::RegisterContextUnwind::m_current_offset
private

◆ m_current_offset_backed_up_one

int lldb_private::RegisterContextUnwind::m_current_offset_backed_up_one
private

◆ m_current_pc

lldb_private::Address lldb_private::RegisterContextUnwind::m_current_pc
private

◆ m_fallback_unwind_plan_sp

lldb::UnwindPlanSP lldb_private::RegisterContextUnwind::m_fallback_unwind_plan_sp
private

◆ m_fast_unwind_plan_sp

lldb::UnwindPlanSP lldb_private::RegisterContextUnwind::m_fast_unwind_plan_sp
private

◆ m_frame_number

uint32_t lldb_private::RegisterContextUnwind::m_frame_number
private

◆ m_frame_type

int lldb_private::RegisterContextUnwind::m_frame_type
private

◆ m_full_unwind_plan_sp

lldb::UnwindPlanSP lldb_private::RegisterContextUnwind::m_full_unwind_plan_sp
private

◆ m_parent_unwind

lldb_private::UnwindLLDB& lldb_private::RegisterContextUnwind::m_parent_unwind
private

◆ m_registers

std::map<uint32_t, lldb_private::UnwindLLDB::RegisterLocation> lldb_private::RegisterContextUnwind::m_registers
private

◆ m_start_pc

lldb_private::Address lldb_private::RegisterContextUnwind::m_start_pc
private

◆ m_sym_ctx

lldb_private::SymbolContext& lldb_private::RegisterContextUnwind::m_sym_ctx
private

◆ m_sym_ctx_valid

bool lldb_private::RegisterContextUnwind::m_sym_ctx_valid
private

◆ m_thread

lldb_private::Thread& lldb_private::RegisterContextUnwind::m_thread
private

The documentation for this class was generated from the following files: