[Lldb-commits] [lldb] r139983 - in /lldb/trunk: include/lldb/ include/lldb/Core/ include/lldb/Symbol/ include/lldb/Utility/ lldb.xcodeproj/xcshareddata/xcschemes/ source/Commands/ source/Core/ source/Expression/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Symbol/ source/Utility/ tools/debugserver/source/MacOSX/i386/ tools/debugserver/source/MacOSX/x86_64/

Greg Clayton gclayton at apple.com
Fri Sep 16 23:21:21 PDT 2011


Author: gclayton
Date: Sat Sep 17 01:21:20 2011
New Revision: 139983

URL: http://llvm.org/viewvc/llvm-project?rev=139983&view=rev
Log:
Convert lldb::ModuleSP to use an instrusive ref counted pointer.
We had some cases where getting the shared pointer for a module from
the global module list was causing a performance issue when debugging
with DWARF in .o files. Now that the module uses intrusive ref counts,
we can easily convert any pointer to a shared pointer.


Modified:
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Symbol/SymbolContext.h
    lldb/trunk/include/lldb/Utility/SharingPtr.h
    lldb/trunk/include/lldb/lldb-forward-rtti.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/include/lldb/lldb-types.h
    lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
    lldb/trunk/source/Commands/CommandCompletions.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Expression/ClangASTSource.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Utility/SharingPtr.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Sat Sep 17 01:21:20 2011
@@ -44,6 +44,7 @@
 namespace lldb_private {
 
 class Module :
+    public ReferenceCountedBaseVirtual<Module>,
     public SymbolContextScope
 {
 public:

Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Sat Sep 17 01:21:20 2011
@@ -97,6 +97,7 @@
                    LineEntry *line_entry = NULL,
                    Symbol *symbol = NULL);
 
+    ~SymbolContext ();
     //------------------------------------------------------------------
     /// Copy constructor
     ///
@@ -294,13 +295,9 @@
     } SpecificationType;
     
     // This one produces a specifier that matches everything...
-    SymbolContextSpecifier (lldb::TargetSP target_sp) :
-        m_start_line(0),
-        m_end_line(0)
-    {
-        m_target_sp = target_sp;
-        m_type = eNothingSpecified;
-    }   
+    SymbolContextSpecifier (const lldb::TargetSP& target_sp);
+    
+    ~SymbolContextSpecifier();
     
     bool
     AddSpecification (const char *spec_string, SpecificationType type);

Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharingPtr.h (original)
+++ lldb/trunk/include/lldb/Utility/SharingPtr.h Sat Sep 17 01:21:20 2011
@@ -531,7 +531,282 @@
         baton_ = 0;
     }
 };
+    
+    
+template <class T>
+class IntrusiveSharingPtr;
 
