LLDB mainline
lldb_private::AppleObjCRuntime Class Reference

#include <AppleObjCRuntime.h>

Inheritance diagram for lldb_private::AppleObjCRuntime:
[legend]

Public Member Functions

 ~AppleObjCRuntime () override
bool isA (const void *ClassID) const override
llvm::Error GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) override
llvm::Error GetObjectDescription (Stream &str, ValueObject &object) override
bool CouldHaveDynamicValue (ValueObject &in_value) override
bool GetDynamicTypeAndAddress (ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type, llvm::ArrayRef< uint8_t > &local_buffer) override
 This call should return true if it could set the name and/or the type Sets address to the address of the dynamic type if value_type is set to a file or load address.
TypeAndOrName FixUpDynamicType (const TypeAndOrName &type_and_or_name, ValueObject &static_value) override
bool IsModuleObjCLibrary (const lldb::ModuleSP &module_sp) override
bool ReadObjCLibrary (const lldb::ModuleSP &module_sp) override
bool HasReadObjCLibrary () override
lldb::ThreadPlanSP GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) override
lldb::ModuleSP GetObjCModule ()
void ModulesDidLoad (const ModuleList &module_list) override
 Called when modules have been loaded in the process.
void SetExceptionBreakpoints () override
void ClearExceptionBreakpoints () override
bool ExceptionBreakpointsAreSet () override
bool ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) override
lldb::SearchFilterSP CreateExceptionSearchFilter () override
lldb::ValueObjectSP GetExceptionObjectForThread (lldb::ThreadSP thread_sp) override
lldb::ThreadSP GetBacktraceThreadFromException (lldb::ValueObjectSP thread_sp) override
uint32_t GetFoundationVersion ()
virtual void GetValuesForGlobalCFBooleans (lldb::addr_t &cf_true, lldb::addr_t &cf_false)
virtual bool IsTaggedPointer (lldb::addr_t addr)
Public Member Functions inherited from lldb_private::ObjCLanguageRuntime
 ~ObjCLanguageRuntime () override
bool isA (const void *ClassID) const override
virtual TaggedPointerVendor * GetTaggedPointerVendor ()
bool IsTaggedPointerValue (ValueObject &in_value)
virtual EncodingToTypeSP GetEncodingToType ()
virtual ClassDescriptorSP GetClassDescriptor (ValueObject &in_value)
ClassDescriptorSP GetNonKVOClassDescriptor (ValueObject &in_value)
virtual ClassDescriptorSP GetClassDescriptorFromClassName (ConstString class_name)
virtual ClassDescriptorSP GetClassDescriptorFromISA (ObjCISA isa)
ClassDescriptorSP GetNonKVOClassDescriptor (ObjCISA isa)
lldb::LanguageType GetLanguageType () const override
lldb::addr_t LookupInMethodCache (lldb::addr_t class_addr, lldb::addr_t sel)
lldb::addr_t LookupInMethodCache (lldb::addr_t class_addr, llvm::StringRef sel_str)
void AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr)
void AddToMethodCache (lldb::addr_t class_addr, llvm::StringRef sel_str, lldb::addr_t impl_addr)
TypeAndOrName LookupInClassNameCache (lldb::addr_t class_addr)
void AddToClassNameCache (lldb::addr_t class_addr, const char *name, lldb::TypeSP type_sp)
void AddToClassNameCache (lldb::addr_t class_addr, const TypeAndOrName &class_or_type_name)
lldb::TypeSP LookupInCompleteClassCache (ConstString &name)
std::optional< CompilerType > GetRuntimeType (CompilerType base_type) override
virtual llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker (std::string name, ExecutionContext &exe_ctx)=0
virtual ObjCRuntimeVersions GetRuntimeVersion () const
bool IsValidISA (ObjCISA isa)
virtual void UpdateISAToDescriptorMapIfNeeded ()=0
void UpdateISAToDescriptorMap ()
virtual ObjCISA GetISA (ConstString name)
virtual ObjCISA GetParentClass (ObjCISA isa)
virtual ObjCISA GetPointerISA (ObjCISA isa)
virtual size_t GetByteOffsetForIvar (CompilerType &parent_qual_type, const char *ivar_name)
bool HasNewLiteralsAndIndexing ()
void SymbolsDidLoad (const ModuleList &module_list) override
std::optional< uint64_t > GetTypeBitSize (const CompilerType &compiler_type) override
bool IsAllowedRuntimeValue (llvm::StringRef name) override
 Check whether the name is "self" or "_cmd" and should show up in "frame variable".
