Index: include/lldb/Target/ObjCLanguageRuntime.h =================================================================== --- /dev/null +++ include/lldb/Target/ObjCLanguageRuntime.h @@ -1,429 +0,0 @@ -//===-- ObjCLanguageRuntime.h -----------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_ObjCLanguageRuntime_h_ -#define liblldb_ObjCLanguageRuntime_h_ - -#include -#include -#include -#include - -#include "llvm/Support/Casting.h" - -#include "lldb/Breakpoint/BreakpointPrecondition.h" -#include "lldb/Core/PluginInterface.h" -#include "lldb/Core/ThreadSafeDenseMap.h" -#include "lldb/Symbol/CompilerType.h" -#include "lldb/Symbol/Type.h" -#include "lldb/Target/LanguageRuntime.h" -#include "lldb/lldb-private.h" - -class CommandObjectObjC_ClassTable_Dump; - -namespace lldb_private { - -class UtilityFunction; - -class ObjCLanguageRuntime : public LanguageRuntime { -public: - enum class ObjCRuntimeVersions { - eObjC_VersionUnknown = 0, - eAppleObjC_V1 = 1, - eAppleObjC_V2 = 2 - }; - - typedef lldb::addr_t ObjCISA; - - class ClassDescriptor; - typedef std::shared_ptr ClassDescriptorSP; - - // the information that we want to support retrieving from an ObjC class this - // needs to be pure virtual since there are at least 2 different - // implementations of the runtime, and more might come - class ClassDescriptor { - public: - ClassDescriptor() - : m_is_kvo(eLazyBoolCalculate), m_is_cf(eLazyBoolCalculate), - m_type_wp() {} - - virtual ~ClassDescriptor() = default; - - virtual ConstString GetClassName() = 0; - - virtual ClassDescriptorSP GetSuperclass() = 0; - - virtual ClassDescriptorSP GetMetaclass() const = 0; - - // virtual if any implementation has some other version-specific rules but - // for the known v1/v2 this is all that needs to be done - virtual bool IsKVO() { - if (m_is_kvo == eLazyBoolCalculate) { - const char *class_name = GetClassName().AsCString(); - if (class_name && *class_name) - m_is_kvo = - (LazyBool)(strstr(class_name, "NSKVONotifying_") == class_name); - } - return (m_is_kvo == eLazyBoolYes); - } - - // virtual if any implementation has some other version-specific rules but - // for the known v1/v2 this is all that needs to be done - virtual bool IsCFType() { - if (m_is_cf == eLazyBoolCalculate) { - const char *class_name = GetClassName().AsCString(); - if (class_name && *class_name) - m_is_cf = (LazyBool)(strcmp(class_name, "__NSCFType") == 0 || - strcmp(class_name, "NSCFType") == 0); - } - return (m_is_cf == eLazyBoolYes); - } - - virtual bool IsValid() = 0; - - virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr, - uint64_t *value_bits = nullptr, - uint64_t *payload = nullptr) = 0; - - virtual uint64_t GetInstanceSize() = 0; - - // use to implement version-specific additional constraints on pointers - virtual bool CheckPointer(lldb::addr_t value, uint32_t ptr_size) const { - return true; - } - - virtual ObjCISA GetISA() = 0; - - // This should return true iff the interface could be completed - 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 { - return false; - } - - lldb::TypeSP GetType() { return m_type_wp.lock(); } - - void SetType(const lldb::TypeSP &type_sp) { m_type_wp = type_sp; } - - struct iVarDescriptor { - ConstString m_name; - CompilerType m_type; - uint64_t m_size; - int32_t m_offset; - }; - - virtual size_t GetNumIVars() { return 0; } - - virtual iVarDescriptor GetIVarAtIndex(size_t idx) { - return iVarDescriptor(); - } - - protected: - bool IsPointerValid(lldb::addr_t value, uint32_t ptr_size, - bool allow_NULLs = false, bool allow_tagged = false, - bool check_version_specific = false) const; - - private: - LazyBool m_is_kvo; - LazyBool m_is_cf; - lldb::TypeWP m_type_wp; - }; - - class EncodingToType { - public: - virtual ~EncodingToType(); - - virtual CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name, - bool for_expression); - virtual CompilerType RealizeType(const char *name, bool for_expression); - - virtual CompilerType RealizeType(clang::ASTContext &ast_ctx, - const char *name, bool for_expression) = 0; - - protected: - std::unique_ptr m_scratch_ast_ctx_up; - }; - - class ObjCExceptionPrecondition : public BreakpointPrecondition { - public: - ObjCExceptionPrecondition(); - - ~ObjCExceptionPrecondition() override = default; - - bool EvaluatePrecondition(StoppointCallbackContext &context) override; - void GetDescription(Stream &stream, lldb::DescriptionLevel level) override; - Status ConfigurePrecondition(Args &args) override; - - protected: - void AddClassName(const char *class_name); - - private: - std::unordered_set m_class_names; - }; - - static lldb::BreakpointPreconditionSP - GetBreakpointExceptionPrecondition(lldb::LanguageType language, - bool throw_bp); - - class TaggedPointerVendor { - public: - virtual ~TaggedPointerVendor() = default; - - virtual bool IsPossibleTaggedPointer(lldb::addr_t ptr) = 0; - - virtual ObjCLanguageRuntime::ClassDescriptorSP - GetClassDescriptor(lldb::addr_t ptr) = 0; - - protected: - TaggedPointerVendor() = default; - - private: - DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendor); - }; - - ~ObjCLanguageRuntime() override; - - static char ID; - - bool isA(const void *ClassID) const override { - return ClassID == &ID || LanguageRuntime::isA(ClassID); - } - - static bool classof(const LanguageRuntime *runtime) { - return runtime->isA(&ID); - } - - static ObjCLanguageRuntime *Get(Process &process) { - return llvm::cast_or_null( - process.GetLanguageRuntime(lldb::eLanguageTypeObjC)); - } - - virtual TaggedPointerVendor *GetTaggedPointerVendor() { return nullptr; } - - typedef std::shared_ptr EncodingToTypeSP; - - 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 { - return lldb::eLanguageTypeObjC; - } - - virtual bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) = 0; - - virtual bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) = 0; - - virtual bool HasReadObjCLibrary() = 0; - - lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel); - - void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel, - 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); - - llvm::Optional GetRuntimeType(CompilerType base_type) override; - - virtual UtilityFunction *CreateObjectChecker(const char *) = 0; - - virtual ObjCRuntimeVersions GetRuntimeVersion() const { - return ObjCRuntimeVersions::eObjC_VersionUnknown; - } - - bool IsValidISA(ObjCISA isa) { - UpdateISAToDescriptorMap(); - return m_isa_to_descriptor.count(isa) > 0; - } - - virtual void UpdateISAToDescriptorMapIfNeeded() = 0; - - void UpdateISAToDescriptorMap() { - if (m_process && m_process->GetStopID() != m_isa_to_descriptor_stop_id) { - UpdateISAToDescriptorMapIfNeeded(); - } - } - - virtual ObjCISA GetISA(ConstString name); - - virtual ConstString GetActualTypeName(ObjCISA isa); - - virtual ObjCISA GetParentClass(ObjCISA isa); - - // Finds the byte offset of the child_type ivar in parent_type. If it can't - // find the offset, returns LLDB_INVALID_IVAR_OFFSET. - - virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, - const char *ivar_name); - - bool HasNewLiteralsAndIndexing() { - if (m_has_new_literals_and_indexing == eLazyBoolCalculate) { - if (CalculateHasNewLiteralsAndIndexing()) - m_has_new_literals_and_indexing = eLazyBoolYes; - else - m_has_new_literals_and_indexing = eLazyBoolNo; - } - - return (m_has_new_literals_and_indexing == eLazyBoolYes); - } - - void SymbolsDidLoad(const ModuleList &module_list) override { - m_negative_complete_class_cache.clear(); - } - - bool GetTypeBitSize(const CompilerType &compiler_type, - uint64_t &size) override; - - /// Check whether the name is "self" or "_cmd" and should show up in - /// "frame variable". - bool IsWhitelistedRuntimeValue(ConstString name) override; - -protected: - // Classes that inherit from ObjCLanguageRuntime can see and modify these - ObjCLanguageRuntime(Process *process); - - virtual bool CalculateHasNewLiteralsAndIndexing() { return false; } - - bool ISAIsCached(ObjCISA isa) const { - return m_isa_to_descriptor.find(isa) != m_isa_to_descriptor.end(); - } - - bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp) { - if (isa != 0) { - m_isa_to_descriptor[isa] = descriptor_sp; - return true; - } - return false; - } - - 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) { - if (isa != 0) { - m_isa_to_descriptor[isa] = descriptor_sp; - m_hash_to_isa_map.insert(std::make_pair(class_name_hash, isa)); - return true; - } - return false; - } - -private: - // We keep a map of ->Implementation so we don't have to call - // the resolver function over and over. - - // FIXME: We need to watch for the loading of Protocols, and flush the cache - // for any - // class that we see so changed. - - struct ClassAndSel { - ClassAndSel() { - sel_addr = LLDB_INVALID_ADDRESS; - class_addr = LLDB_INVALID_ADDRESS; - } - - ClassAndSel(lldb::addr_t in_sel_addr, lldb::addr_t in_class_addr) - : class_addr(in_class_addr), sel_addr(in_sel_addr) {} - - bool operator==(const ClassAndSel &rhs) { - if (class_addr == rhs.class_addr && sel_addr == rhs.sel_addr) - return true; - else - return false; - } - - bool operator<(const ClassAndSel &rhs) const { - if (class_addr < rhs.class_addr) - return true; - else if (class_addr > rhs.class_addr) - return false; - else { - if (sel_addr < rhs.sel_addr) - return true; - else - return false; - } - } - - lldb::addr_t class_addr; - lldb::addr_t sel_addr; - }; - - typedef std::map MsgImplMap; - typedef std::map ISAToDescriptorMap; - typedef std::multimap HashToISAMap; - typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator; - typedef HashToISAMap::iterator HashToISAIterator; - typedef ThreadSafeDenseMap TypeSizeCache; - - MsgImplMap m_impl_cache; - LazyBool m_has_new_literals_and_indexing; - ISAToDescriptorMap m_isa_to_descriptor; - HashToISAMap m_hash_to_isa_map; - TypeSizeCache m_type_size_cache; - -protected: - uint32_t m_isa_to_descriptor_stop_id; - - typedef std::map CompleteClassMap; - CompleteClassMap m_complete_class_cache; - - struct ConstStringSetHelpers { - size_t operator()(ConstString arg) const // for hashing - { - return (size_t)arg.GetCString(); - } - bool operator()(ConstString arg1, - ConstString arg2) const // for equality - { - return arg1.operator==(arg2); - } - }; - typedef std::unordered_set - CompleteClassSet; - CompleteClassSet m_negative_complete_class_cache; - - ISAToDescriptorIterator GetDescriptorIterator(ConstString name); - - friend class ::CommandObjectObjC_ClassTable_Dump; - - std::pair - GetDescriptorIteratorPair(bool update_if_needed = true); - - void ReadObjCLibraryIfNeeded(const ModuleList &module_list); - - DISALLOW_COPY_AND_ASSIGN(ObjCLanguageRuntime); -}; - -} // namespace lldb_private - -#endif // liblldb_ObjCLanguageRuntime_h_ Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -20,7 +20,6 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ABI.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" @@ -32,6 +31,8 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/State.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + //#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN #ifdef ENABLE_DEBUG_PRINTF #include Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -16,7 +16,6 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ABI.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" @@ -30,6 +29,8 @@ #include "DynamicLoaderDarwin.h" #include "DynamicLoaderMacOSXDYLD.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + //#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN #ifdef ENABLE_DEBUG_PRINTF #include Index: source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -20,12 +20,13 @@ #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/TaggedASTType.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Utility/Log.h" #include "clang/AST/ASTContext.h" #include "clang/AST/RecordLayout.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + #include #include Index: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -33,7 +33,6 @@ #include "lldb/Symbol/Variable.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StackFrame.h" @@ -53,6 +52,7 @@ #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" using namespace lldb; using namespace lldb_private; Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -78,7 +78,6 @@ #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlanCallFunction.h" @@ -90,6 +89,8 @@ #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StringList.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + #include #include Index: source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp +++ source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp @@ -18,13 +18,14 @@ #include "lldb/Expression/UtilityFunction.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Log.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + using namespace llvm; using namespace lldb_private; Index: source/Plugins/Language/ObjC/CF.cpp =================================================================== --- source/Plugins/Language/ObjC/CF.cpp +++ source/Plugins/Language/ObjC/CF.cpp @@ -14,7 +14,6 @@ #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" @@ -22,6 +21,8 @@ #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; Index: source/Plugins/Language/ObjC/Cocoa.h =================================================================== --- source/Plugins/Language/ObjC/Cocoa.h +++ source/Plugins/Language/ObjC/Cocoa.h @@ -13,9 +13,10 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/DataFormatters/TypeSynthetic.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Utility/Stream.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_private { namespace formatters { bool NSIndexSetSummaryProvider(ValueObject &valobj, Stream &stream, Index: source/Plugins/Language/ObjC/Cocoa.cpp =================================================================== --- source/Plugins/Language/ObjC/Cocoa.cpp +++ source/Plugins/Language/ObjC/Cocoa.cpp @@ -17,7 +17,6 @@ #include "lldb/Host/Time.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/Target.h" Index: source/Plugins/Language/ObjC/NSArray.cpp =================================================================== --- source/Plugins/Language/ObjC/NSArray.cpp +++ source/Plugins/Language/ObjC/NSArray.cpp @@ -11,13 +11,13 @@ #include "Cocoa.h" #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h" + #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" Index: source/Plugins/Language/ObjC/NSDictionary.cpp =================================================================== --- source/Plugins/Language/ObjC/NSDictionary.cpp +++ source/Plugins/Language/ObjC/NSDictionary.cpp @@ -19,7 +19,6 @@ #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" Index: source/Plugins/Language/ObjC/NSError.cpp =================================================================== --- source/Plugins/Language/ObjC/NSError.cpp +++ source/Plugins/Language/ObjC/NSError.cpp @@ -14,7 +14,6 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/ClangASTContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" @@ -23,6 +22,7 @@ #include "lldb/Utility/Stream.h" #include "Plugins/Language/ObjC/NSString.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" using namespace lldb; using namespace lldb_private; Index: source/Plugins/Language/ObjC/NSException.cpp =================================================================== --- source/Plugins/Language/ObjC/NSException.cpp +++ source/Plugins/Language/ObjC/NSException.cpp @@ -14,7 +14,6 @@ #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/ClangASTContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/ProcessStructReader.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" @@ -23,6 +22,7 @@ #include "lldb/Utility/Stream.h" #include "Plugins/Language/ObjC/NSString.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" using namespace lldb; using namespace lldb_private; Index: source/Plugins/Language/ObjC/NSIndexPath.cpp =================================================================== --- source/Plugins/Language/ObjC/NSIndexPath.cpp +++ source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -13,10 +13,10 @@ #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/Symbol/ClangASTContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; Index: source/Plugins/Language/ObjC/NSSet.cpp =================================================================== --- source/Plugins/Language/ObjC/NSSet.cpp +++ source/Plugins/Language/ObjC/NSSet.cpp @@ -14,7 +14,6 @@ #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/Endian.h" Index: source/Plugins/Language/ObjC/NSString.h =================================================================== --- source/Plugins/Language/ObjC/NSString.h +++ source/Plugins/Language/ObjC/NSString.h @@ -12,9 +12,10 @@ #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/TypeSummary.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Utility/Stream.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_private { namespace formatters { bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream, Index: source/Plugins/Language/ObjC/ObjCLanguage.cpp =================================================================== --- source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -16,13 +16,14 @@ #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompilerType.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/StreamString.h" #include "llvm/Support/Threading.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + #include "CF.h" #include "Cocoa.h" #include "CoreMedia.h" Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h @@ -12,9 +12,10 @@ #include #include "AppleObjCRuntimeV2.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/lldb-private.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_private { class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor { Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h @@ -11,9 +11,10 @@ #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/DeclVendor.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/lldb-private.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_private { class AppleObjCExternalASTSource; Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp @@ -9,10 +9,10 @@ #include "AppleObjCDeclVendor.h" #include "Plugins/ExpressionParser/Clang/ASTDumper.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Symbol/ClangUtil.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/Log.h" @@ -20,6 +20,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" + using namespace lldb_private; class lldb_private::AppleObjCExternalASTSource Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h @@ -14,9 +14,10 @@ #include "AppleObjCTrampolineHandler.h" #include "AppleThreadPlanStepThroughObjCTrampoline.h" #include "lldb/Target/LanguageRuntime.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/lldb-private.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_private { class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime { Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -10,9 +10,10 @@ #define liblldb_AppleObjCRuntimeV1_h_ #include "AppleObjCRuntime.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/lldb-private.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_private { class AppleObjCRuntimeV1 : public AppleObjCRuntime { Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -14,9 +14,10 @@ #include #include "AppleObjCRuntime.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/lldb-private.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + class RemoteNXMapTable; namespace lldb_private { Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -42,7 +42,6 @@ #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" @@ -66,6 +65,8 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclObjC.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + #include using namespace lldb; Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -23,7 +23,6 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" @@ -35,6 +34,8 @@ #include "llvm/ADT/STLExtras.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + #include using namespace lldb; Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h @@ -11,9 +11,10 @@ #include "clang/AST/ASTContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/lldb-private.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + namespace lldb_utility { class StringLexer; } Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -13,13 +13,14 @@ #include "lldb/Expression/FunctionCaller.h" #include "lldb/Expression/UtilityFunction.h" #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Utility/Log.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" + #include using namespace lldb; Index: source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt =================================================================== --- source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt +++ source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt @@ -1 +1,10 @@ +add_lldb_library(lldbPluginObjCRuntime PLUGIN + ObjCLanguageRuntime.cpp + + LINK_LIBS + lldbCore + lldbSymbol + lldbTarget + lldbUtility +) add_subdirectory(AppleObjCRuntime) Index: source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp +++ source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp @@ -7,6 +7,8 @@ //===----------------------------------------------------------------------===// #include "clang/AST/Type.h" +#include "ObjCLanguageRuntime.h" + #include "lldb/Core/MappedHash.h" #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" @@ -17,7 +19,6 @@ #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/Variable.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Timer.h" Index: source/Symbol/CMakeLists.txt =================================================================== --- source/Symbol/CMakeLists.txt +++ source/Symbol/CMakeLists.txt @@ -59,6 +59,7 @@ lldbPluginSymbolFileDWARF lldbPluginSymbolFilePDB lldbPluginObjCLanguage + lldbPluginObjCRuntime LINK_COMPONENTS Support Index: source/Symbol/ClangASTContext.cpp =================================================================== --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -86,7 +86,6 @@ #include "lldb/Symbol/VerifyDecl.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Language.h" -#include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Utility/DataExtractor.h" @@ -95,6 +94,7 @@ #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Scalar.h" +#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" #include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h" #include "Plugins/SymbolFile/PDB/PDBASTParser.h" Index: source/Target/CMakeLists.txt =================================================================== --- source/Target/CMakeLists.txt +++ source/Target/CMakeLists.txt @@ -10,7 +10,6 @@ Memory.cpp MemoryHistory.cpp ModuleCache.cpp - ObjCLanguageRuntime.cpp OperatingSystem.cpp PathMappingList.cpp Platform.cpp