-} // namespace lldb
+template <class T>
+class ReferenceCountedBase
+{
+public:
+    explicit ReferenceCountedBase(long refs = 0)
+        : shared_owners_(refs) 
+    {
+    }
+    
+    void
+    add_shared()
+    {
+        __sync_add_and_fetch(&shared_owners_, 1);
+    }
+    void
+    release_shared()
+    {
+        if (__sync_add_and_fetch(&shared_owners_, -1) == -1)
+            delete static_cast<T*>(this);
+    }
+
+    long 
+    use_count() const 
+    {
+        return shared_owners_ + 1;
+    }
+    
+protected:
+    long shared_owners_;
+   
+    friend class IntrusiveSharingPtr<T>;
+    
+private:
+    ReferenceCountedBase(const ReferenceCountedBase&);
+    ReferenceCountedBase& operator=(const ReferenceCountedBase&);
+};
+
+    
+//template <class T>
+//class ReferenceCountedBaseVirtual
+//{
+//public:
+//    explicit ReferenceCountedBaseVirtual(long refs = 0) : 
+//        shared_owners_(refs) 
+//    {
+//    }
+//    
+//    void
+//    add_shared();
+//
+//    void
+//    release_shared();
+//    
+//    long 
+//    use_count() const 
+//    {
+//        return shared_owners_ + 1;
+//    }
+//    
+//protected:
+//    long shared_owners_;
+//    
+//    virtual ~ReferenceCountedBaseVirtual() {}
+//    
+//    friend class IntrusiveSharingPtr<T>;
+//    
+//private:
+//    ReferenceCountedBaseVirtual(const ReferenceCountedBaseVirtual&);
+//    ReferenceCountedBaseVirtual& operator=(const ReferenceCountedBaseVirtual&);
+//};
+//
+//template <class T>
+//void
+//ReferenceCountedBaseVirtual<T>::add_shared()
+//{
+//    __sync_add_and_fetch(&shared_owners_, 1);
+//}
+//
+//template <class T>
+//void
+//ReferenceCountedBaseVirtual<T>::release_shared()
+//{
+//    if (__sync_add_and_fetch(&shared_owners_, -1) == -1)
+//        delete this;
+//}
+
+    
+template <class T>
+class ReferenceCountedBaseVirtual : public imp::shared_count
+{
+public:
+    explicit ReferenceCountedBaseVirtual () : 
+        imp::shared_count(-1)
+    {
+    }
+    
+    virtual
+    ~ReferenceCountedBaseVirtual ()
+    {
+    }
+    
+    virtual void on_zero_shared ();
+    
+};
+
+template <class T>
+void
+ReferenceCountedBaseVirtual<T>::on_zero_shared()
+{
+}
+
+template <typename T>
+class IntrusiveSharingPtr 
+{
+public:
+    typedef T element_type;
+    
+    explicit 
+    IntrusiveSharingPtr () : 
+        ptr_(0) 
+    {
+    }
+    
+    explicit
+    IntrusiveSharingPtr (T* ptr) : 
+        ptr_(ptr) 
+    {
+        add_shared();
+    }
+    
+    IntrusiveSharingPtr (const IntrusiveSharingPtr& rhs) : 
+        ptr_(rhs.ptr_) 
+    {
+        add_shared();
+    }
+    
+    template <class X>
+    IntrusiveSharingPtr (const IntrusiveSharingPtr<X>& rhs)
+        : ptr_(rhs.get()) 
+    {
+        add_shared();
+    }
+    
+    IntrusiveSharingPtr& 
+    operator= (const IntrusiveSharingPtr& rhs) 
+    {
+        reset(rhs.get());
+        return *this;
+    }
+    
+    template <class X> IntrusiveSharingPtr& 
+    operator= (const IntrusiveSharingPtr<X>& rhs) 
+    {
+        reset(rhs.get());
+        return *this;
+    }
+    
+    IntrusiveSharingPtr& 
+    operator= (T *ptr) 
+    {
+        reset(ptr);
+        return *this;
+    }
+    
+    ~IntrusiveSharingPtr() 
+    {
+        release_shared(); 
+    }
+    
+    T& 
+    operator*() const 
+    {
+        return *ptr_; 
+    }
+    
+    T* 
+    operator->() const
+    {
+        return ptr_; 
+    }
+    
+    T* 
+    get() const
+    {
+        return ptr_; 
+    }
+    
+    operator bool() const
+    {
+        return ptr_ != 0;
+    }
+    
+    void 
+    swap (IntrusiveSharingPtr& rhs) 
+    {
+        std::swap(ptr_, rhs.ptr_);
+    }
+
+    void 
+    reset(T* ptr = NULL) 
+    {
+        IntrusiveSharingPtr(ptr).swap(*this);
+    }
+
+    long
+    use_count () const
+    {
+        if (ptr_)
+            return ptr_->use_count();
+        return 0;
+    }
+    
+    bool
+    unique () const
+    {
+        return use_count () == 1;
+    }
+
+private:
+    element_type *ptr_;
+
+    void
+    add_shared() 
+    {
+        if (ptr_) 
+            ptr_->add_shared(); 
+    }
+    void
+    release_shared()
+    { 
+        if (ptr_) 
+            ptr_->release_shared(); 
+    }
+};
+
+template<class T, class U>
+inline bool operator== (const IntrusiveSharingPtr<T>& lhs, const IntrusiveSharingPtr<U>& rhs)
+{
+    return lhs.get() == rhs.get();
+}
+
+template<class T, class U>
+inline bool operator!= (const IntrusiveSharingPtr<T>& lhs, const IntrusiveSharingPtr<U>& rhs)
+{
+    return lhs.get() != rhs.get();
+}
+
+template<class T, class U>
+inline bool operator== (const IntrusiveSharingPtr<T>& lhs, U* rhs)
+{
+    return lhs.get() == rhs;
+}
+
+template<class T, class U>
+inline bool operator!= (const IntrusiveSharingPtr<T>& lhs, U* rhs)
+{
+    return lhs.get() != rhs;
+}
+
+template<class T, class U>
+inline bool operator== (T* lhs, const IntrusiveSharingPtr<U>& rhs)
+{
+    return lhs == rhs.get();
+}
+
+template<class T, class U>
+inline bool operator!= (T* lhs, const IntrusiveSharingPtr<U>& rhs)
+{
+    return lhs != rhs.get();
+}
+
+} // namespace lldb_private
 
 #endif  // utility_SharingPtr_h_

Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Sat Sep 17 01:21:20 2011
@@ -50,7 +50,7 @@
     typedef SharedPtr<lldb_private::Listener>::Type ListenerSP;
     typedef SharedPtr<lldb_private::Log>::Type LogSP;
     typedef SharedPtr<lldb_private::LogChannel>::Type LogChannelSP;