Public Member Functions inherited from lldb_private::LanguageRuntime
virtual LanguageRuntime * GetPreferredLanguageRuntime (ValueObject &in_value)
 Return the preferred language runtime instance, which in most cases will be the current instance.
virtual bool IsPreferredLanguageRuntimeFor (ValueObject &in_value)
 Returns whether this runtime is the preferred runtime for in_value, an object of another language, for example because code in this runtime's language uses it.
virtual llvm::Expected< VTableInfo > GetVTableInfo (ValueObject &in_value, bool check_type)
 Get the vtable information for a given value.
virtual CompilerType GetConcreteType (ExecutionContextScope *exe_scope, llvm::StringRef abstract_type_name)
virtual llvm::Expected< lldb::addr_t > FixupPointerValue (lldb::addr_t pointer, CompilerType type)
 Returns the address of the instance that pointer refers to, where pointer is the value of an object of type, whose instances are pointers (see eTypeInstanceIsPointer).
virtual llvm::Error FixupVariableLocation (Variable &variable, Value &value)
 This allows a language runtime to adjust the location of variable computed from its debug info, for storage whose indirection is only known at runtime.
virtual std::optional< Value > EvaluateEntryValue (StackFrame &frame, llvm::ArrayRef< uint8_t > entry_value, llvm::ArrayRef< uint8_t > &following)
 This allows a language runtime to evaluate DW_OP_entry_value(entry_value) in frame without call site information from the caller, when the runtime knows the value the register had on entry.
virtual lldb::BreakpointSP CreateErrorBackstopBreakpoint ()
 Create a breakpoint that catches an error escaping an expression that runs as top-level code, such as a REPL line, where no handler encloses it.
virtual lldb::ValueObjectSP GetErrorValueAtBackstop (StackFrame &frame)
 Return the error value that reached the breakpoint from CreateErrorBackstopBreakpoint, with frame stopped there.
virtual std::optional< Value > GetThrownErrorLocation (StackFrame &frame)
 Given a frame, compute the location where its function would place an error, if one is thrown by the function.
virtual std::optional< lldb::ValueObjectSP > GetThrownError (StackFrame &frame, const Value &location)
 Given frame, the frame a callee returned to, and location, computed by GetThrownErrorLocation from the callee's frame, get the error the callee threw.
virtual DeclVendor * GetDeclVendor ()
virtual lldb::BreakpointResolverSP CreateExceptionResolver (const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp)=0
void ModulesDidLoad (const ModuleList &module_list) override
 Called when modules have been loaded in the process.
virtual bool GetIRPasses (LLVMUserExpression::IRPasses &custom_passes)
virtual bool IsSymbolARuntimeThunk (const Symbol &symbol)
virtual lldb::addr_t LookupRuntimeSymbol (llvm::StringRef name)
virtual StructuredData::ObjectSP GetLanguageSpecificData (SymbolContext sc)
 Language runtime plugins can use this API to report language-specific runtime information about this compile unit, such as additional language version details or feature flags.
Public Member Functions inherited from lldb_private::Runtime
 Runtime (Process *process)
virtual ~Runtime ()=default
 Runtime (const Runtime &)=delete
const Runtime & operator= (const Runtime &)=delete
Process * GetProcess ()
Target & GetTargetRef ()
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
virtual llvm::StringRef GetPluginName ()=0
 PluginInterface (const PluginInterface &)=delete
PluginInterface & operator= (const PluginInterface &)=delete

Static Public Member Functions

static void Initialize ()
static void Terminate ()
static bool classof (const LanguageRuntime *runtime)
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation ()
Static Public Member Functions inherited from lldb_private::ObjCLanguageRuntime
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition (lldb::LanguageType language, bool throw_bp)
static bool classof (const LanguageRuntime *runtime)
static ObjCLanguageRuntime * Get (Process &process)
static bool IsSupportedForArchitecture (const ArchSpec &arch)
 Returns whether the architecture's object file format supports Objective-C code generation.
Static Public Member Functions inherited from lldb_private::LanguageRuntime
static LanguageRuntime * FindPlugin (Process *process, lldb::LanguageType language)
static void InitializeCommands (CommandObject *parent)
static lldb::BreakpointSP CreateExceptionBreakpoint (Target &target, lldb::LanguageType language, bool catch_bp, bool throw_bp, bool is_internal=false)
static lldb::BreakpointPreconditionSP GetExceptionPrecondition (lldb::LanguageType language, bool throw_bp)
static lldb::UnwindPlanSP GetRuntimeUnwindPlan (lldb_private::Thread &thread, lldb_private::RegisterContext *regctx, bool &behaves_like_zeroth_frame)
 A language runtime may be able to provide a special UnwindPlan for the frame represented by the register contents regctx when that frame is not following the normal ABI conventions.
