9#ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_OBJCLANGUAGERUNTIME_H
16#include <unordered_set>
18#include "llvm/Support/Casting.h"
71 if (class_name && *class_name)
73 (
LazyBool)(strstr(class_name,
"NSKVONotifying_") == class_name);
83 if (class_name && *class_name)
85 strcmp(class_name,
"NSCFType") == 0);
103 uint64_t *value_bits =
nullptr,
104 uint64_t *payload =
nullptr) = 0;
107 int64_t *value_bits =
nullptr,
108 uint64_t *payload =
nullptr) = 0;
123 std::function<
bool(
const char *,
const char *)>
const
124 &instance_method_func,
125 std::function<
bool(
const char *,
const char *)>
const
127 std::function<
bool(
const char *,
const char *,
lldb::addr_t,
128 uint64_t)>
const &ivar_func)
const {
151 bool allow_NULLs =
false,
bool allow_tagged =
false,
152 bool check_version_specific =
false)
const;
165 bool for_expression) = 0;
214 bool isA(
const void *ClassID)
const override {
219 return runtime->
isA(&
ID);
223 return llvm::cast_or_null<ObjCLanguageRuntime>(
259 llvm::StringRef sel_str);
279 virtual llvm::Expected<std::unique_ptr<UtilityFunction>>
307 const char *ivar_name);
324 std::optional<uint64_t>
350 const char *class_name);
353 uint32_t class_name_hash) {
452 return (
size_t)arg.GetCString();
457 return arg1.operator==(arg2);
460 typedef std::unordered_set<
ConstString, ConstStringSetHelpers,
461 ConstStringSetHelpers>
467 friend class ::CommandObjectObjC_ClassTable_Dump;
469 std::pair<ISAToDescriptorIterator, ISAToDescriptorIterator>
A command line argument class.
Generic representation of a type in a programming language.
A uniqued constant string class.
static int Compare(ConstString lhs, ConstString rhs, const bool case_sensitive=true)
Compare two string objects.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
virtual bool isA(const void *ClassID) const
A collection class for Module objects.
virtual bool GetTaggedPointerInfoSigned(uint64_t *info_bits=nullptr, int64_t *value_bits=nullptr, uint64_t *payload=nullptr)=0
void SetType(const lldb::TypeSP &type_sp)
virtual ClassDescriptorSP GetSuperclass()=0
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...
virtual size_t GetNumIVars()
virtual ClassDescriptorSP GetMetaclass() const =0
bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size, bool allow_NULLs=false, bool allow_tagged=false, bool check_version_specific=false) const
virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const
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
virtual ObjCISA GetISA()=0
virtual iVarDescriptor GetIVarAtIndex(size_t idx)
virtual uint64_t GetInstanceSize()=0
virtual lldb::LanguageType GetImplementationLanguage() const
Determine whether this class is implemented in Swift.
virtual ConstString GetClassName()=0
virtual ~ClassDescriptor()=default
virtual CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name, bool for_expression)=0
virtual ~EncodingToType()
std::shared_ptr< TypeSystemClang > m_scratch_ast_ctx_sp
std::unordered_set< std::string > m_class_names
Status ConfigurePrecondition(Args &args) override
void GetDescription(Stream &stream, lldb::DescriptionLevel level) override
ObjCExceptionPrecondition()
bool EvaluatePrecondition(StoppointCallbackContext &context) override
~ObjCExceptionPrecondition() override=default
void AddClassName(const char *class_name)
TaggedPointerVendor()=default
virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr)=0
TaggedPointerVendor(const TaggedPointerVendor &)=delete
const TaggedPointerVendor & operator=(const TaggedPointerVendor &)=delete
virtual ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(lldb::addr_t ptr)=0
virtual ~TaggedPointerVendor()=default
virtual bool HasReadObjCLibrary()=0
HashToISAMap::iterator HashToISAIterator
virtual ObjCISA GetISA(ConstString name)
TypeAndOrName LookupInClassNameCache(lldb::addr_t class_addr)
HashToISAMap m_hash_to_isa_map
CompleteClassSet m_negative_complete_class_cache
void AddToClassNameCache(lldb::addr_t class_addr, const char *name, lldb::TypeSP type_sp)
std::multimap< uint32_t, ObjCISA > HashToISAMap
uint32_t m_isa_to_descriptor_stop_id
std::map< ConstString, lldb::TypeWP > CompleteClassMap
virtual EncodingToTypeSP GetEncodingToType()
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
bool IsValidISA(ObjCISA isa)
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp)=0
virtual ObjCRuntimeVersions GetRuntimeVersion() const
ISAToDescriptorMap::iterator ISAToDescriptorIterator
const ObjCLanguageRuntime & operator=(const ObjCLanguageRuntime &)=delete
ThreadSafeDenseMap< void *, uint64_t > TypeSizeCache
std::optional< uint64_t > GetTypeBitSize(const CompilerType &compiler_type) override
std::pair< ISAToDescriptorIterator, ISAToDescriptorIterator > GetDescriptorIteratorPair(bool update_if_needed=true)
virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name)
ISAToDescriptorIterator GetDescriptorIterator(ConstString name)
CompleteClassMap m_complete_class_cache
~ObjCLanguageRuntime() override
bool HasNewLiteralsAndIndexing()
std::unordered_set< ConstString, ConstStringSetHelpers, ConstStringSetHelpers > CompleteClassSet
TypeSizeCache m_type_size_cache
bool isA(const void *ClassID) const override
void AddToClassNameCache(lldb::addr_t class_addr, const TypeAndOrName &class_or_type_name)
lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel)
void UpdateISAToDescriptorMap()
virtual TaggedPointerVendor * GetTaggedPointerVendor()
std::map< ObjCISA, ClassDescriptorSP > ISAToDescriptorMap
std::map< ClassAndSelStr, lldb::addr_t > MsgImplStrMap
lldb::TypeSP LookupInCompleteClassCache(ConstString &name)
static bool classof(const LanguageRuntime *runtime)
virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp)=0
MsgImplStrMap m_impl_str_cache
ClassDescriptorSP GetNonKVOClassDescriptor(ValueObject &in_value)
virtual void UpdateISAToDescriptorMapIfNeeded()=0
std::optional< CompilerType > GetRuntimeType(CompilerType base_type) override
void ReadObjCLibraryIfNeeded(const ModuleList &module_list)
virtual ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa)
LazyBool m_has_new_literals_and_indexing
ObjCLanguageRuntime(const ObjCLanguageRuntime &)=delete
virtual bool CalculateHasNewLiteralsAndIndexing()
void SymbolsDidLoad(const ModuleList &module_list) override
bool IsAllowedRuntimeValue(ConstString name) override
Check whether the name is "self" or "_cmd" and should show up in "frame variable".
bool ISAIsCached(ObjCISA isa) const
static ObjCLanguageRuntime * Get(Process &process)
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp, uint32_t class_name_hash)
ISAToDescriptorMap m_isa_to_descriptor
virtual llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker(std::string name, ExecutionContext &exe_ctx)=0
std::map< ClassAndSel, lldb::addr_t > MsgImplMap
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
virtual ClassDescriptorSP GetClassDescriptorFromClassName(ConstString class_name)
void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel, lldb::addr_t impl_addr)
lldb::LanguageType GetLanguageType() const override
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition(lldb::LanguageType language, bool throw_bp)
virtual ObjCISA GetParentClass(ObjCISA isa)
std::shared_ptr< EncodingToType > EncodingToTypeSP
A plug-in interface definition class for debugging a process.
LanguageRuntime * GetLanguageRuntime(lldb::LanguageType language)
uint32_t GetStopID() const
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
A stream class that can stream formatted output to a file.
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
A TypeSystem implementation based on Clang.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
LanguageType
Programming language type.
@ eLanguageTypeObjC
Objective-C.
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::BreakpointPrecondition > BreakpointPreconditionSP
std::weak_ptr< lldb_private::Type > TypeWP
std::shared_ptr< lldb_private::Module > ModuleSP
ClassAndSelStr(lldb::addr_t in_class_addr, llvm::StringRef in_sel_name)
bool operator==(const ClassAndSelStr &rhs)
bool operator<(const ClassAndSelStr &rhs) const
bool operator<(const ClassAndSel &rhs) const
bool operator==(const ClassAndSel &rhs)
ClassAndSel(lldb::addr_t in_class_addr, lldb::addr_t in_sel_addr)
bool operator()(ConstString arg1, ConstString arg2) const
size_t operator()(ConstString arg) const