-    typedef SharedPtr<lldb_private::Module>::Type ModuleSP;
+    typedef IntrusiveSharedPtr<lldb_private::Module>::Type ModuleSP;
     typedef SharedPtr<lldb_private::OptionValue>::Type OptionValueSP;
     typedef SharedPtr<lldb_private::Platform>::Type PlatformSP;
     typedef SharedPtr<lldb_private::Process>::Type ProcessSP;

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Sat Sep 17 01:21:20 2011
@@ -48,8 +48,10 @@
 class   ClangExpressionVariableList;
 class   ClangExpressionVariableList;
 class   ClangExpressionVariables;
+class   ClangFunction;
 class   ClangPersistentVariables;
 class   ClangUserExpression;
+class   ClangUtilityFunction;
 class   CommandInterpreter;
 class   CommandObject;
 class   CommandReturnObject;

Modified: lldb/trunk/include/lldb/lldb-types.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-types.h (original)
+++ lldb/trunk/include/lldb/lldb-types.h Sat Sep 17 01:21:20 2011
@@ -69,6 +69,12 @@
         {
             typedef lldb_private::LoggingSharingPtr<_Tp> Type;
         };
+    
+        template <typename _Tp>
+        struct IntrusiveSharedPtr 
+        {
+            typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
+        };
 
 } // namespace lldb
 

Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Sat Sep 17 01:21:20 2011
@@ -99,6 +99,12 @@
             ReferencedContainer = "container:lldb.xcodeproj">
          </BuildableReference>
       </BuildableProductRunnable>