static CFAComparison CompareCFAs (Process &process, const StackID &lhs, const StackID &rhs)
 Compares the frames identified by lhs and rhs, if a language runtime of process can order them.

Static Public Attributes

static char ID = 0
Static Public Attributes inherited from lldb_private::ObjCLanguageRuntime
static char ID = 0
Static Public Attributes inherited from lldb_private::LanguageRuntime
static char ID = 0

Protected Member Functions

 AppleObjCRuntime (Process *process)
bool CalculateHasNewLiteralsAndIndexing () override
void ReadObjCLibraryIfNeeded (const ModuleList &module_list)
Address * GetPrintForDebuggerAddr ()
Protected Member Functions inherited from lldb_private::ObjCLanguageRuntime
 ObjCLanguageRuntime (Process *process)
bool ISAIsCached (ObjCISA isa) const
bool AddClass (ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
bool AddClass (ObjCISA isa, const ClassDescriptorSP &descriptor_sp, const char *class_name)
bool AddClass (ObjCISA isa, const ClassDescriptorSP &descriptor_sp, uint32_t class_name_hash)
ISAToDescriptorIterator GetDescriptorIterator (ConstString name)
std::pair< ISAToDescriptorIterator, ISAToDescriptorIterator > GetDescriptorIteratorPair (bool update_if_needed=true)
void ReadObjCLibraryIfNeeded (const ModuleList &module_list)
 ObjCLanguageRuntime (const ObjCLanguageRuntime &)=delete
const ObjCLanguageRuntime & operator= (const ObjCLanguageRuntime &)=delete
Protected Member Functions inherited from lldb_private::LanguageRuntime
virtual lldb::UnwindPlanSP GetRuntimeUnwindPlan (lldb::ProcessSP process_sp, lldb_private::RegisterContext *regctx, bool &behaves_like_zeroth_frame)
virtual CFAComparison CompareCFAs (const StackID &lhs, const StackID &rhs)
 LanguageRuntime (Process *process)

Static Protected Member Functions

static bool AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp)
static ObjCRuntimeVersions GetObjCVersion (Process *process, lldb::ModuleSP &objc_module_sp)

Protected Attributes

std::unique_ptr< Address > m_PrintForDebugger_addr
bool m_read_objc_library
std::unique_ptr< lldb_private::AppleObjCTrampolineHandler > m_objc_trampoline_handler_up
lldb::BreakpointSP m_objc_exception_bp_sp
lldb::ModuleWP m_objc_module_wp
std::unique_ptr< FunctionCaller > m_print_object_caller_up
std::optional< uint32_t > m_Foundation_major
Protected Attributes inherited from lldb_private::ObjCLanguageRuntime
uint32_t m_isa_to_descriptor_stop_id
CompleteClassMap m_complete_class_cache
CompleteClassSet m_negative_complete_class_cache
Protected Attributes inherited from lldb_private::Runtime
Process * m_process

Additional Inherited Members

Public Types inherited from lldb_private::ObjCLanguageRuntime
enum class  ObjCRuntimeVersions { eObjC_VersionUnknown = 0 , eAppleObjC_V1 = 1 , eAppleObjC_V2 = 2 , eGNUstep_libobjc2 = 3 }
typedef lldb::addr_t ObjCISA
typedef std::shared_ptr< ClassDescriptor > ClassDescriptorSP
typedef std::shared_ptr< EncodingToType > EncodingToTypeSP
Protected Types inherited from lldb_private::ObjCLanguageRuntime
typedef std::map< ConstString, lldb::TypeWP > CompleteClassMap
typedef std::unordered_set< ConstString, ConstStringSetHelpers, ConstStringSetHelpers > CompleteClassSet

Detailed Description

Definition at line 23 of file AppleObjCRuntime.h.

Constructor & Destructor Documentation

◆ ~AppleObjCRuntime()

AppleObjCRuntime::~AppleObjCRuntime ( )
overridedefault

◆ AppleObjCRuntime()

Member Function Documentation

◆ AppleIsModuleObjCLibrary()

bool AppleObjCRuntime::AppleIsModuleObjCLibrary ( const lldb::ModuleSP & module_sp)
staticprotected

◆ CalculateHasNewLiteralsAndIndexing()

bool AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing ( )
overrideprotectedvirtual

◆ classof()

bool lldb_private::AppleObjCRuntime::classof ( const LanguageRuntime * runtime)
inlinestatic

