diff options
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h')
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h | 177 |
1 files changed, 165 insertions, 12 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index 057fa62a9e7..ff94b81dfac 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -27,6 +27,165 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime { public: + + class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor + { + public: + ClassDescriptorV2 (ValueObject &isa_pointer); + ClassDescriptorV2 (ObjCISA isa, lldb::ProcessSP process); + + virtual ConstString + GetClassName () + { + return m_name; + } + + virtual ClassDescriptorSP + GetSuperclass (); + + virtual bool + IsValid () + { + return m_valid; + } + + virtual bool + IsTagged () + { + return false; // we use a special class for tagged descriptors + } + + virtual uint64_t + GetInstanceSize () + { + return m_instance_size; + } + + virtual ObjCISA + GetISA () + { + return m_isa; + } + + virtual + ~ClassDescriptorV2 () + {} + + protected: + virtual bool + CheckPointer (lldb::addr_t value, + uint32_t ptr_size) + { + if (ptr_size != 8) + return true; + return ((value & 0xFFFF800000000000) == 0); + } + + void + Initialize (ObjCISA isa, lldb::ProcessSP process_sp); + + private: + ConstString m_name; + ObjCISA m_isa; + ObjCISA m_parent_isa; + bool m_valid; + lldb::ProcessWP m_process_wp; + uint64_t m_instance_size; + }; + + class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor + { + public: + ClassDescriptorV2Tagged (ValueObject &isa_pointer); + + virtual ConstString + GetClassName () + { + return m_name; + } + + virtual ClassDescriptorSP + GetSuperclass () + { + // tagged pointers can represent a class that has a superclass, but since that information is not + // stored in the object itself, we would have to query the runtime to discover the hierarchy + // for the time being, we skip this step in the interest of static discovery + return ClassDescriptorSP(new ObjCLanguageRuntime::ClassDescriptor_Invalid()); + } + + virtual bool + IsValid () + { + return m_valid; + } + + virtual bool + IsKVO () + { + return false; // tagged pointers are not KVO'ed + } + + virtual bool + IsCFType () + { + return false; // tagged pointers are not CF objects + } + + virtual bool + IsTagged () + { + return true; // we use this class to describe tagged pointers + } + + virtual uint64_t + GetInstanceSize () + { + return (IsValid() ? m_pointer_size : 0); + } + + virtual ObjCISA + GetISA () + { + return 0; // tagged pointers have no ISA + } + + virtual uint64_t + GetClassBits () + { + return (IsValid() ? m_class_bits : 0); + } + + // these calls are not part of any formal tagged pointers specification + virtual uint64_t + GetValueBits () + { + return (IsValid() ? m_value_bits : 0); + } + + virtual uint64_t + GetInfoBits () + { + return (IsValid() ? m_info_bits : 0); + } + + virtual + ~ClassDescriptorV2Tagged () + {} + + protected: + // TODO make this into a smarter OS version detector + LazyBool + IsLion (lldb::TargetSP &target_sp); + + private: + ConstString m_name; + uint8_t m_pointer_size; + bool m_valid; + uint64_t m_class_bits; + uint64_t m_info_bits; + uint64_t m_value_bits; + }; + virtual ~AppleObjCRuntimeV2() { } // These are generic runtime functions: @@ -90,8 +249,11 @@ public: virtual ConstString GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa); - virtual ObjCLanguageRuntime::ObjCISA - GetParentClass(ObjCLanguageRuntime::ObjCISA isa); + virtual ClassDescriptorSP + GetClassDescriptor (ValueObject& in_value); + + virtual ClassDescriptorSP + GetClassDescriptor (ObjCISA isa); virtual SymbolVendor * GetSymbolVendor(); @@ -102,13 +264,7 @@ protected: private: - typedef std::map<ObjCLanguageRuntime::ObjCISA, ConstString> ISAToNameCache; - typedef std::map<ObjCLanguageRuntime::ObjCISA, ObjCLanguageRuntime::ObjCISA> ISAToParentCache; - - typedef ISAToNameCache::iterator ISAToNameIterator; - typedef ISAToParentCache::iterator ISAToParentIterator; - - AppleObjCRuntimeV2 (Process *process, + AppleObjCRuntimeV2 (Process *process, const lldb::ModuleSP &objc_module_sp); bool @@ -122,9 +278,6 @@ private: lldb::addr_t m_get_class_name_args; Mutex m_get_class_name_args_mutex; - ISAToNameCache m_isa_to_name_cache; - ISAToParentCache m_isa_to_parent_cache; - std::auto_ptr<SymbolVendor> m_symbol_vendor_ap; static const char *g_find_class_name_function_name; |