+      <CommandLineArguments>
+         <CommandLineArgument
+            argument = "/Volumes/work/gclayton/Documents/src/args/a.out"
+            isEnabled = "YES">
+         </CommandLineArgument>
+      </CommandLineArguments>
       <EnvironmentVariables>
          <EnvironmentVariable
             key = "LLDB_LAUNCH_FLAG_DISABLE_ASLR"

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Sat Sep 17 01:21:20 2011
@@ -684,7 +684,7 @@
     bool complete
 )
 {
-    if (context.module_sp != NULL)
+    if (context.module_sp)
     {
         const char *cur_file_name = context.module_sp->GetFileSpec().GetFilename().GetCString();
         const char *cur_dir_name = context.module_sp->GetFileSpec().GetDirectory().GetCString();

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Sat Sep 17 01:21:20 2011
@@ -131,7 +131,8 @@
 ModuleSP
 Module::GetSP () const
 {
-    return ModuleList::GetModuleSP (this);
+    ModuleSP module_sp(const_cast<Module*>(this));
+    return module_sp;
 }
 
 const lldb_private::UUID&

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Sat Sep 17 01:21:20 2011
@@ -10,6 +10,7 @@
 
 #include "clang/AST/ASTContext.h"
 #include "lldb/Core/Log.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Expression/ClangASTSource.h"
 #include "lldb/Expression/ClangExpression.h"
 #include "lldb/Expression/ClangExpressionDeclMap.h"

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Sat Sep 17 01:21:20 2011
@@ -98,7 +98,7 @@
     AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp);
 
     static enum ObjCRuntimeVersions
-    GetObjCVersion (Process *process, ModuleSP &objc_module_sp);
+    GetObjCVersion (Process *process, lldb::ModuleSP &objc_module_sp);
 
     //------------------------------------------------------------------
     // PluginInterface protocol

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Sat Sep 17 01:21:20 2011
@@ -15,12 +15,8 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Core/ValueObject.h"
 #include "AppleObjCRuntime.h"
-#include "AppleObjCTrampolineHandler.h"
-#include "AppleThreadPlanStepThroughObjCTrampoline.h"
 
 namespace lldb_private {
     

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Sat Sep 17 01:21:20 2011
@@ -91,8 +91,9 @@
 const char *AppleObjCRuntimeV2::g_objc_class_symbol_prefix = "OBJC_CLASS_$_";
 const char *AppleObjCRuntimeV2::g_objc_class_data_section_name = "__objc_data";
 
-AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process, ModuleSP &objc_module_sp) : 
-    lldb_private::AppleObjCRuntime (process),
+AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process, 
+                                        const ModuleSP &objc_module_sp) : 
+    AppleObjCRuntime (process),
     m_get_class_name_args(LLDB_INVALID_ADDRESS),
     m_get_class_name_args_mutex(Mutex::eMutexTypeNormal),
     m_isa_to_name_cache(),
@@ -109,7 +110,7 @@
     
     StreamString errors;
     
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));  // FIXME - a more appropriate log channel?
+    LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));  // FIXME - a more appropriate log channel?
     
     int32_t debug;
     if (log)
