Go to the documentation of this file.
9 #ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
10 #define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
15 #include <unordered_set>
17 #include "llvm/Support/Casting.h"
32 class TypeSystemClang;
33 class UtilityFunction;
68 if (class_name && *class_name)
70 (
LazyBool)(strstr(class_name,
"NSKVONotifying_") == class_name);
80 if (class_name && *class_name)
82 strcmp(class_name,
"NSCFType") == 0);
95 uint64_t *value_bits =
nullptr,
96 uint64_t *payload =
nullptr) = 0;
99 int64_t *value_bits =
nullptr,
100 uint64_t *payload =
nullptr) = 0;
115 std::function<
bool(
const char *,
const char *)>
const
116 &instance_method_func,
117 std::function<
bool(
const char *,
const char *)>
const
119 std::function<
bool(
const char *,
const char *,
lldb::addr_t,
120 uint64_t)>
const &ivar_func)
const {
143 bool allow_NULLs =
false,
bool allow_tagged =
false,
144 bool check_version_specific =
false)
const;
157 bool for_expression) = 0;
181 static lldb::BreakpointPreconditionSP
206 bool isA(
const void *ClassID)
const override {
211 return runtime->
isA(&
ID);
215 return llvm::cast_or_null<ObjCLanguageRuntime>(
251 llvm::StringRef sel_str);
262 lldb::TypeSP type_sp);
271 virtual llvm::Expected<std::unique_ptr<UtilityFunction>>
299 const char *ivar_name);
317 uint64_t &size)
override;
342 const char *class_name);
444 return (
size_t)arg.GetCString();
449 return arg1.operator==(arg2);
452 typedef std::unordered_set<
ConstString, ConstStringSetHelpers,
453 ConstStringSetHelpers>
459 friend class ::CommandObjectObjC_ClassTable_Dump;
461 std::pair<ISAToDescriptorIterator, ISAToDescriptorIterator>
472 #endif // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
ObjCLanguageRuntime(Process *process)
virtual ~ClassDescriptor()=default
virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name)
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
bool operator()(ConstString arg1, ConstString arg2) const
ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value)
CompleteClassMap m_complete_class_cache
lldb::LanguageType GetLanguageType() const override
virtual TaggedPointerVendor * GetTaggedPointerVendor()
ISAToDescriptorIterator GetDescriptorIterator(ConstString name)
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp)=0
ObjCExceptionPrecondition()
virtual ClassDescriptorSP GetMetaclass() const =0
static int Compare(ConstString lhs, ConstString rhs, const bool case_sensitive=true)
Compare two string objects.
virtual ClassDescriptorSP GetClassDescriptorFromClassName(ConstString class_name)
static ObjCLanguageRuntime * Get(Process &process)
std::unordered_set< ConstString, ConstStringSetHelpers, ConstStringSetHelpers > CompleteClassSet
virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa)
HashToISAMap::iterator HashToISAIterator
std::shared_ptr< EncodingToType > EncodingToTypeSP
~ObjCLanguageRuntime() override
std::unique_ptr< TypeSystemClang > m_scratch_ast_ctx_up
bool operator<(const ClassAndSel &rhs) const
bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size, bool allow_NULLs=false, bool allow_tagged=false, bool check_version_specific=false) const
LanguageType
Programming language type.
virtual ObjCISA GetISA(ConstString name)
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition(lldb::LanguageType language, bool throw_bp)
MsgImplStrMap m_impl_str_cache
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool GetTypeBitSize(const CompilerType &compiler_type, uint64_t &size) override
virtual iVarDescriptor GetIVarAtIndex(size_t idx)
bool operator<(const ClassAndSelStr &rhs) const
virtual bool isA(const void *ClassID) const
virtual ClassDescriptorSP GetSuperclass()=0
virtual ObjCISA GetParentClass(ObjCISA isa)
HashToISAMap m_hash_to_isa_map
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp, uint32_t class_name_hash)
Status ConfigurePrecondition(Args &args) override
lldb::TypeSP LookupInCompleteClassCache(ConstString &name)
virtual ~TaggedPointerVendor()=default
llvm::Optional< CompilerType > GetRuntimeType(CompilerType base_type) override
virtual uint64_t GetInstanceSize()=0
virtual bool Describe(std::function< void(ObjCISA)> const &superclass_func, std::function< bool(const char *, const char *)> const &instance_method_func, std::function< bool(const char *, const char *)> const &class_method_func, std::function< bool(const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func) const
void UpdateISAToDescriptorMap()
void GetDescription(Stream &stream, lldb::DescriptionLevel level) override
std::unordered_set< std::string > m_class_names
bool isA(const void *ClassID) const override
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
virtual ~EncodingToType()
LazyBool m_has_new_literals_and_indexing
std::pair< ISAToDescriptorIterator, ISAToDescriptorIterator > GetDescriptorIteratorPair(bool update_if_needed=true)
bool EvaluatePrecondition(StoppointCallbackContext &context) override
TaggedPointerVendor()=default
bool HasNewLiteralsAndIndexing()
bool IsAllowedRuntimeValue(ConstString name) override
Check whether the name is "self" or "_cmd" and should show up in "frame variable".
virtual bool CalculateHasNewLiteralsAndIndexing()
TypeAndOrName LookupInClassNameCache(lldb::addr_t class_addr)
ThreadSafeDenseMap< void *, uint64_t > TypeSizeCache
std::map< ObjCISA, ClassDescriptorSP > ISAToDescriptorMap
void ReadObjCLibraryIfNeeded(const ModuleList &module_list)
virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp)=0
virtual ObjCRuntimeVersions GetRuntimeVersion() const
CompleteClassSet m_negative_complete_class_cache
virtual size_t GetNumIVars()
@ eLanguageTypeObjC
Objective-C.
string(SUBSTRING ${p} 10 -1 pStripped) if($
bool ISAIsCached(ObjCISA isa) const
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
ISAToDescriptorMap m_isa_to_descriptor
uint32_t m_isa_to_descriptor_stop_id
virtual void UpdateISAToDescriptorMapIfNeeded()=0
virtual CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name, bool for_expression)=0
virtual ObjCISA GetISA()=0
virtual EncodingToTypeSP GetEncodingToType()
const TaggedPointerVendor & operator=(const TaggedPointerVendor &)=delete
void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr)
bool operator==(const ClassAndSelStr &rhs)
virtual ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr)=0
bool operator==(const ClassAndSel &rhs)
const ObjCLanguageRuntime & operator=(const ObjCLanguageRuntime &)=delete
ISAToDescriptorMap::iterator ISAToDescriptorIterator
virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr)=0
virtual ConstString GetClassName()=0
bool IsValidISA(ObjCISA isa)
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
std::multimap< uint32_t, ObjCISA > HashToISAMap
virtual bool GetTaggedPointerInfo(uint64_t *info_bits=nullptr, uint64_t *value_bits=nullptr, uint64_t *payload=nullptr)=0
There are two routines in the ObjC runtime that tagged pointer clients can call to get the value from...
#define LLDB_INVALID_ADDRESS
Generic representation of a type in a programming language.
std::map< ClassAndSelStr, lldb::addr_t > MsgImplStrMap
virtual llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker(std::string name, ExecutionContext &exe_ctx)=0
static bool classof(const LanguageRuntime *runtime)
~ObjCExceptionPrecondition() override=default
void SetType(const lldb::TypeSP &type_sp)
ClassAndSelStr(lldb::addr_t in_class_addr, llvm::StringRef in_sel_name)
A class that represents a running process on the host machine.
TypeSizeCache m_type_size_cache
A TypeSystem implementation based on Clang.
size_t operator()(ConstString arg) const
std::map< ConstString, lldb::TypeWP > CompleteClassMap
void SymbolsDidLoad(const ModuleList &module_list) override
void AddClassName(const char *class_name)
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
std::map< ClassAndSel, lldb::addr_t > MsgImplMap
void AddToClassNameCache(lldb::addr_t class_addr, const char *name, lldb::TypeSP type_sp)
uint32_t GetStopID() const
virtual bool HasReadObjCLibrary()=0
lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel)
virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
ClassAndSel(lldb::addr_t in_class_addr, lldb::addr_t in_sel_addr)
virtual bool GetTaggedPointerInfoSigned(uint64_t *info_bits=nullptr, int64_t *value_bits=nullptr, uint64_t *payload=nullptr)=0