Definition at line 42 of file AppleObjCRuntime.h.

References ID, and lldb_private::LanguageRuntime::isA().

◆ ClearExceptionBreakpoints()

void AppleObjCRuntime::ClearExceptionBreakpoints ( )
overridevirtual

Reimplemented from lldb_private::LanguageRuntime.

Definition at line 428 of file AppleObjCRuntime.cpp.

References m_objc_exception_bp_sp, and lldb_private::Runtime::m_process.

◆ CouldHaveDynamicValue()

bool AppleObjCRuntime::CouldHaveDynamicValue ( ValueObject & in_value)
overridevirtual

◆ CreateExceptionSearchFilter()

◆ ExceptionBreakpointsAreSet()

bool AppleObjCRuntime::ExceptionBreakpointsAreSet ( )
overridevirtual

Reimplemented from lldb_private::LanguageRuntime.

Definition at line 437 of file AppleObjCRuntime.cpp.

References m_objc_exception_bp_sp.

◆ ExceptionBreakpointsExplainStop()

bool AppleObjCRuntime::ExceptionBreakpointsExplainStop ( lldb::StopInfoSP stop_reason)
overridevirtual

◆ FixUpDynamicType()

◆ GetBacktraceThreadFromException()

◆ GetDynamicTypeAndAddress()

bool AppleObjCRuntime::GetDynamicTypeAndAddress ( ValueObject & in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName & class_type_or_name,
Address & address,
Value::ValueType & value_type,
llvm::ArrayRef< uint8_t > & local_buffer )
overridevirtual

This call should return true if it could set the name and/or the type Sets address to the address of the dynamic type if value_type is set to a file or load address.

Sets local_buffer to a buffer containing the data of the dynamic type if value_type is set to a host address. Callers should copy local_buffer over into their own buffer if they want to keep the data alive.

Implements lldb_private::LanguageRuntime.

Reimplemented in lldb_private::AppleObjCRuntimeV2.

Definition at line 271 of file AppleObjCRuntime.cpp.

◆ GetExceptionObjectForThread()

ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread ( lldb::ThreadSP thread_sp)
overridevirtual

◆ GetExceptionThrowLocation()

std::tuple< FileSpec, ConstString > AppleObjCRuntime::GetExceptionThrowLocation ( )
static

◆ GetFoundationVersion()

◆ GetObjCModule()

◆ GetObjCVersion()

◆ GetObjectDescription() [1/2]

llvm::Error AppleObjCRuntime::GetObjectDescription ( Stream & str,
Value & value,
ExecutionContextScope * exe_scope )
overridevirtual

Implements lldb_private::LanguageRuntime.

Definition at line 97 of file AppleObjCRuntime.cpp.