@@ -417,7 +418,7 @@
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
-lldb_private::LanguageRuntime *
+LanguageRuntime *
 AppleObjCRuntimeV2::CreateInstance (Process *process, lldb::LanguageType language)
 {
     // FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make
@@ -581,7 +582,7 @@
 // this code relies on the assumption that an Objective-C object always starts
 // with an ISA at offset 0. an ISA is effectively a pointer to an instance of
 // struct class_t in the ObjCv2 runtime
-lldb_private::ObjCLanguageRuntime::ObjCISA
+ObjCLanguageRuntime::ObjCISA
 AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
 {
     if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != lldb::eLanguageTypeObjC)
@@ -602,7 +603,7 @@
     uint8_t pointer_size = valobj.GetUpdatePoint().GetProcessSP()->GetAddressByteSize();
     
     Error error;
-    lldb_private::ObjCLanguageRuntime::ObjCISA isa = 
+    ObjCLanguageRuntime::ObjCISA isa = 
     valobj.GetUpdatePoint().GetProcessSP()->ReadUnsignedIntegerFromMemory(isa_pointer,
                                                                           pointer_size,
                                                                           0,
@@ -613,7 +614,7 @@
 // TODO: should we have a transparent_kvo parameter here to say if we 
 // want to replace the KVO swizzled class with the actual user-level type?
 ConstString
-AppleObjCRuntimeV2::GetActualTypeName(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
+AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
 {
     if (!IsValidISA(isa))
         return ConstString(NULL);
@@ -713,8 +714,8 @@
         return ConstString("unknown");
 }
 
-lldb_private::ObjCLanguageRuntime::ObjCISA
-AppleObjCRuntimeV2::GetParentClass(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
+ObjCLanguageRuntime::ObjCISA
+AppleObjCRuntimeV2::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
 {
     if (!IsValidISA(isa))
         return 0;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Sat Sep 17 01:21:20 2011
@@ -18,12 +18,8 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private.h"
-#include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Core/ValueObject.h"
 #include "AppleObjCRuntime.h"
-#include "AppleObjCTrampolineHandler.h"
-#include "AppleThreadPlanStepThroughObjCTrampoline.h"
 
 namespace lldb_private {
 
@@ -81,7 +77,7 @@
     GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
     
     virtual bool
-    IsValidISA(ObjCISA isa)
+    IsValidISA (ObjCLanguageRuntime::ObjCISA isa)
     {
         return (isa != 0);
     }
@@ -89,28 +85,29 @@
     // this is not a valid ISA in the sense that no valid
     // class pointer can live at address 1. we use it to refer to
     // tagged types, where the ISA must be dynamically determined
-    static const ObjCISA g_objc_Tagged_ISA = 1;
+    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA = 1;
     
-    virtual ObjCISA
+    virtual ObjCLanguageRuntime::ObjCISA
     GetISA(ValueObject& valobj);   
     
     virtual ConstString
-    GetActualTypeName(ObjCISA isa);
+    GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa);
     
-    virtual ObjCISA
-    GetParentClass(ObjCISA isa);
+    virtual ObjCLanguageRuntime::ObjCISA
+    GetParentClass(ObjCLanguageRuntime::ObjCISA isa);
     
 protected:
     
 private:
     
-    typedef std::map<ObjCISA,ConstString> ISAToNameCache;
-    typedef std::map<ObjCISA,ObjCISA> ISAToParentCache;
+    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, ModuleSP &objc_module_sp);
+    AppleObjCRuntimeV2 (Process *process, 
+                        const lldb::ModuleSP &objc_module_sp);
     
     bool
     IsTaggedPointer(lldb::addr_t ptr);

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Sat Sep 17 01:21:20 2011
@@ -22,6 +22,10 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Value.h"
+#include "lldb/Expression/ClangExpression.h"
+#include "lldb/Expression/ClangFunction.h"
+#include "lldb/Expression/ClangUtilityFunction.h"
+
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
@@ -156,6 +160,10 @@
     SetUpRegion ();
 }
 
+AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler()
+{
+}
+
 void
 AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion()
 {
@@ -301,11 +309,12 @@
     }
 }
         
-AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables (ProcessSP &process_sp, ModuleSP &objc_module_sp) :
-        m_process_sp(process_sp),
-        m_trampoline_header(LLDB_INVALID_ADDRESS),
-        m_trampolines_changed_bp_id(LLDB_INVALID_BREAK_ID),
-        m_objc_module_sp(objc_module_sp)
+AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables (const ProcessSP &process_sp, 
+                                                                const ModuleSP &objc_module_sp) :
+    m_process_sp (process_sp),
+    m_trampoline_header (LLDB_INVALID_ADDRESS),
+    m_trampolines_changed_bp_id (LLDB_INVALID_BREAK_ID),
+    m_objc_module_sp (objc_module_sp)
 {
     
 }
@@ -510,7 +519,8 @@
     {NULL}
 };
 
-AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module_sp) :
+AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process_sp, 
+                                                        const ModuleSP &objc_module_sp) :
     m_process_sp (process_sp),
     m_objc_module_sp (objc_module_sp),
     m_impl_fn_addr (LLDB_INVALID_ADDRESS),

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Sat Sep 17 01:21:20 2011
@@ -13,28 +13,27 @@
 // C Includes
 // C++ Includes
 #include <map>
