Index: source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -1,4 +1,4 @@ -//===-- ItaniumABILanguageRuntime.h ----------------------------------------*- C++ -*-===// +//===-- ItaniumABILanguageRuntime.h -----------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,6 +12,8 @@ // C Includes // C++ Includes +#include + // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -20,34 +22,14 @@ #include "lldb/Target/CPPLanguageRuntime.h" #include "lldb/Core/Value.h" -#include -#include - namespace lldb_private { class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime { public: - ~ItaniumABILanguageRuntime() { } + ~ItaniumABILanguageRuntime() override = default; - virtual bool - IsVTableName (const char *name); - - virtual bool - GetDynamicTypeAndAddress (ValueObject &in_value, - lldb::DynamicValueType use_dynamic, - TypeAndOrName &class_type_or_name, - Address &address, - Value::ValueType &value_type); - - virtual TypeAndOrName - FixUpDynamicType (const TypeAndOrName& type_and_or_name, - ValueObject& static_value); - - virtual bool - CouldHaveDynamicValue (ValueObject &in_value); - //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -63,38 +45,54 @@ static lldb_private::ConstString GetPluginNameStatic(); - //------------------------------------------------------------------ - // PluginInterface protocol - //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + bool + IsVTableName(const char *name) override; - virtual uint32_t - GetPluginVersion(); + bool + GetDynamicTypeAndAddress(ValueObject &in_value, + lldb::DynamicValueType use_dynamic, + TypeAndOrName &class_type_or_name, + Address &address, + Value::ValueType &value_type) override; - virtual void - SetExceptionBreakpoints (); + TypeAndOrName + FixUpDynamicType(const TypeAndOrName& type_and_or_name, + ValueObject& static_value) override; - virtual void - ClearExceptionBreakpoints (); + bool + CouldHaveDynamicValue(ValueObject &in_value) override; - virtual bool - ExceptionBreakpointsAreSet (); + void + SetExceptionBreakpoints() override; - virtual bool - ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason); + void + ClearExceptionBreakpoints() override; + + bool + ExceptionBreakpointsAreSet() override; + + bool + ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override; - virtual lldb::BreakpointResolverSP - CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp); + lldb::BreakpointResolverSP + CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override; - virtual lldb::SearchFilterSP - CreateExceptionSearchFilter (); + lldb::SearchFilterSP + CreateExceptionSearchFilter() override; - virtual size_t - GetAlternateManglings(const ConstString &mangled, std::vector &alternates); + size_t + GetAlternateManglings(const ConstString &mangled, std::vector &alternates) override; - protected: + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + lldb_private::ConstString + GetPluginName() override; + + uint32_t + GetPluginVersion() override; + protected: lldb::BreakpointResolverSP CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions); @@ -112,4 +110,4 @@ } // namespace lldb_private -#endif // liblldb_ItaniumABILanguageRuntime_h_ +#endif // liblldb_ItaniumABILanguageRuntime_h_ Index: source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h +++ source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h @@ -1,4 +1,4 @@ -//===-- GoLanguageRuntime.h ----------------------------------------*- C++ -*-===// +//===-- GoLanguageRuntime.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -25,8 +25,23 @@ public lldb_private::LanguageRuntime { public: - ~GoLanguageRuntime() { } + ~GoLanguageRuntime() override = default; + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + static void + Initialize(); + + static void + Terminate(); + + static lldb_private::LanguageRuntime * + CreateInstance(Process *process, lldb::LanguageType language); + + static lldb_private::ConstString + GetPluginNameStatic(); + lldb::LanguageType GetLanguageType() const override { @@ -61,21 +76,6 @@ TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override; //------------------------------------------------------------------ - // Static Functions - //------------------------------------------------------------------ - static void - Initialize(); - - static void - Terminate(); - - static lldb_private::LanguageRuntime * - CreateInstance (Process *process, lldb::LanguageType language); - - static lldb_private::ConstString - GetPluginNameStatic(); - - //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ lldb_private::ConstString @@ -90,4 +90,4 @@ } // namespace lldb_private -#endif // liblldb_GoLanguageRuntime_h_ +#endif // liblldb_GoLanguageRuntime_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h @@ -1,4 +1,4 @@ -//===-- AppleObjCClassDescriptorV2.h --------------------------------*- C++ -*-===// +//===-- AppleObjCClassDescriptorV2.h ----------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -13,7 +13,6 @@ // C Includes // C++ Includes // Other libraries and framework includes - // Project includes #include "lldb/lldb-private.h" #include "lldb/Host/Mutex.h" @@ -27,71 +26,57 @@ public: friend class lldb_private::AppleObjCRuntimeV2; -private: - // The constructor should only be invoked by the runtime as it builds its caches - // or populates them. A ClassDescriptorV2 should only ever exist in a cache. - ClassDescriptorV2 (AppleObjCRuntimeV2 &runtime, ObjCLanguageRuntime::ObjCISA isa, const char *name) : - m_runtime (runtime), - m_objc_class_ptr (isa), - m_name (name), - m_ivars_storage() - { - } + ~ClassDescriptorV2() override = default; + + ConstString + GetClassName() override; -public: - virtual ConstString - GetClassName (); + ObjCLanguageRuntime::ClassDescriptorSP + GetSuperclass() override; - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetSuperclass (); + ObjCLanguageRuntime::ClassDescriptorSP + GetMetaclass() const override; - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetMetaclass () const; - - virtual bool - IsValid () + bool + IsValid() override { return true; // any Objective-C v2 runtime class descriptor we vend is valid } // a custom descriptor is used for tagged pointers - virtual bool - GetTaggedPointerInfo (uint64_t* info_bits = NULL, - uint64_t* value_bits = NULL, - uint64_t* payload = NULL) + bool + GetTaggedPointerInfo(uint64_t* info_bits = nullptr, + uint64_t* value_bits = nullptr, + uint64_t* payload = nullptr) override { return false; } - virtual uint64_t - GetInstanceSize (); + uint64_t + GetInstanceSize() override; - virtual ObjCLanguageRuntime::ObjCISA - GetISA () + ObjCLanguageRuntime::ObjCISA + GetISA() override { return m_objc_class_ptr; } - virtual bool - Describe (std::function const &superclass_func, - std::function const &instance_method_func, - std::function const &class_method_func, - std::function const &ivar_func) const; - - virtual - ~ClassDescriptorV2 () + bool + Describe(std::function const &superclass_func, + std::function const &instance_method_func, + std::function const &class_method_func, + std::function const &ivar_func) const override; + + size_t + GetNumIVars() override { - } - - virtual size_t - GetNumIVars () - { GetIVarInformation(); return m_ivars_storage.size(); } - virtual iVarDescriptor - GetIVarAtIndex (size_t idx) + iVarDescriptor + GetIVarAtIndex(size_t idx) override { if (idx >= GetNumIVars()) return iVarDescriptor(); @@ -265,6 +250,16 @@ Mutex m_mutex; }; + // The constructor should only be invoked by the runtime as it builds its caches + // or populates them. A ClassDescriptorV2 should only ever exist in a cache. + ClassDescriptorV2(AppleObjCRuntimeV2 &runtime, ObjCLanguageRuntime::ObjCISA isa, const char *name) : + m_runtime (runtime), + m_objc_class_ptr (isa), + m_name (name), + m_ivars_storage() + { + } + bool Read_objc_class (Process* process, std::unique_ptr &objc_class) const; @@ -316,14 +311,16 @@ m_value_bits = (m_payload & ~0x0FULL) >> 4; } - virtual ConstString - GetClassName () + ~ClassDescriptorV2Tagged() override = default; + + ConstString + GetClassName() override { return m_name; } - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetSuperclass () + ObjCLanguageRuntime::ClassDescriptorSP + GetSuperclass() override { // 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 @@ -331,34 +328,34 @@ return ObjCLanguageRuntime::ClassDescriptorSP(); } - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetMetaclass () const + ObjCLanguageRuntime::ClassDescriptorSP + GetMetaclass() const override { return ObjCLanguageRuntime::ClassDescriptorSP(); } - virtual bool - IsValid () + bool + IsValid() override { return m_valid; } - virtual bool - IsKVO () + bool + IsKVO() override { return false; // tagged pointers are not KVO'ed } - virtual bool - IsCFType () + bool + IsCFType() override { return false; // tagged pointers are not CF objects } - virtual bool - GetTaggedPointerInfo (uint64_t* info_bits = NULL, - uint64_t* value_bits = NULL, - uint64_t* payload = NULL) + bool + GetTaggedPointerInfo(uint64_t* info_bits = nullptr, + uint64_t* value_bits = nullptr, + uint64_t* payload = nullptr) override { if (info_bits) *info_bits = GetInfoBits(); @@ -369,14 +366,14 @@ return true; } - virtual uint64_t - GetInstanceSize () + uint64_t + GetInstanceSize() override { return (IsValid() ? m_pointer_size : 0); } - virtual ObjCLanguageRuntime::ObjCISA - GetISA () + ObjCLanguageRuntime::ObjCISA + GetISA() override { return 0; // tagged pointers have no ISA } @@ -399,11 +396,7 @@ { return (IsValid() ? m_payload : 0); } - - virtual - ~ClassDescriptorV2Tagged () - {} - + private: ConstString m_name; uint8_t m_pointer_size; @@ -411,10 +404,8 @@ uint64_t m_info_bits; uint64_t m_value_bits; uint64_t m_payload; - }; } // namespace lldb_private -#endif // liblldb_AppleObjCRuntime_h_ - +#endif // liblldb_AppleObjCClassDescriptorV2_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h @@ -12,11 +12,7 @@ // C Includes // C++ Includes - -#include - // Other libraries and framework includes - // Project includes #include "lldb/lldb-private.h" #include "lldb/Symbol/ClangASTContext.h" @@ -32,13 +28,14 @@ public: AppleObjCDeclVendor(ObjCLanguageRuntime &runtime); - virtual uint32_t - FindDecls (const ConstString &name, - bool append, - uint32_t max_matches, - std::vector &decls); + uint32_t + FindDecls(const ConstString &name, + bool append, + uint32_t max_matches, + std::vector &decls) override; friend class AppleObjCExternalASTSource; + private: clang::ObjCInterfaceDecl *GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa); bool FinishDecl(clang::ObjCInterfaceDecl *decl); @@ -55,4 +52,4 @@ } // namespace lldb_private -#endif // liblldb_AppleObjCDeclVendor_h_ +#endif // liblldb_AppleObjCDeclVendor_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h @@ -1,4 +1,4 @@ -//===-- AppleObjCRuntime.h ----------------------------------------*- C++ -*-===// +//===-- AppleObjCRuntime.h --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -13,7 +13,6 @@ // C Includes // C++ Includes // Other libraries and framework includes - #include "llvm/ADT/Optional.h" // Project includes @@ -29,6 +28,14 @@ public lldb_private::ObjCLanguageRuntime { public: + ~AppleObjCRuntime() override; + + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + // Note there is no CreateInstance, Initialize & Terminate functions here, because + // you can't make an instance of this generic runtime. + static bool classof(const ObjCLanguageRuntime* runtime) { switch (runtime->GetRuntimeVersion()) @@ -41,8 +48,6 @@ } } - virtual ~AppleObjCRuntime(); - // These are generic runtime functions: bool GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) override; @@ -86,54 +91,45 @@ lldb::ModuleSP GetObjCModule (); - //------------------------------------------------------------------ - // Static Functions - //------------------------------------------------------------------ - // Note there is no CreateInstance, Initialize & Terminate functions here, because - // you can't make an instance of this generic runtime. - - // Sync up with the target void ModulesDidLoad (const ModuleList &module_list) override; -protected: - bool - CalculateHasNewLiteralsAndIndexing() override; - - static bool - AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp); - - static ObjCRuntimeVersions - GetObjCVersion (Process *process, lldb::ModuleSP &objc_module_sp); - void - ReadObjCLibraryIfNeeded (const ModuleList &module_list); - - //------------------------------------------------------------------ - // PluginInterface protocol - //------------------------------------------------------------------ -public: - void SetExceptionBreakpoints() override; void - ClearExceptionBreakpoints () override; + ClearExceptionBreakpoints() override; bool - ExceptionBreakpointsAreSet () override; + ExceptionBreakpointsAreSet() override; bool - ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason) override; + ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override; lldb::SearchFilterSP - CreateExceptionSearchFilter () override; + CreateExceptionSearchFilter() override; uint32_t - GetFoundationVersion (); + GetFoundationVersion(); protected: + // Call CreateInstance instead. + AppleObjCRuntime(Process *process); + + bool + CalculateHasNewLiteralsAndIndexing() override; + + static bool + AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp); + + static ObjCRuntimeVersions + GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp); + + void + ReadObjCLibraryIfNeeded(const ModuleList &module_list); + Address * GetPrintForDebuggerAddr(); @@ -145,11 +141,8 @@ std::unique_ptr m_print_object_caller_up; llvm::Optional m_Foundation_major; - - // Call CreateInstance instead. - AppleObjCRuntime(Process *process); }; } // namespace lldb_private -#endif // liblldb_AppleObjCRuntime_h_ +#endif // liblldb_AppleObjCRuntime_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -1,4 +1,4 @@ -//===-- AppleObjCRuntimeV1.h ----------------------------------------*- C++ -*-===// +//===-- AppleObjCRuntimeV1.h ------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -24,6 +24,23 @@ public AppleObjCRuntime { public: + ~AppleObjCRuntimeV1() override = default; + + //------------------------------------------------------------------ + // Static Functions + //------------------------------------------------------------------ + static void + Initialize(); + + static void + Terminate(); + + static lldb_private::LanguageRuntime * + CreateInstance(Process *process, lldb::LanguageType language); + + static lldb_private::ConstString + GetPluginNameStatic(); + static bool classof(const ObjCLanguageRuntime* runtime) { switch (runtime->GetRuntimeVersion()) @@ -41,55 +58,54 @@ ClassDescriptorV1 (ValueObject &isa_pointer); ClassDescriptorV1 (ObjCISA isa, lldb::ProcessSP process_sp); - virtual ConstString - GetClassName () + ~ClassDescriptorV1() override = default; + + ConstString + GetClassName() override { return m_name; } - virtual ClassDescriptorSP - GetSuperclass (); + ClassDescriptorSP + GetSuperclass() override; - virtual ClassDescriptorSP - GetMetaclass () const; + ClassDescriptorSP + GetMetaclass() const override; - virtual bool - IsValid () + bool + IsValid() override { return m_valid; } // v1 does not support tagged pointers - virtual bool - GetTaggedPointerInfo (uint64_t* info_bits = NULL, - uint64_t* value_bits = NULL, - uint64_t* payload = NULL) + bool + GetTaggedPointerInfo(uint64_t* info_bits = nullptr, + uint64_t* value_bits = nullptr, + uint64_t* payload = nullptr) override { return false; } - virtual uint64_t - GetInstanceSize () + uint64_t + GetInstanceSize() override { return m_instance_size; } - virtual ObjCISA - GetISA () + ObjCISA + GetISA() override { return m_isa; } - virtual bool - Describe (std::function const &superclass_func, - std::function const &instance_method_func, - std::function const &class_method_func, - std::function const &ivar_func) const; - - virtual - ~ClassDescriptorV1 () - {} - + bool + Describe(std::function const &superclass_func, + std::function const &instance_method_func, + std::function const &class_method_func, + std::function const &ivar_func) const override; + protected: void Initialize (ObjCISA isa, lldb::ProcessSP process_sp); @@ -102,61 +118,43 @@ lldb::ProcessWP m_process_wp; uint64_t m_instance_size; }; - - virtual ~AppleObjCRuntimeV1() { } - + // These are generic runtime functions: - virtual bool - GetDynamicTypeAndAddress (ValueObject &in_value, - lldb::DynamicValueType use_dynamic, - TypeAndOrName &class_type_or_name, - Address &address, - Value::ValueType &value_type); + bool + GetDynamicTypeAndAddress(ValueObject &in_value, + lldb::DynamicValueType use_dynamic, + TypeAndOrName &class_type_or_name, + Address &address, + Value::ValueType &value_type) override; - virtual UtilityFunction * - CreateObjectChecker (const char *); + UtilityFunction * + CreateObjectChecker(const char *) override; //------------------------------------------------------------------ - // Static Functions - //------------------------------------------------------------------ - static void - Initialize(); - - static void - Terminate(); - - static lldb_private::LanguageRuntime * - CreateInstance (Process *process, lldb::LanguageType language); - - static lldb_private::ConstString - GetPluginNameStatic(); - - //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual ConstString - GetPluginName(); + ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; - virtual ObjCRuntimeVersions - GetRuntimeVersion () const + ObjCRuntimeVersions + GetRuntimeVersion() const override { return ObjCRuntimeVersions::eAppleObjC_V1; } - virtual void - UpdateISAToDescriptorMapIfNeeded(); + void + UpdateISAToDescriptorMapIfNeeded() override; - virtual DeclVendor * - GetDeclVendor(); + DeclVendor * + GetDeclVendor() override; protected: - virtual lldb::BreakpointResolverSP - CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp); + lldb::BreakpointResolverSP + CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override; - class HashTableSignature { public: @@ -193,17 +191,17 @@ lldb::addr_t m_buckets_ptr; }; - lldb::addr_t GetISAHashTablePointer (); HashTableSignature m_hash_signature; lldb::addr_t m_isa_hash_table_ptr; std::unique_ptr m_decl_vendor_ap; + private: AppleObjCRuntimeV1(Process *process); }; } // namespace lldb_private -#endif // liblldb_AppleObjCRuntimeV1_h_ +#endif // liblldb_AppleObjCRuntimeV1_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -1,4 +1,4 @@ -//===-- AppleObjCRuntimeV2.h ----------------------------------------*- C++ -*-===// +//===-- AppleObjCRuntimeV2.h ------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,7 +12,6 @@ // C Includes // C++ Includes - #include #include @@ -30,31 +29,8 @@ public AppleObjCRuntime { public: - static bool classof(const ObjCLanguageRuntime* runtime) - { - switch (runtime->GetRuntimeVersion()) - { - case ObjCRuntimeVersions::eAppleObjC_V2: - return true; - default: - return false; - } - } + ~AppleObjCRuntimeV2() override = default; - virtual ~AppleObjCRuntimeV2(); - - // These are generic runtime functions: - virtual bool - GetDynamicTypeAndAddress (ValueObject &in_value, - lldb::DynamicValueType use_dynamic, - TypeAndOrName &class_type_or_name, - Address &address, - Value::ValueType &value_type); - - virtual UtilityFunction * - CreateObjectChecker (const char *); - - //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -69,28 +45,74 @@ static lldb_private::ConstString GetPluginNameStatic(); + + static bool classof(const ObjCLanguageRuntime* runtime) + { + switch (runtime->GetRuntimeVersion()) + { + case ObjCRuntimeVersions::eAppleObjC_V2: + return true; + default: + return false; + } + } + + // These are generic runtime functions: + bool + GetDynamicTypeAndAddress(ValueObject &in_value, + lldb::DynamicValueType use_dynamic, + TypeAndOrName &class_type_or_name, + Address &address, + Value::ValueType &value_type) override; + UtilityFunction * + CreateObjectChecker(const char *) override; + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual ConstString - GetPluginName(); + ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; - virtual ObjCRuntimeVersions - GetRuntimeVersion () const + ObjCRuntimeVersions + GetRuntimeVersion() const override { return ObjCRuntimeVersions::eAppleObjC_V2; } - virtual size_t - GetByteOffsetForIvar (CompilerType &parent_qual_type, const char *ivar_name); + size_t + GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name) override; - virtual void - UpdateISAToDescriptorMapIfNeeded(); + void + UpdateISAToDescriptorMapIfNeeded() override; + ConstString + GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa) override; + + ClassDescriptorSP + GetClassDescriptor(ValueObject& in_value) override; + + ClassDescriptorSP + GetClassDescriptorFromISA(ObjCISA isa) override; + + DeclVendor * + GetDeclVendor() override; + + lldb::addr_t + LookupRuntimeSymbol(const ConstString &name) override; + + EncodingToTypeSP + GetEncodingToType() override; + + TaggedPointerVendor* + GetTaggedPointerVendor() override + { + return m_tagged_pointer_vendor_ap.get(); + } + // none of these are valid ISAs - we use them to infer the type // of tagged pointers - if we have something meaningful to say // we report an actual type - otherwise, we just say tagged @@ -102,36 +124,11 @@ static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSManagedObject = 5; static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDate = 6; - virtual ConstString - GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa); - - virtual ClassDescriptorSP - GetClassDescriptor (ValueObject& in_value); - - virtual ClassDescriptorSP - GetClassDescriptorFromISA (ObjCISA isa); - - virtual DeclVendor * - GetDeclVendor(); - - virtual lldb::addr_t - LookupRuntimeSymbol (const ConstString &name); - - virtual EncodingToTypeSP - GetEncodingToType (); - - virtual TaggedPointerVendor* - GetTaggedPointerVendor () - { - return m_tagged_pointer_vendor_ap.get(); - } - protected: - virtual lldb::BreakpointResolverSP - CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp); + lldb::BreakpointResolverSP + CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override; private: - class HashTableSignature { public: @@ -144,6 +141,7 @@ void UpdateSignature (const RemoteNXMapTable &hash_table); + protected: uint32_t m_count; uint32_t m_num_buckets; @@ -160,6 +158,7 @@ ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor (ObjCISA isa); + private: NonPointerISACache (AppleObjCRuntimeV2& runtime, uint64_t objc_debug_isa_class_mask, @@ -183,12 +182,12 @@ class TaggedPointerVendorV2 : public ObjCLanguageRuntime::TaggedPointerVendor { public: + ~TaggedPointerVendorV2() override = default; + static TaggedPointerVendorV2* CreateInstance (AppleObjCRuntimeV2& runtime, const lldb::ModuleSP& objc_module_sp); - - virtual - ~TaggedPointerVendorV2 () { } + protected: AppleObjCRuntimeV2& m_runtime; @@ -197,19 +196,20 @@ m_runtime(runtime) { } + private: - DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorV2); }; class TaggedPointerVendorRuntimeAssisted : public TaggedPointerVendorV2 { public: - virtual bool - IsPossibleTaggedPointer (lldb::addr_t ptr); + bool + IsPossibleTaggedPointer(lldb::addr_t ptr) override; - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetClassDescriptor (lldb::addr_t ptr); + ObjCLanguageRuntime::ClassDescriptorSP + GetClassDescriptor(lldb::addr_t ptr) override; + protected: TaggedPointerVendorRuntimeAssisted (AppleObjCRuntimeV2& runtime, uint64_t objc_debug_taggedpointer_mask, @@ -237,11 +237,12 @@ class TaggedPointerVendorLegacy : public TaggedPointerVendorV2 { public: - virtual bool - IsPossibleTaggedPointer (lldb::addr_t ptr); + bool + IsPossibleTaggedPointer(lldb::addr_t ptr) override; - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetClassDescriptor (lldb::addr_t ptr); + ObjCLanguageRuntime::ClassDescriptorSP + GetClassDescriptor (lldb::addr_t ptr) override; + protected: TaggedPointerVendorLegacy (AppleObjCRuntimeV2& runtime) : TaggedPointerVendorV2 (runtime) @@ -332,4 +333,4 @@ } // namespace lldb_private -#endif // liblldb_AppleObjCRuntimeV2_h_ +#endif // liblldb_AppleObjCRuntimeV2_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1,4 +1,4 @@ -//===-- AppleObjCRuntimeV2.cpp --------------------------------------*- C++ -*-===// +//===-- AppleObjCRuntimeV2.cpp ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,10 +7,18 @@ // //===----------------------------------------------------------------------===// +// C Includes +#include + +// C++ Includes #include #include -#include +// Other libraries and framework includes +#include "clang/AST/ASTContext.h" +#include "clang/AST/DeclObjC.h" + +// Project includes #include "lldb/lldb-enumerations.h" #include "lldb/Core/ClangForward.h" #include "lldb/Symbol/CompilerType.h" @@ -52,13 +60,8 @@ #include "AppleObjCDeclVendor.h" #include "AppleObjCTrampolineHandler.h" -#include "clang/AST/ASTContext.h" -#include "clang/AST/DeclObjC.h" - #include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h" -#include - using namespace lldb; using namespace lldb_private; @@ -342,7 +345,6 @@ error.SetErrorString("no symbol"); return default_value; } - } AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process, @@ -368,10 +370,6 @@ m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL); } -AppleObjCRuntimeV2::~AppleObjCRuntimeV2() -{ -} - bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value, DynamicValueType use_dynamic, @@ -450,7 +448,6 @@ class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed { public: - CommandObjectObjC_ClassTable_Dump (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "dump", @@ -461,14 +458,12 @@ eCommandProcessMustBePaused ) { } - - ~CommandObjectObjC_ClassTable_Dump () - { - } - + + ~CommandObjectObjC_ClassTable_Dump() override = default; + protected: bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute(Args& command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime(); @@ -510,7 +505,6 @@ class CommandObjectMultiwordObjC_TaggedPointer_Info : public CommandObjectParsed { public: - CommandObjectMultiwordObjC_TaggedPointer_Info (CommandInterpreter &interpreter) : CommandObjectParsed (interpreter, "info", @@ -533,14 +527,12 @@ // Push the data for the first argument into the m_arguments vector. m_arguments.push_back (arg); } - - ~CommandObjectMultiwordObjC_TaggedPointer_Info () - { - } - + + ~CommandObjectMultiwordObjC_TaggedPointer_Info() override = default; + protected: bool - DoExecute (Args& command, CommandReturnObject &result) + DoExecute(Args& command, CommandReturnObject &result) override { if (command.GetArgumentCount() == 0) { @@ -610,7 +602,6 @@ class CommandObjectMultiwordObjC_ClassTable : public CommandObjectMultiword { public: - CommandObjectMultiwordObjC_ClassTable (CommandInterpreter &interpreter) : CommandObjectMultiword (interpreter, "class-table", @@ -619,11 +610,8 @@ { LoadSubCommand ("dump", CommandObjectSP (new CommandObjectObjC_ClassTable_Dump (interpreter))); } - - virtual - ~CommandObjectMultiwordObjC_ClassTable () - { - } + + ~CommandObjectMultiwordObjC_ClassTable() override = default; }; class CommandObjectMultiwordObjC_TaggedPointer : public CommandObjectMultiword @@ -638,17 +626,13 @@ { LoadSubCommand ("info", CommandObjectSP (new CommandObjectMultiwordObjC_TaggedPointer_Info (interpreter))); } - - virtual - ~CommandObjectMultiwordObjC_TaggedPointer () - { - } + + ~CommandObjectMultiwordObjC_TaggedPointer() override = default; }; class CommandObjectMultiwordObjC : public CommandObjectMultiword { public: - CommandObjectMultiwordObjC (CommandInterpreter &interpreter) : CommandObjectMultiword (interpreter, "objc", @@ -658,11 +642,8 @@ LoadSubCommand ("class-table", CommandObjectSP (new CommandObjectMultiwordObjC_ClassTable (interpreter))); LoadSubCommand ("tagged-pointer", CommandObjectSP (new CommandObjectMultiwordObjC_TaggedPointer (interpreter))); } - - virtual - ~CommandObjectMultiwordObjC () - { - } + + ~CommandObjectMultiwordObjC() override = default; }; void @@ -689,7 +670,6 @@ return g_name; } - //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ @@ -836,7 +816,6 @@ return ivar_offset; } - // tagged pointers are special not-a-real-pointer values that contain both type and value information // this routine attempts to check with as little computational effort as possible whether something // could possibly be a tagged pointer - false positives are possible but false negatives shouldn't @@ -851,7 +830,6 @@ class RemoteNXMapTable { public: - RemoteNXMapTable () : m_count (0), m_num_buckets_minus_one (0), @@ -996,6 +974,7 @@ return element(ConstString(key_string.c_str()), (ObjCLanguageRuntime::ObjCISA)value); } + private: void AdvanceToValidIndex () { @@ -1072,8 +1051,6 @@ lldb::addr_t m_invalid_key; }; - - AppleObjCRuntimeV2::HashTableSignature::HashTableSignature() : m_count (0), m_num_buckets (0), @@ -1312,10 +1289,7 @@ } arguments = get_class_info_function->GetArgumentValues(); } - - - - + errors.Clear(); const uint32_t class_info_byte_size = addr_size + 4; @@ -1672,7 +1646,6 @@ return DescriptorMapUpdateResult(success, any_found); } - bool AppleObjCRuntimeV2::UpdateISAToDescriptorMapFromMemory (RemoteNXMapTable &hash_table) { @@ -1780,7 +1753,6 @@ else m_loaded_objc_opt = true; } - } else { Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h @@ -12,15 +12,13 @@ // C Includes // C++ Includes - // Other libraries and framework includes +#include "clang/AST/ASTContext.h" // Project includes #include "lldb/lldb-private.h" #include "lldb/Target/ObjCLanguageRuntime.h" -#include "clang/AST/ASTContext.h" - namespace lldb_utility { class StringLexer; } @@ -31,9 +29,10 @@ { public: AppleObjCTypeEncodingParser (ObjCLanguageRuntime& runtime); - virtual CompilerType RealizeType (clang::ASTContext &ast_ctx, const char* name, bool for_expression); - virtual ~AppleObjCTypeEncodingParser() {} + ~AppleObjCTypeEncodingParser() override = default; + CompilerType RealizeType(clang::ASTContext &ast_ctx, const char* name, bool for_expression) override; + private: struct StructElement { std::string name; @@ -79,4 +78,4 @@ } // namespace lldb_private -#endif // liblldb_AppleObjCTypeEncodingParser_h_ +#endif // liblldb_AppleObjCTypeEncodingParser_h_ Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h @@ -1,4 +1,4 @@ -//===-- AppleThreadPlanStepThroughObjCTrampoline.h --------------------------*- C++ -*-===// +//===-- AppleThreadPlanStepThroughObjCTrampoline.h --------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -26,67 +26,56 @@ class AppleThreadPlanStepThroughObjCTrampoline : public ThreadPlan { public: - //------------------------------------------------------------------ - // Constructors and Destructors - //------------------------------------------------------------------ - AppleThreadPlanStepThroughObjCTrampoline(Thread &thread, + AppleThreadPlanStepThroughObjCTrampoline(Thread &thread, AppleObjCTrampolineHandler *trampoline_handler, ValueList &values, lldb::addr_t isa_addr, lldb::addr_t sel_addr, bool stop_others); - - virtual ~AppleThreadPlanStepThroughObjCTrampoline(); - virtual void - GetDescription (Stream *s, - lldb::DescriptionLevel level); + ~AppleThreadPlanStepThroughObjCTrampoline() override; + + static bool + PreResumeInitializeFunctionCaller(void *myself); + + void + GetDescription(Stream *s, + lldb::DescriptionLevel level) override; - virtual bool - ValidatePlan (Stream *error); + bool + ValidatePlan(Stream *error) override; - virtual lldb::StateType - GetPlanRunState (); + lldb::StateType + GetPlanRunState() override; - virtual bool - ShouldStop (Event *event_ptr); + bool + ShouldStop(Event *event_ptr) override; - virtual bool - StopOthers() + bool + StopOthers() override { return m_stop_others; } // The base class MischiefManaged does some cleanup - so you have to call it // in your MischiefManaged derived class. - virtual bool - MischiefManaged (); + bool + MischiefManaged() override; - virtual void - DidPush(); + void + DidPush() override; - static bool - PreResumeInitializeFunctionCaller(void *myself); + bool + WillStop() override; - virtual bool - WillStop(); - - - protected: - //------------------------------------------------------------------ - // Classes that inherit from AppleThreadPlanStepThroughObjCTrampoline can see and modify these - //------------------------------------------------------------------ - virtual bool - DoPlanExplainsStop (Event *event_ptr); + bool + DoPlanExplainsStop(Event *event_ptr) override; private: bool InitializeFunctionCaller (); - //------------------------------------------------------------------ - // For AppleThreadPlanStepThroughObjCTrampoline only - //------------------------------------------------------------------ AppleObjCTrampolineHandler *m_trampoline_handler; // FIXME - ensure this doesn't go away on us? SP maybe? lldb::addr_t m_args_addr; // Stores the address for our step through function result structure. //lldb::addr_t m_object_addr; // This is only for Description. @@ -103,4 +92,4 @@ } // namespace lldb_private -#endif // lldb_AppleThreadPlanStepThroughObjCTrampoline_h_ +#endif // lldb_AppleThreadPlanStepThroughObjCTrampoline_h_