References lldb_private::ExecutionContextScope::CalculateExecutionContext(), lldb_private::ExecutionContextScope::CalculateTarget(), DoNoSelectMostRelevantFrame, lldb::eBasicTypeObjCID, lldb::eBasicTypeVoid, lldb::eExpressionCompleted, lldb::eLanguageTypeObjC, error(), lldb_private::Value::GetCompilerType(), lldb_private::ScratchTypeSystemClang::GetForTarget(), lldb_private::ExecutionContext::GetFramePtr(), GetPrintForDebuggerAddr(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::Value::GetScalar(), lldb_private::ThreadList::GetSelectedThread(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::Process::GetThreadList(), lldb_private::ExecutionContext::GetThreadPtr(), lldb_private::ProcessProperties::GetUtilityExpressionTimeout(), lldb_private::TypeSystemClang::IsObjCObjectPointerType(), LLDB_INVALID_ADDRESS, m_print_object_caller_up, lldb_private::Runtime::m_process, m_read_objc_library, lldb_private::ValueList::PushValue(), lldb_private::Process::ReadCStringFromMemory(), lldb_private::Value::SetCompilerType(), lldb_private::ExecutionContext::SetFrameSP(), lldb_private::EvaluateExpressionOptions::SetIgnoreBreakpoints(), lldb_private::EvaluateExpressionOptions::SetIsForUtilityExpr(), lldb_private::EvaluateExpressionOptions::SetStopOthers(), lldb_private::ExecutionContext::SetThreadSP(), lldb_private::EvaluateExpressionOptions::SetTimeout(), lldb_private::EvaluateExpressionOptions::SetTryAllThreads(), lldb_private::EvaluateExpressionOptions::SetUnwindOnError(), lldb_private::toString(), lldb_private::Scalar::ULongLong(), and lldb_private::Stream::Write().

Referenced by GetObjectDescription().

◆ GetObjectDescription() [2/2]

◆ GetPrintForDebuggerAddr()

◆ GetStepThroughTrampolinePlan()

ThreadPlanSP AppleObjCRuntime::GetStepThroughTrampolinePlan ( Thread & thread,
bool stop_others )
overridevirtual

Implements lldb_private::LanguageRuntime.

Definition at line 362 of file AppleObjCRuntime.cpp.

References m_objc_trampoline_handler_up.

◆ GetValuesForGlobalCFBooleans()

void AppleObjCRuntime::GetValuesForGlobalCFBooleans ( lldb::addr_t & cf_true,
lldb::addr_t & cf_false )
virtual

Reimplemented in lldb_private::AppleObjCRuntimeV2.

Definition at line 340 of file AppleObjCRuntime.cpp.

References LLDB_INVALID_ADDRESS.

◆ HasReadObjCLibrary()

bool lldb_private::AppleObjCRuntime::HasReadObjCLibrary ( )
inlineoverridevirtual

Implements lldb_private::ObjCLanguageRuntime.

Definition at line 69 of file AppleObjCRuntime.h.

References m_read_objc_library.

Referenced by ReadObjCLibraryIfNeeded().

◆ Initialize()

void AppleObjCRuntime::Initialize ( )
static

◆ isA()

bool lldb_private::AppleObjCRuntime::isA ( const void * ClassID) const
inlineoverridevirtual

◆ IsModuleObjCLibrary()

bool AppleObjCRuntime::IsModuleObjCLibrary ( const lldb::ModuleSP & module_sp)
overridevirtual

Implements lldb_private::ObjCLanguageRuntime.

Definition at line 345 of file AppleObjCRuntime.cpp.

References AppleIsModuleObjCLibrary().

Referenced by ReadObjCLibraryIfNeeded().

◆ IsTaggedPointer()

virtual bool lldb_private::AppleObjCRuntime::IsTaggedPointer ( lldb::addr_t addr)
inlinevirtual

Reimplemented in lldb_private::AppleObjCRuntimeV2.

Definition at line 105 of file AppleObjCRuntime.h.

◆ ModulesDidLoad()

void AppleObjCRuntime::ModulesDidLoad ( const ModuleList & module_list)
overridevirtual

Called when modules have been loaded in the process.

Implements lldb_private::Runtime.

Reimplemented in lldb_private::AppleObjCRuntimeV2.

Definition at line 626 of file AppleObjCRuntime.cpp.

References ReadObjCLibraryIfNeeded().

◆ ReadObjCLibrary()

bool AppleObjCRuntime::ReadObjCLibrary ( const lldb::ModuleSP & module_sp)
overridevirtual

◆ ReadObjCLibraryIfNeeded()

void AppleObjCRuntime::ReadObjCLibraryIfNeeded ( const ModuleList & module_list)
protected

◆ SetExceptionBreakpoints()

◆ Terminate()

void AppleObjCRuntime::Terminate ( )
static

Member Data Documentation

◆ ID

char AppleObjCRuntime::ID = 0
static

Definition at line 32 of file AppleObjCRuntime.h.

Referenced by classof(), and isA().

◆ m_Foundation_major

std::optional<uint32_t> lldb_private::AppleObjCRuntime::m_Foundation_major
protected

Definition at line 130 of file AppleObjCRuntime.h.

Referenced by AppleObjCRuntime(), and GetFoundationVersion().

◆ m_objc_exception_bp_sp

lldb::BreakpointSP lldb_private::AppleObjCRuntime::m_objc_exception_bp_sp
protected

◆ m_objc_module_wp

lldb::ModuleWP lldb_private::AppleObjCRuntime::m_objc_module_wp
protected

Definition at line 127 of file AppleObjCRuntime.h.

Referenced by GetObjCModule().

◆ m_objc_trampoline_handler_up

std::unique_ptr<lldb_private::AppleObjCTrampolineHandler> lldb_private::AppleObjCRuntime::m_objc_trampoline_handler_up
protected

◆ m_print_object_caller_up

std::unique_ptr<FunctionCaller> lldb_private::AppleObjCRuntime::m_print_object_caller_up
protected

Definition at line 128 of file AppleObjCRuntime.h.

Referenced by GetObjectDescription().

◆ m_PrintForDebugger_addr

std::unique_ptr<Address> lldb_private::AppleObjCRuntime::m_PrintForDebugger_addr
protected

Definition at line 122 of file AppleObjCRuntime.h.

Referenced by GetPrintForDebuggerAddr().

◆ m_read_objc_library

bool lldb_private::AppleObjCRuntime::m_read_objc_library
protected

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