-#include <string>
+#include <vector>
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Expression/ClangExpression.h"
-#include "lldb/Expression/ClangFunction.h"
-#include "lldb/Expression/ClangUtilityFunction.h"
+#include "lldb/lldb-public.h"
 #include "lldb/Host/Mutex.h"
 
 
 namespace lldb_private
 {
-using namespace lldb;
   
 class AppleObjCTrampolineHandler {
 public:
     
-    AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module_sp);
+    AppleObjCTrampolineHandler (const lldb::ProcessSP &process_sp, 
+                                const lldb::ModuleSP &objc_module_sp);
     
-    ~AppleObjCTrampolineHandler() {}
+    ~AppleObjCTrampolineHandler();
             
-    ThreadPlanSP
-    GetStepThroughDispatchPlan (Thread &thread, bool stop_others);
+    lldb::ThreadPlanSP
+    GetStepThroughDispatchPlan (Thread &thread, 
+                                bool stop_others);
     
     ClangFunction *
     GetLookupImplementationWrapperFunction ();
@@ -80,7 +79,7 @@
     private:
         struct VTableDescriptor 
         {
-            VTableDescriptor(uint32_t in_flags, addr_t in_code_start) :
+            VTableDescriptor(uint32_t in_flags, lldb::addr_t in_code_start) :
                 flags(in_flags),
                 code_start(in_code_start) {}
             
@@ -151,7 +150,8 @@
         };
         
     public:
-        AppleObjCVTables(ProcessSP &process_sp, ModuleSP &objc_module_sp);
+        AppleObjCVTables(const lldb::ProcessSP &process_sp, 
+                         const lldb::ModuleSP &objc_module_sp);
         
         ~AppleObjCVTables();
                 
@@ -177,7 +177,7 @@
         }
         
     private:
-        ProcessSP m_process_sp;
+        lldb::ProcessSP m_process_sp;
         typedef std::vector<VTableRegion> region_collection;
         lldb::addr_t m_trampoline_header;
         lldb::break_id_t m_trampolines_changed_bp_id;
@@ -190,8 +190,8 @@
     
     typedef std::map<lldb::addr_t, int> MsgsendMap; // This table maps an dispatch fn address to the index in g_dispatch_functions
     MsgsendMap m_msgSend_map;
-    ProcessSP m_process_sp;
-    ModuleSP m_objc_module_sp;
+    lldb::ProcessSP m_process_sp;
+    lldb::ModuleSP m_objc_module_sp;
     std::auto_ptr<ClangFunction> m_impl_function;
     std::auto_ptr<ClangUtilityFunction> m_impl_code;
     Mutex m_impl_function_mutex;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp Sat Sep 17 01:21:20 2011
@@ -23,6 +23,8 @@
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Core/Log.h"
 
+
+using namespace lldb;
 using namespace lldb_private;
 
 //----------------------------------------------------------------------

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h Sat Sep 17 01:21:20 2011
@@ -82,9 +82,9 @@
     lldb::addr_t m_object_addr;  // This is only for Description.
     lldb::addr_t m_isa_addr;     // isa_addr and sel_addr are the keys we will use to cache the implementation.
     lldb::addr_t m_sel_addr;
-    ThreadPlanSP m_func_sp;       // This is the function call plan.  We fill it at start, then set it
-                                  // to NULL when this plan is done.  That way we know to go to:
-    ThreadPlanSP m_run_to_sp;     // The plan that runs to the target.
+    lldb::ThreadPlanSP m_func_sp;       // This is the function call plan.  We fill it at start, then set it
+                                        // to NULL when this plan is done.  That way we know to go to:
+    lldb::ThreadPlanSP m_run_to_sp;     // The plan that runs to the target.
     ClangFunction *m_impl_function;  // This is a pointer to a impl function that 
                                      // is owned by the client that pushes this plan.
     bool m_stop_others;

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Sat Sep 17 01:21:20 2011
@@ -82,6 +82,10 @@
     sc_scope->CalculateSymbolContext (this);
 }
 
+SymbolContext::~SymbolContext ()
+{
+}
+
 const SymbolContext&
 SymbolContext::operator= (const SymbolContext& rhs)
 {
@@ -447,7 +451,7 @@
         // for methods matching name.
     }
 
-    if (module_sp != NULL)
+    if (module_sp)
         module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list);
 
     if (target_sp)
@@ -489,6 +493,24 @@
 //
 //----------------------------------------------------------------------
 
+SymbolContextSpecifier::SymbolContextSpecifier (const TargetSP &target_sp) :
+    m_target_sp (target_sp),
+    m_module_spec (),
+    m_module_sp (),
+    m_file_spec_ap (),
+    m_start_line (0),
+    m_end_line (0),
+    m_function_spec (),
+    m_class_name (),
+    m_address_range_ap (),
+    m_type (eNothingSpecified)
+{
+}   
+
+SymbolContextSpecifier::~SymbolContextSpecifier()
+{
+}
+
 bool
 SymbolContextSpecifier::AddLineSpecification (uint32_t line_no, SpecificationType type)
 {

Modified: lldb/trunk/source/Utility/SharingPtr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SharingPtr.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/source/Utility/SharingPtr.cpp (original)
+++ lldb/trunk/source/Utility/SharingPtr.cpp Sat Sep 17 01:21:20 2011
@@ -14,40 +14,42 @@
 namespace imp
 {
 
-template <class T>
-inline T
-increment(T& t)
-{
-    return __sync_add_and_fetch(&t, 1);
-}
+    template <class T>
+    inline T
+    increment(T& t)
+    {
+        return __sync_add_and_fetch(&t, 1);
+    }
 
-template <class T>
-inline T
-decrement(T& t)
-{
-    return __sync_add_and_fetch(&t, -1);
-}
+    template <class T>
+    inline T
+    decrement(T& t)
+    {
+        return __sync_add_and_fetch(&t, -1);
+    }
 
-shared_count::~shared_count()
-{
-}
+    shared_count::~shared_count()
+    {
+    }
 
-void
-shared_count::add_shared()
-{
-    increment(shared_owners_);
-}
+    void
+    shared_count::add_shared()
+    {
+        increment(shared_owners_);
+    }
 
-void
-shared_count::release_shared()
-{
-    if (decrement(shared_owners_) == -1)
+    void
+    shared_count::release_shared()
     {
-        on_zero_shared();
-        delete this;
+        if (decrement(shared_owners_) == -1)
+        {
+            on_zero_shared();
+            delete this;
+        }
     }
-}
 
 } // imp
 
+
 } // namespace lldb
+

Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Sat Sep 17 01:21:20 2011
@@ -252,7 +252,8 @@
     gdb_ymm7       = gdb_xmm7
 };
 
-enum DNBArchImplI386::AVXPresence DNBArchImplI386::s_has_avx = DNBArchImplI386::kAVXUnknown;
+// AVX support isn't working at all from user space, so disable it for now.
+enum DNBArchImplI386::AVXPresence DNBArchImplI386::s_has_avx = DNBArchImplI386::kAVXNotPresent;
 
 uint64_t
 DNBArchImplI386::GetPC(uint64_t failValue)

Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=139983&r1=139982&r2=139983&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Sat Sep 17 01:21:20 2011
@@ -65,7 +65,7 @@
 #define FORCE_AVX_REGS (0)
 #endif
 
-enum DNBArchImplX86_64::AVXPresence DNBArchImplX86_64::s_has_avx = DNBArchImplX86_64::kAVXUnknown;
+enum DNBArchImplX86_64::AVXPresence DNBArchImplX86_64::s_has_avx = DNBArchImplX86_64::kAVXNotPresent;
 
 uint64_t
 DNBArchImplX86_64::GetPC(uint64_t failValue)





More information about the lldb-commits mailing list