[Lldb-commits] [lldb] r149207 - in /lldb/trunk: include/lldb/ include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Expression/ include/lldb/Interpreter/ include/lldb/Symbol/ include/lldb/Target/ include/lldb/Utility/ lldb.xcodeproj/xcshareddata/xcschemes/ source/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Interpreter/ source/Plugins/Disassembler/llvm/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Plugins/ObjectConta...

Greg Clayton gclayton at apple.com
Sun Jan 29 12:56:32 PST 2012


Author: gclayton
Date: Sun Jan 29 14:56:30 2012
New Revision: 149207

URL: http://llvm.org/viewvc/llvm-project?rev=149207&view=rev
Log:
Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to 
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared 
pointer from just a pointer, which is also easily solved using the 
std::tr1::enable_shared_from_this class. 

The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.

So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).


Modified:
    lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
    lldb/trunk/include/lldb/Core/Address.h
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/include/lldb/Core/FormatClasses.h
    lldb/trunk/include/lldb/Core/FormatManager.h
    lldb/trunk/include/lldb/Core/FormatNavigator.h
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/Core/SearchFilter.h
    lldb/trunk/include/lldb/Core/SourceManager.h
    lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
    lldb/trunk/include/lldb/Expression/ClangUserExpression.h
    lldb/trunk/include/lldb/Interpreter/Args.h
    lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
    lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
    lldb/trunk/include/lldb/Symbol/ObjectFile.h
    lldb/trunk/include/lldb/Symbol/Type.h
    lldb/trunk/include/lldb/Target/Memory.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/Target/RegisterContext.h
    lldb/trunk/include/lldb/Target/StackFrame.h
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/include/lldb/Target/ThreadList.h
    lldb/trunk/include/lldb/Utility/PriorityPointerPair.h
    lldb/trunk/include/lldb/lldb-forward-rtti.h
    lldb/trunk/include/lldb/lldb-types.h
    lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
    lldb/trunk/source/API/SBAddress.cpp
    lldb/trunk/source/API/SBBreakpoint.cpp
    lldb/trunk/source/API/SBBreakpointLocation.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBFunction.cpp
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/API/SBSection.cpp
    lldb/trunk/source/API/SBSymbol.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/API/SBValue.cpp
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/BreakpointSite.cpp
    lldb/trunk/source/Commands/CommandObjectArgs.cpp
    lldb/trunk/source/Commands/CommandObjectSource.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectType.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/AddressRange.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Core/SearchFilter.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Core/ValueObjectMemory.cpp
    lldb/trunk/source/Expression/ClangASTSource.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/ClangUserExpression.cpp
    lldb/trunk/source/Expression/ClangUtilityFunction.cpp
    lldb/trunk/source/Expression/IRInterpreter.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
    lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
    lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
    lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
    lldb/trunk/source/Symbol/ObjectFile.cpp
    lldb/trunk/source/Symbol/Symbol.cpp
    lldb/trunk/source/Symbol/SymbolVendor.cpp
    lldb/trunk/source/Symbol/Type.cpp
    lldb/trunk/source/Symbol/Variable.cpp
    lldb/trunk/source/Target/ExecutionContext.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadList.cpp
    lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
    lldb/trunk/source/lldb-log.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Sun Jan 29 14:56:30 2012
@@ -74,7 +74,7 @@
 /// not by the breakpoint.
 //----------------------------------------------------------------------
 class Breakpoint:
-    public ReferenceCountedBase<Breakpoint>,
+    public std::tr1::enable_shared_from_this<Breakpoint>,
     public Stoppoint
 {
 public:
@@ -286,10 +286,6 @@
     lldb::BreakpointLocationSP
     GetLocationAtIndex (uint32_t index);
 
-
-    const lldb::BreakpointSP
-    GetSP ();
-
     //------------------------------------------------------------------
     // The next section deals with various breakpoint options.
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Sun Jan 29 14:56:30 2012
@@ -47,7 +47,7 @@
 //----------------------------------------------------------------------
 
 class BreakpointLocation : 
-    public ReferenceCountedBase<BreakpointLocation>,
+    public std::tr1::enable_shared_from_this<BreakpointLocation>,
     public StoppointLocation
 {
 public:

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Sun Jan 29 14:56:30 2012
@@ -39,7 +39,7 @@
 //----------------------------------------------------------------------
 
 class BreakpointSite : 
-    public ReferenceCountedBase<BreakpointSite>,
+    public std::tr1::enable_shared_from_this<BreakpointSite>,
     public StoppointLocation
 {
 public:
@@ -159,7 +159,7 @@
     ///    \a owner is the Breakpoint Location to add.
     //------------------------------------------------------------------
     void
-    AddOwner (lldb::BreakpointLocationSP &owner);
+    AddOwner (const lldb::BreakpointLocationSP &owner);
 
     //------------------------------------------------------------------
     /// This method returns the number of breakpoint locations currently
@@ -263,7 +263,7 @@
     // Only the Process can create breakpoint sites in
     // Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
     BreakpointSite (BreakpointSiteList *list,
-                    lldb::BreakpointLocationSP& owner,
+                    const lldb::BreakpointLocationSP& owner,
                     lldb::addr_t m_addr,
                     lldb::tid_t tid,
                     bool use_hardware);

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Sun Jan 29 14:56:30 2012
@@ -435,7 +435,10 @@
     ///     isn't resolved yet.
     //------------------------------------------------------------------
     Module *
-    GetModule () const;
+    GetModulePtr () const;
+
+    lldb::ModuleSP
+    GetModuleSP () const;
 
     //------------------------------------------------------------------
     /// Get const accessor for the section.

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Sun Jan 29 14:56:30 2012
@@ -251,7 +251,7 @@
 
 
 class Debugger :
-    public ReferenceCountedBaseVirtual<Debugger>,
+    public std::tr1::enable_shared_from_this<Debugger>,
     public UserID,
     public DebuggerInstanceSettings
 {
@@ -315,9 +315,6 @@
     
     void Clear();
 
-    lldb::DebuggerSP
-    GetSP ();
-
     bool
     GetAsyncExecution ();
 

Modified: lldb/trunk/include/lldb/Core/FormatClasses.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatClasses.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatClasses.h (original)
+++ lldb/trunk/include/lldb/Core/FormatClasses.h Sun Jan 29 14:56:30 2012
@@ -57,7 +57,7 @@
                  bool skipptr = false,
                  bool skipref = false);
     
-    typedef lldb::SharedPtr<ValueFormat>::Type SharedPointer;
+    typedef SHARED_PTR(ValueFormat) SharedPointer;
     typedef bool(*ValueCallback)(void*, ConstString, const lldb::ValueFormatSP&);
     
     ~ValueFormat()
@@ -115,7 +115,7 @@
     virtual void
     Update() = 0;
     
-    typedef lldb::SharedPtr<SyntheticChildrenFrontEnd>::Type SharedPointer;
+    typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
 
 };
     
@@ -166,7 +166,7 @@
     virtual SyntheticChildrenFrontEnd::SharedPointer
     GetFrontEnd(lldb::ValueObjectSP backend) = 0;
     
-    typedef lldb::SharedPtr<SyntheticChildren>::Type SharedPointer;
+    typedef SHARED_PTR(SyntheticChildren) SharedPointer;
     typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
     
 };
@@ -266,7 +266,7 @@
             return UINT32_MAX;
         }
         
-        typedef lldb::SharedPtr<SyntheticChildrenFrontEnd>::Type SharedPointer;
+        typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
         
     };
     
@@ -351,7 +351,7 @@
             return m_interpreter->GetIndexOfChildWithName(m_wrapper, name.GetCString());
         }
         
-        typedef lldb::SharedPtr<SyntheticChildrenFrontEnd>::Type SharedPointer;
+        typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
         
     };
     
@@ -550,7 +550,7 @@
         virtual uint32_t
         GetIndexOfChildWithName (const ConstString &name_cs);
         
-        typedef lldb::SharedPtr<SyntheticChildrenFrontEnd>::Type SharedPointer;
+        typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
         
     };
     
@@ -628,7 +628,7 @@
     virtual std::string
     GetDescription() = 0;
     
-    typedef lldb::SharedPtr<SummaryFormat>::Type SharedPointer;
+    typedef SHARED_PTR(SummaryFormat) SharedPointer;
     typedef bool(*SummaryCallback)(void*, ConstString, const lldb::SummaryFormatSP&);
     typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::SummaryFormatSP&);
     
@@ -706,7 +706,7 @@
     virtual std::string
     GetDescription();
     
-    typedef lldb::SharedPtr<ScriptSummaryFormat>::Type SharedPointer;
+    typedef SHARED_PTR(ScriptSummaryFormat) SharedPointer;
 
 };
 

Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Sun Jan 29 14:56:30 2012
@@ -154,7 +154,7 @@
                 const char** matching_category = NULL,
                 FormatCategoryItems* matching_type = NULL);
     
-    typedef lldb::SharedPtr<FormatCategory>::Type SharedPointer;
+    typedef SHARED_PTR(FormatCategory) SharedPointer;
     
 private:
     SummaryNavigator::SharedPointer m_summary_nav;

Modified: lldb/trunk/include/lldb/Core/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatNavigator.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatNavigator.h (original)
+++ lldb/trunk/include/lldb/Core/FormatNavigator.h Sun Jan 29 14:56:30 2012
@@ -232,7 +232,7 @@
     typedef typename MapType::mapped_type MapValueType;
     typedef typename BackEndType::CallbackType CallbackType;
         
-    typedef typename lldb::SharedPtr<FormatNavigator<KeyType, ValueType> >::Type SharedPointer;
+    typedef typename std::tr1::shared_ptr<FormatNavigator<KeyType, ValueType> > SharedPointer;
     
     friend class FormatCategory;
 

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Sun Jan 29 14:56:30 2012
@@ -44,7 +44,7 @@
 namespace lldb_private {
 
 class Module :
-    public ReferenceCountedBaseVirtual<Module>,
+    public std::tr1::enable_shared_from_this<Module>,
     public SymbolContextScope
 {
 public:

Modified: lldb/trunk/include/lldb/Core/SearchFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SearchFilter.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/SearchFilter.h (original)
+++ lldb/trunk/include/lldb/Core/SearchFilter.h Sun Jan 29 14:56:30 2012
@@ -281,7 +281,7 @@
     public SearchFilter
 {
 public:
-    SearchFilterForNonModuleSpecificSearches (lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
+    SearchFilterForNonModuleSpecificSearches (const lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
     ~SearchFilterForNonModuleSpecificSearches () {}
     
     virtual bool 
@@ -311,7 +311,7 @@
     /// @param[in] module
     ///    The Module that limits the search.
     //------------------------------------------------------------------
-    SearchFilterByModule (lldb::TargetSP &targetSP,
+    SearchFilterByModule (const lldb::TargetSP &targetSP,
                           const FileSpec &module);
 
     SearchFilterByModule (const SearchFilterByModule& rhs);
@@ -372,8 +372,8 @@
     /// @param[in] module
     ///    The Module that limits the search.
     //------------------------------------------------------------------
-    SearchFilterByModuleList (lldb::TargetSP &targetSP,
-                          const FileSpecList &module_list);
+    SearchFilterByModuleList (const lldb::TargetSP &targetSP,
+                              const FileSpecList &module_list);
 
     SearchFilterByModuleList (const SearchFilterByModuleList& rhs);
 
@@ -433,9 +433,9 @@
     /// @param[in] module
     ///    The Module that limits the search.
     //------------------------------------------------------------------
-    SearchFilterByModuleListAndCU (lldb::TargetSP &targetSP,
-                          const FileSpecList &module_list,
-                          const FileSpecList &cu_list);
+    SearchFilterByModuleListAndCU (const lldb::TargetSP &targetSP,
+                                   const FileSpecList &module_list,
+                                   const FileSpecList &cu_list);
 
     SearchFilterByModuleListAndCU (const SearchFilterByModuleListAndCU& rhs);
 

Modified: lldb/trunk/include/lldb/Core/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/SourceManager.h (original)
+++ lldb/trunk/include/lldb/Core/SourceManager.h Sun Jan 29 14:56:30 2012
@@ -79,7 +79,7 @@
 
 #endif // SWIG
 
-    typedef lldb::SharedPtr<File>::Type FileSP;
+    typedef std::tr1::shared_ptr<File> FileSP;
 
 #ifndef SWIG
 

Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Sun Jan 29 14:56:30 2012
@@ -216,7 +216,7 @@
     void
     TransferAddress (bool force = false);
 
-    typedef lldb::SharedPtr<ValueObjectConstResult>::Type ValueObjectConstResultSP;
+    typedef SHARED_PTR(ValueObjectConstResult) ValueObjectConstResultSP;
 
     //----------------------------------------------------------------------
     /// Members

Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Sun Jan 29 14:56:30 2012
@@ -47,7 +47,7 @@
 class ClangUserExpression : public ClangExpression
 {
 public:
-    typedef lldb::SharedPtr<ClangUserExpression>::Type ClangUserExpressionSP;
+    typedef SHARED_PTR(ClangUserExpression) ClangUserExpressionSP;
     
     //------------------------------------------------------------------
     /// Constructor

Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Sun Jan 29 14:56:30 2012
@@ -30,7 +30,7 @@
 typedef std::pair<int, std::string> OptionArgValue;
 typedef std::pair<std::string, OptionArgValue> OptionArgPair;
 typedef std::vector<OptionArgPair> OptionArgVector;
-typedef lldb::SharedPtr<OptionArgVector>::Type OptionArgVectorSP;
+typedef SHARED_PTR(OptionArgVector) OptionArgVectorSP;
 
 struct OptionArgElement
 {

Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Sun Jan 29 14:56:30 2012
@@ -86,7 +86,7 @@
     //
     
     typedef std::vector < std::pair<lldb::ModuleSP, ClangNamespaceDecl> > NamespaceMap;
-    typedef lldb::SharedPtr<NamespaceMap>::Type NamespaceMapSP;
+    typedef SHARED_PTR(NamespaceMap) NamespaceMapSP;
     
     void RegisterNamespaceMap (const clang::NamespaceDecl *decl, 
                                NamespaceMapSP &namespace_map);
@@ -193,9 +193,9 @@
         clang::ASTContext  *m_source_ctx;
     };
     
-    typedef lldb::SharedPtr<Minion>::Type                                   MinionSP;
-    typedef std::map<clang::ASTContext *, MinionSP>                         MinionMap;
-    typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP>          NamespaceMetaMap;
+    typedef SHARED_PTR(Minion) MinionSP;
+    typedef std::map<clang::ASTContext *, MinionSP> MinionMap;
+    typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP> NamespaceMetaMap;
     
     struct ASTContextMetadata
     {
@@ -216,11 +216,10 @@
         MapCompleter           *m_map_completer;
     };
     
-    typedef lldb::SharedPtr<ASTContextMetadata>::Type               ASTContextMetadataSP;
-    
+    typedef SHARED_PTR(ASTContextMetadata) ASTContextMetadataSP;    
     typedef std::map<const clang::ASTContext *, ASTContextMetadataSP> ContextMetadataMap;
     
-    ContextMetadataMap      m_metadata_map;
+    ContextMetadataMap m_metadata_map;
     
     ASTContextMetadataSP
     GetContextMetadata (clang::ASTContext *dst_ctx)

Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Sun Jan 29 14:56:30 2012
@@ -78,7 +78,7 @@
                                   inst_length (0), ptr_encoding (0), initial_row() {}
     };
 
-    typedef lldb::SharedPtr<CIE>::Type CIESP;
+    typedef SHARED_PTR(CIE) CIESP;
 
     struct FDEEntry
     {

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Sun Jan 29 14:56:30 2012
@@ -50,7 +50,7 @@
 /// this abstract class.
 //----------------------------------------------------------------------
 class ObjectFile:
-    public ReferenceCountedBaseVirtual<ObjectFile>,
+    public std::tr1::enable_shared_from_this<ObjectFile>,
     public PluginInterface,
     public ModuleChild
 {
@@ -100,9 +100,6 @@
     virtual
     ~ObjectFile();
     
-    lldb::ObjectFileSP
-    GetSP ();
-
     //------------------------------------------------------------------
     /// Dump a description of this object to a Stream.
     ///

Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Sun Jan 29 14:56:30 2012
@@ -21,7 +21,7 @@
 namespace lldb_private {
 
 class SymbolFileType :
-    public ReferenceCountedBaseVirtual<SymbolFileType>,
+    public std::tr1::enable_shared_from_this<SymbolFileType>,
     public UserID
     {
     public:
@@ -50,7 +50,7 @@
     };
     
 class Type :
-    public ReferenceCountedBaseVirtual<Type>,
+    public std::tr1::enable_shared_from_this<Type>,
     public UserID
 {
 public:

Modified: lldb/trunk/include/lldb/Target/Memory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Memory.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Memory.h (original)
+++ lldb/trunk/include/lldb/Target/Memory.h Sun Jan 29 14:56:30 2012
@@ -163,7 +163,7 @@
         DeallocateMemory (lldb::addr_t ptr);
         
     protected:
-        typedef lldb::SharedPtr<AllocatedBlock>::Type AllocatedBlockSP;
+        typedef std::tr1::shared_ptr<AllocatedBlock> AllocatedBlockSP;
 
         AllocatedBlockSP
         AllocatePage (uint32_t byte_size, 

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Sun Jan 29 14:56:30 2012
@@ -1263,7 +1263,7 @@
 /// @brief A plug-in interface definition class for debugging a process.
 //----------------------------------------------------------------------
 class Process :
-    public ReferenceCountedBaseVirtual<Process>,
+    public std::tr1::enable_shared_from_this<Process>,
     public UserID,
     public Broadcaster,
     public ExecutionContextScope,
@@ -2769,7 +2769,7 @@
     ClearBreakpointSiteByID (lldb::user_id_t break_id);
 
     lldb::break_id_t
-    CreateBreakpointSite (lldb::BreakpointLocationSP &owner,
+    CreateBreakpointSite (const lldb::BreakpointLocationSP &owner,
                           bool use_hardware);
 
     Error
@@ -2997,9 +2997,6 @@
     virtual void
     CalculateExecutionContext (ExecutionContext &exe_ctx);
     
-    lldb::ProcessSP
-    GetSP ();
-    
     void
     SetSTDIOFileDescriptor (int file_descriptor);
 

Modified: lldb/trunk/include/lldb/Target/RegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RegisterContext.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/RegisterContext.h (original)
+++ lldb/trunk/include/lldb/Target/RegisterContext.h Sun Jan 29 14:56:30 2012
@@ -20,6 +20,7 @@
 namespace lldb_private {
 
 class RegisterContext :
+    public std::tr1::enable_shared_from_this<RegisterContext>,
     public ExecutionContextScope
 {
 public:

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Sun Jan 29 14:56:30 2012
@@ -27,7 +27,7 @@
 namespace lldb_private {
 
 class StackFrame :
-    public ReferenceCountedBaseVirtual<StackFrame>,
+    public std::tr1::enable_shared_from_this<StackFrame>,
     public ExecutionContextScope
 {
 public:
@@ -166,9 +166,6 @@
     virtual void
     CalculateExecutionContext (ExecutionContext &exe_ctx);
     
-    lldb::StackFrameSP
-    GetSP ();
-
     bool
     GetStatus (Stream &strm,
                bool show_frame_info,

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Sun Jan 29 14:56:30 2012
@@ -246,7 +246,7 @@
 // Target
 //----------------------------------------------------------------------
 class Target :
-    public ReferenceCountedBaseVirtual<Target>,
+    public std::tr1::enable_shared_from_this<Target>,
     public Broadcaster,
     public ExecutionContextScope,
     public TargetInstanceSettings
@@ -340,9 +340,6 @@
     const lldb::ProcessSP &
     GetProcessSP () const;
 
-    lldb::TargetSP
-    GetSP();
-    
     void
     Destroy();
 
@@ -912,7 +909,7 @@
         StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
         friend class Target;
     };
-    typedef lldb::SharedPtr<StopHook>::Type StopHookSP;
+    typedef SHARED_PTR(StopHook) StopHookSP;
     
     // Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook.  
     // Returns the id of the new hook.        

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Sun Jan 29 14:56:30 2012
@@ -85,7 +85,7 @@
 };
 
 class Thread :
-    public ReferenceCountedBaseVirtual<Thread>,
+    public std::tr1::enable_shared_from_this<Thread>,
     public UserID,
     public ExecutionContextScope,
     public ThreadInstanceSettings
@@ -233,9 +233,6 @@
     lldb::StateType
     GetState() const;
 
-    lldb::ThreadSP
-    GetSP ();
-
     void
     SetState (lldb::StateType state);
 
@@ -769,6 +766,7 @@
 protected:
 
     friend class ThreadPlan;
+    friend class ThreadList;
     friend class StackFrameList;
     
     // This is necessary to make sure thread assets get destroyed while the thread is still in good shape

Modified: lldb/trunk/include/lldb/Target/ThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadList.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadList.h Sun Jan 29 14:56:30 2012
@@ -59,6 +59,9 @@
     void
     Clear();
 
+    void
+    Destroy();
+
     // Note that "idx" is not the same as the "thread_index". It is a zero
     // based index to accessing the current threads, whereas "thread_index"
     // is a unique index assigned

Modified: lldb/trunk/include/lldb/Utility/PriorityPointerPair.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/PriorityPointerPair.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/PriorityPointerPair.h (original)
+++ lldb/trunk/include/lldb/Utility/PriorityPointerPair.h Sun Jan 29 14:56:30 2012
@@ -30,7 +30,7 @@
     typedef T& reference_type;
     typedef T* pointer_type;
     
-    typedef typename lldb::SharedPtr<T>::Type T_SP;
+    typedef typename SHARED_PTR(T) T_SP;
     
     PriorityPointerPair() : 
     m_high(),

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=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Sun Jan 29 14:56:30 2012
@@ -13,84 +13,84 @@
 #if defined(__cplusplus)
 
 #include "lldb/lldb-types.h"
+#include <tr1/memory> // for std::tr1::shared_ptr
 
 //----------------------------------------------------------------------
 // lldb forward declarations
 //----------------------------------------------------------------------
 namespace lldb {
 
-    typedef SharedPtr<lldb_private::ABI>::Type ABISP;
-    typedef SharedPtr<lldb_private::AddressResolver>::Type AddressResolverSP;
-    typedef SharedPtr<lldb_private::Baton>::Type BatonSP;
-    typedef SharedPtr<lldb_private::Block>::Type BlockSP;
-    typedef IntrusiveSharedPtr<lldb_private::Breakpoint>::Type BreakpointSP;
-    typedef IntrusiveSharedPtr<lldb_private::BreakpointSite>::Type BreakpointSiteSP;
-    typedef IntrusiveSharedPtr<lldb_private::BreakpointLocation>::Type BreakpointLocationSP;
-    typedef SharedPtr<lldb_private::BreakpointResolver>::Type BreakpointResolverSP;
-    typedef SharedPtr<lldb_private::Broadcaster>::Type BroadcasterSP;
-    typedef SharedPtr<lldb_private::ClangExpressionVariable>::Type ClangExpressionVariableSP;
-    typedef SharedPtr<lldb_private::CommandObject>::Type CommandObjectSP;
-    typedef SharedPtr<lldb_private::Communication>::Type CommunicationSP;
-    typedef SharedPtr<lldb_private::Connection>::Type ConnectionSP;
-    typedef SharedPtr<lldb_private::CompileUnit>::Type CompUnitSP;
-    typedef SharedPtr<lldb_private::DataBuffer>::Type DataBufferSP;
-    typedef SharedPtr<lldb_private::DataExtractor>::Type DataExtractorSP;
-    typedef IntrusiveSharedPtr<lldb_private::Debugger>::Type DebuggerSP;
-    typedef SharedPtr<lldb_private::Disassembler>::Type DisassemblerSP;
-    typedef SharedPtr<lldb_private::DynamicLoader>::Type DynamicLoaderSP;
-    typedef SharedPtr<lldb_private::Event>::Type EventSP;
-    typedef SharedPtr<lldb_private::FormatCategory>::Type FormatCategorySP;
-    typedef SharedPtr<lldb_private::Function>::Type FunctionSP;
-    typedef SharedPtr<lldb_private::InlineFunctionInfo>::Type InlineFunctionInfoSP;
-    typedef SharedPtr<lldb_private::InputReader>::Type InputReaderSP;
-    typedef SharedPtr<lldb_private::InstanceSettings>::Type InstanceSettingsSP;
-    typedef SharedPtr<lldb_private::Instruction>::Type InstructionSP;
-    typedef SharedPtr<lldb_private::LanguageRuntime>::Type LanguageRuntimeSP;
-    typedef SharedPtr<lldb_private::LineTable>::Type LineTableSP;
-    typedef SharedPtr<lldb_private::Listener>::Type ListenerSP;
-    typedef SharedPtr<lldb_private::Log>::Type LogSP;
-    typedef SharedPtr<lldb_private::LogChannel>::Type LogChannelSP;
-    typedef IntrusiveSharedPtr<lldb_private::Module>::Type ModuleSP;
-    typedef IntrusiveSharedPtr<lldb_private::ObjectFile>::Type ObjectFileSP;
-    typedef SharedPtr<lldb_private::OptionValue>::Type OptionValueSP;
-    typedef SharedPtr<lldb_private::Platform>::Type PlatformSP;
-    typedef IntrusiveSharedPtr<lldb_private::Process>::Type ProcessSP;
-    typedef SharedPtr<lldb_private::RegisterContext>::Type RegisterContextSP;
-    typedef SharedPtr<lldb_private::RegularExpression>::Type RegularExpressionSP;
-    typedef SharedPtr<lldb_private::Section>::Type SectionSP;
-    typedef SharedPtr<lldb_private::SearchFilter>::Type SearchFilterSP;
+    typedef std::tr1::shared_ptr<lldb_private::ABI> ABISP;
+    typedef std::tr1::shared_ptr<lldb_private::Baton> BatonSP;
+    typedef std::tr1::shared_ptr<lldb_private::Block> BlockSP;
+    typedef std::tr1::shared_ptr<lldb_private::Breakpoint> BreakpointSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::BreakpointSite> BreakpointSiteSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::BreakpointLocation> BreakpointLocationSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::BreakpointResolver> BreakpointResolverSP;
+    typedef std::tr1::shared_ptr<lldb_private::Broadcaster> BroadcasterSP;
+    typedef std::tr1::shared_ptr<lldb_private::ClangExpressionVariable> ClangExpressionVariableSP;
+    typedef std::tr1::shared_ptr<lldb_private::CommandObject> CommandObjectSP;
+    typedef std::tr1::shared_ptr<lldb_private::Communication> CommunicationSP;
+    typedef std::tr1::shared_ptr<lldb_private::Connection> ConnectionSP;
+    typedef std::tr1::shared_ptr<lldb_private::CompileUnit> CompUnitSP;
+    typedef std::tr1::shared_ptr<lldb_private::DataBuffer> DataBufferSP;
+    typedef std::tr1::shared_ptr<lldb_private::DataExtractor> DataExtractorSP;
+    typedef std::tr1::shared_ptr<lldb_private::Debugger> DebuggerSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::Disassembler> DisassemblerSP;
+    typedef std::tr1::shared_ptr<lldb_private::DynamicLoader> DynamicLoaderSP;
+    typedef std::tr1::shared_ptr<lldb_private::Event> EventSP;
+    typedef std::tr1::shared_ptr<lldb_private::FormatCategory> FormatCategorySP;
+    typedef std::tr1::shared_ptr<lldb_private::Function> FunctionSP;
+    typedef std::tr1::shared_ptr<lldb_private::InlineFunctionInfo> InlineFunctionInfoSP;
+    typedef std::tr1::shared_ptr<lldb_private::InputReader> InputReaderSP;
+    typedef std::tr1::shared_ptr<lldb_private::InstanceSettings> InstanceSettingsSP;
+    typedef std::tr1::shared_ptr<lldb_private::Instruction> InstructionSP;
+    typedef std::tr1::shared_ptr<lldb_private::LanguageRuntime> LanguageRuntimeSP;
+    typedef std::tr1::shared_ptr<lldb_private::LineTable> LineTableSP;
+    typedef std::tr1::shared_ptr<lldb_private::Listener> ListenerSP;
+    typedef std::tr1::shared_ptr<lldb_private::Log> LogSP;
+    typedef std::tr1::shared_ptr<lldb_private::LogChannel> LogChannelSP;
+    typedef std::tr1::shared_ptr<lldb_private::Module> ModuleSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::ObjectFile> ObjectFileSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::OptionValue> OptionValueSP;
+    typedef std::tr1::shared_ptr<lldb_private::Platform> PlatformSP;
+    typedef std::tr1::shared_ptr<lldb_private::Process> ProcessSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::RegisterContext> RegisterContextSP;
+    typedef std::tr1::shared_ptr<lldb_private::RegularExpression> RegularExpressionSP;
+    typedef std::tr1::shared_ptr<lldb_private::Section> SectionSP;
+    typedef std::tr1::shared_ptr<lldb_private::SearchFilter> SearchFilterSP;
 #ifndef LLDB_DISABLE_PYTHON
-    typedef SharedPtr<lldb_private::ScriptSummaryFormat>::Type ScriptFormatSP;
+    typedef std::tr1::shared_ptr<lldb_private::ScriptSummaryFormat> ScriptFormatSP;
 #endif // #ifndef LLDB_DISABLE_PYTHON
-    typedef IntrusiveSharedPtr<lldb_private::StackFrame>::Type StackFrameSP;
-    typedef SharedPtr<lldb_private::StackFrameList>::Type StackFrameListSP;
-    typedef SharedPtr<lldb_private::StopInfo>::Type StopInfoSP;
-    typedef SharedPtr<lldb_private::StoppointLocation>::Type StoppointLocationSP;
-    typedef SharedPtr<lldb_private::Stream>::Type StreamSP;
-    typedef SharedPtr<lldb_private::StringSummaryFormat>::Type StringSummaryFormatSP;
-    typedef SharedPtr<lldb_private::SummaryFormat>::Type SummaryFormatSP;
-    typedef SharedPtr<lldb_private::SymbolFile>::Type SymbolFileSP;
-    typedef IntrusiveSharedPtr<lldb_private::SymbolFileType>::Type SymbolFileTypeSP;
-    typedef SharedPtr<lldb_private::SymbolContextSpecifier>::Type SymbolContextSpecifierSP;
-    typedef SharedPtr<lldb_private::SyntheticChildren>::Type SyntheticChildrenSP;
-    typedef SharedPtr<lldb_private::SyntheticChildrenFrontEnd>::Type SyntheticChildrenFrontEndSP;
-    typedef IntrusiveSharedPtr<lldb_private::Target>::Type TargetSP;
-    typedef IntrusiveSharedPtr<lldb_private::Thread>::Type ThreadSP;
-    typedef SharedPtr<lldb_private::ThreadPlan>::Type ThreadPlanSP;
-    typedef SharedPtr<lldb_private::ThreadPlanTracer>::Type ThreadPlanTracerSP;
-    typedef IntrusiveSharedPtr<lldb_private::Type>::Type TypeSP;
-    typedef SharedPtr<lldb_private::TypeImpl>::Type TypeImplSP;
-    typedef SharedPtr<lldb_private::FuncUnwinders>::Type FuncUnwindersSP;
-    typedef SharedPtr<lldb_private::UserSettingsController>::Type UserSettingsControllerSP;
-    typedef SharedPtr<lldb_private::UnwindPlan>::Type UnwindPlanSP;
+    typedef std::tr1::shared_ptr<lldb_private::StackFrame> StackFrameSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::StackFrameList> StackFrameListSP;
+    typedef std::tr1::shared_ptr<lldb_private::StopInfo> StopInfoSP;
+    typedef std::tr1::shared_ptr<lldb_private::StoppointLocation> StoppointLocationSP;
+    typedef std::tr1::shared_ptr<lldb_private::Stream> StreamSP;
+    typedef std::tr1::shared_ptr<lldb_private::StringSummaryFormat> StringSummaryFormatSP;
+    typedef std::tr1::shared_ptr<lldb_private::SummaryFormat> SummaryFormatSP;
+    typedef std::tr1::shared_ptr<lldb_private::SymbolFile> SymbolFileSP;
+    typedef std::tr1::shared_ptr<lldb_private::SymbolFileType> SymbolFileTypeSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::SymbolContextSpecifier> SymbolContextSpecifierSP;
+    typedef std::tr1::shared_ptr<lldb_private::SyntheticChildren> SyntheticChildrenSP;
+    typedef std::tr1::shared_ptr<lldb_private::SyntheticChildrenFrontEnd> SyntheticChildrenFrontEndSP;
+    typedef std::tr1::shared_ptr<lldb_private::Target> TargetSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::Thread> ThreadSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::ThreadPlan> ThreadPlanSP;
+    typedef std::tr1::shared_ptr<lldb_private::ThreadPlanTracer> ThreadPlanTracerSP;
+    typedef std::tr1::shared_ptr<lldb_private::Type> TypeSP; // make_shared_from_this
+    typedef std::tr1::shared_ptr<lldb_private::TypeImpl> TypeImplSP;
+    typedef std::tr1::shared_ptr<lldb_private::FuncUnwinders> FuncUnwindersSP;
+    typedef std::tr1::shared_ptr<lldb_private::UserSettingsController> UserSettingsControllerSP;
+    typedef std::tr1::shared_ptr<lldb_private::UnwindPlan> UnwindPlanSP;
     typedef SharedPtr<lldb_private::ValueObject>::Type ValueObjectSP;
-    typedef SharedPtr<lldb_private::Value>::Type ValueSP;
-    typedef SharedPtr<lldb_private::ValueFormat>::Type ValueFormatSP;
-    typedef SharedPtr<lldb_private::ValueList>::Type ValueListSP;
-    typedef SharedPtr<lldb_private::Variable>::Type VariableSP;
-    typedef SharedPtr<lldb_private::VariableList>::Type VariableListSP;
-    typedef SharedPtr<lldb_private::ValueObjectList>::Type ValueObjectListSP;
-    typedef SharedPtr<lldb_private::Watchpoint>::Type WatchpointSP;
+    typedef std::tr1::shared_ptr<lldb_private::Value> ValueSP;
+    typedef std::tr1::shared_ptr<lldb_private::ValueFormat> ValueFormatSP;
+    typedef std::tr1::shared_ptr<lldb_private::ValueList> ValueListSP;
+    typedef std::tr1::shared_ptr<lldb_private::Variable> VariableSP;
+    typedef std::tr1::shared_ptr<lldb_private::VariableList> VariableListSP;
+    typedef std::tr1::shared_ptr<lldb_private::ValueObjectList> ValueObjectListSP;
+    typedef std::tr1::shared_ptr<lldb_private::Watchpoint> WatchpointSP;
 
 } // namespace lldb
 

Modified: lldb/trunk/include/lldb/lldb-types.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-types.h (original)
+++ lldb/trunk/include/lldb/lldb-types.h Sun Jan 29 14:56:30 2012
@@ -23,13 +23,13 @@
 
 //----------------------------------------------------------------------
 // All host systems must define:
-//  liblldb::condition_t       The native condition type (or a substitute class) for conditions on the host system.
-//  liblldb::mutex_t           The native mutex type for mutex objects on the host system.
-//  liblldb::thread_t          The native thread type for spawned threads on the system
-//  liblldb::thread_arg_t      The type of the one any only thread creation argument for the host system
-//  liblldb::thread_result_t   The return type that gets returned when a thread finishes.
-//  liblldb::thread_func_t     The function prototype used to spawn a thread on the host system.
-//  liblldb::SharedPtr         The template that wraps up the host version of a reference counted pointer (like boost::shared_ptr)
+//  lldb::condition_t       The native condition type (or a substitute class) for conditions on the host system.
+//  lldb::mutex_t           The native mutex type for mutex objects on the host system.
+//  lldb::thread_t          The native thread type for spawned threads on the system
+//  lldb::thread_arg_t      The type of the one any only thread creation argument for the host system
+//  lldb::thread_result_t   The return type that gets returned when a thread finishes.
+//  lldb::thread_func_t     The function prototype used to spawn a thread on the host system.
+//  lldb::SharedPtr         The template that wraps up the host version of a reference counted pointer (like boost::shared_ptr)
 //  #define LLDB_INVALID_PROCESS_ID ...
 //  #define LLDB_INVALID_THREAD_ID ...
 //  #define LLDB_INVALID_HOST_THREAD ...
@@ -64,17 +64,17 @@
         {
             typedef lldb_private::SharingPtr<_Tp> Type;
         };
-        template<typename _Tp>
-        struct LoggingSharedPtr
-        {
-            typedef lldb_private::LoggingSharingPtr<_Tp> Type;
-        };
-    
-        template <typename _Tp>
-        struct IntrusiveSharedPtr 
-        {
-            typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
-        };
+//        template<typename _Tp>
+//        struct LoggingSharedPtr
+//        {
+//            typedef lldb_private::LoggingSharingPtr<_Tp> Type;
+//        };
+//    
+//        template <typename _Tp>
+//        struct IntrusiveSharedPtr 
+//        {
+//            typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
+//        };
 
 } // namespace lldb
 
@@ -91,6 +91,7 @@
 
 #endif
 
+#define SHARED_PTR(T)   std::tr1::shared_ptr<T>
 #define LLDB_INVALID_HOST_TIME           { 0, 0 }
 
 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=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original)
+++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Sun Jan 29 14:56:30 2012
@@ -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"
@@ -132,6 +138,11 @@
          </EnvironmentVariable>
       </EnvironmentVariables>
       <AdditionalOptions>
+         <AdditionalOption
+            key = "MallocScribble"
+            value = ""
+            isEnabled = "YES">
+         </AdditionalOption>
       </AdditionalOptions>
    </LaunchAction>
    <ProfileAction

Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Sun Jan 29 14:56:30 2012
@@ -32,7 +32,7 @@
         }
 
         AddressImpl (const Address &addr) :
-            m_module_sp (addr.GetModule()),
+            m_module_sp (addr.GetModuleSP()),
             m_address (addr)
         {
         }
@@ -301,7 +301,7 @@
     {
         Module *module = m_opaque_ap->GetModule();
         if (module)
-            *sb_module = module;
+            *sb_module = module->shared_from_this();
     }
     return sb_module;
 }

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Sun Jan 29 14:56:30 2012
@@ -497,14 +497,14 @@
             Process *process = ctx->exe_ctx.GetProcessPtr();
             if (process)
             {
-                SBProcess sb_process (process->GetSP());
+                SBProcess sb_process (process->shared_from_this());
                 SBThread sb_thread;
                 SBBreakpointLocation sb_location;
                 assert (bp_sp);
                 sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id));
                 Thread *thread = ctx->exe_ctx.GetThreadPtr();
                 if (thread)
-                    sb_thread.SetThread(thread->GetSP());
+                    sb_thread.SetThread(thread->shared_from_this());
 
                 return data->callback (data->callback_baton, 
                                           sb_process, 

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Sun Jan 29 14:56:30 2012
@@ -301,7 +301,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
-        *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
+        *sb_bp = m_opaque_sp->GetBreakpoint ().shared_from_this();
     }
 
     if (log)

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Sun Jan 29 14:56:30 2012
@@ -553,7 +553,7 @@
     if (m_opaque_sp)
     {
         Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex());
-        sb_thread.SetThread (m_opaque_sp->GetThread().GetSP());
+        sb_thread.SetThread (m_opaque_sp->GetThread().shared_from_this());
     }
 
     if (log)

Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Sun Jan 29 14:56:30 2012
@@ -133,10 +133,10 @@
             target->CalculateExecutionContext (exe_ctx);
             exe_ctx.SetProcessSP(target->GetProcessSP());
         }
-        Module *module = m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule();
-        if (module)
+        ModuleSP module_sp = m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModuleSP();
+        if (module_sp)
         {
-            sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module->GetArchitecture(),
+            sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture(),
                                                                              NULL,
                                                                              exe_ctx,
                                                                              m_opaque_ptr->GetAddressRange()));

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Sun Jan 29 14:56:30 2012
@@ -238,7 +238,7 @@
 
     SBTarget sb_target;
     if (m_opaque_sp)
-        sb_target = m_opaque_sp->GetTarget().GetSP();
+        sb_target = m_opaque_sp->GetTarget().shared_from_this();
     
     if (log)
         log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", m_opaque_sp.get(), sb_target.get());

Modified: lldb/trunk/source/API/SBSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSection.cpp (original)
+++ lldb/trunk/source/API/SBSection.cpp Sun Jan 29 14:56:30 2012
@@ -29,7 +29,7 @@
             m_section (section)
         {
             if (section)
-                m_module_sp = section->GetModule();
+                m_module_sp = section->GetModule()->shared_from_this();
         }
         
         SectionImpl (const SectionImpl &rhs) :

Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Sun Jan 29 14:56:30 2012
@@ -131,10 +131,10 @@
         const AddressRange *symbol_range = m_opaque_ptr->GetAddressRangePtr();
         if (symbol_range)
         {
-            Module *module = symbol_range->GetBaseAddress().GetModule();
-            if (module)
+            ModuleSP module_sp = symbol_range->GetBaseAddress().GetModuleSP();
+            if (module_sp)
             {
-                sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module->GetArchitecture (),
+                sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture (),
                                                                                  NULL,
                                                                                  exe_ctx,
                                                                                  *symbol_range));

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Sun Jan 29 14:56:30 2012
@@ -119,7 +119,7 @@
 {
     SBDebugger debugger;
     if (m_opaque_sp)
-        debugger.reset (m_opaque_sp->GetDebugger().GetSP());
+        debugger.reset (m_opaque_sp->GetDebugger().shared_from_this());
     return debugger;
 }
 

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Sun Jan 29 14:56:30 2012
@@ -883,7 +883,7 @@
     {
         if (m_opaque_sp->GetExecutionContextScope())
         {
-            result = SBThread(m_opaque_sp->GetExecutionContextScope()->CalculateThread()->GetSP());
+            result = SBThread(m_opaque_sp->GetExecutionContextScope()->CalculateThread()->shared_from_this());
         }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -905,7 +905,7 @@
     {
         if (m_opaque_sp->GetExecutionContextScope())
         {
-            result.SetFrame (m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame()->GetSP());
+            result.SetFrame (m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame()->shared_from_this());
         }
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Sun Jan 29 14:56:30 2012
@@ -556,11 +556,3 @@
 {
     m_filter_sp->GetDescription (s);
 }
-
-const BreakpointSP
-Breakpoint::GetSP ()
-{
-    // This object contains an instrusive ref count base class so we can
-    // easily make a shared pointer to this object
-    return BreakpointSP (this);
-}

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Sun Jan 29 14:56:30 2012
@@ -149,11 +149,10 @@
 ThreadPlan *
 BreakpointLocation::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, Stream &error)
 {
-    lldb::BreakpointLocationSP this_sp(this);
     if (m_options_ap.get())
-        return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, this_sp, error);
+        return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error);
     else
-        return m_owner.GetThreadPlanToTestCondition (exe_ctx, this_sp, error);
+        return m_owner.GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error);
 }
 
 const char *
@@ -259,9 +258,7 @@
     if (m_owner.GetTarget().GetSectionLoadList().IsEmpty())
         return false;
 
-    BreakpointLocationSP this_sp(this);
-
-    lldb::break_id_t new_id = process->CreateBreakpointSite (this_sp, false);
+    lldb::break_id_t new_id = process->CreateBreakpointSite (shared_from_this(), false);
 
     if (new_id == LLDB_INVALID_BREAK_ID)
     {

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Sun Jan 29 14:56:30 2012
@@ -23,7 +23,7 @@
 BreakpointSite::BreakpointSite
 (
     BreakpointSiteList *list,
-    BreakpointLocationSP& owner,
+    const BreakpointLocationSP& owner,
     lldb::addr_t addr,
     lldb::tid_t tid,
     bool use_hardware
@@ -155,7 +155,7 @@
 }
 
 void
-BreakpointSite::AddOwner (BreakpointLocationSP &owner)
+BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
 {
     m_owners.Add(owner);
 }

Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Sun Jan 29 14:56:30 2012
@@ -148,7 +148,7 @@
         return false;
     }
     
-    Module *thread_module = thread_cur_frame->GetFrameCodeAddress ().GetModule ();
+    Module *thread_module = thread_cur_frame->GetFrameCodeAddress ().GetModulePtr ();
     if (!thread_module)
     {
         result.AppendError ("The PC has no associated module.");

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Sun Jan 29 14:56:30 2012
@@ -468,7 +468,7 @@
                     {
                         const bool show_inlines = true;
                         m_breakpoint_locations.Reset (last_file_sp->GetFileSpec(), 0, show_inlines);
-                        SearchFilter target_search_filter (target->GetSP());
+                        SearchFilter target_search_filter (target->shared_from_this());
                         target_search_filter.Search (m_breakpoint_locations);
                     }
                 }
@@ -570,7 +570,7 @@
                     {
                         const bool show_inlines = true;
                         m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines);
-                        SearchFilter target_search_filter (target->GetSP());
+                        SearchFilter target_search_filter (target->shared_from_this());
                         target_search_filter.Search (m_breakpoint_locations);
                     }
                     else

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Sun Jan 29 14:56:30 2012
@@ -1329,7 +1329,7 @@
         {
             if (!target->GetSectionLoadList().ResolveLoadAddress (addr, so_addr))
                 return false;
-            else if (so_addr.GetModule() != module)
+            else if (so_addr.GetModulePtr() != module)
                 return false;
         }
         else
@@ -1643,7 +1643,7 @@
             {
                 if (FileSpec::Equal(module->GetFileSpec(), module_file_spec, true))
                 {
-                    module_sp = module;
+                    module_sp = module->shared_from_this();
                     module_list.AppendIfNeeded(module_sp);
                 }
             }
@@ -2757,7 +2757,7 @@
                     Address module_address;
                     if (module_address.SetLoadAddress(m_options.m_module_addr, target))
                     {
-                        Module *module = module_address.GetModule();
+                        Module *module = module_address.GetModulePtr();
                         if (module)
                         {
                             PrintModule (strm, module);
@@ -2800,7 +2800,7 @@
                     if (use_global_module_list)
                     {
                         module = Module::GetAllocatedModuleAtIndex(image_idx);
-                        module_sp = module;
+                        module_sp = module->shared_from_this();
                     }
                     else
                     {
@@ -2874,7 +2874,7 @@
                     case 'r':
                         {
                             uint32_t ref_count = 0;
-                            ModuleSP module_sp (module);
+                            ModuleSP module_sp (module->shared_from_this());
                             if (module_sp)
                             {
                                 // Take one away to make sure we don't count our local "module_sp"

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Sun Jan 29 14:56:30 2012
@@ -75,7 +75,7 @@
     {
     }
     
-    typedef lldb::SharedPtr<ScriptAddOptions>::Type SharedPointer;
+    typedef SHARED_PTR(ScriptAddOptions) SharedPointer;
     
 };
 
@@ -108,7 +108,7 @@
     {
     }
     
-    typedef lldb::SharedPtr<SynthAddOptions>::Type SharedPointer;
+    typedef SHARED_PTR(SynthAddOptions) SharedPointer;
     
 };
 

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Sun Jan 29 14:56:30 2012
@@ -55,7 +55,7 @@
 
     if (byte_order == eByteOrderInvalid || addr_size == 0)
     {
-        Module *module = address.GetModule();
+        Module *module = address.GetModulePtr();
         if (module)
         {
             byte_order = module->GetArchitecture().GetByteOrder();
@@ -118,7 +118,7 @@
         {
             // If we were not running, yet able to read an integer, we must
             // have a module
-            Module *module = address.GetModule();
+            Module *module = address.GetModulePtr();
             assert (module);
             if (module->ResolveFileAddress(deref_addr, deref_so_addr))
                 return true;
@@ -248,13 +248,26 @@
 }
 
 Module *
-Address::GetModule () const
+Address::GetModulePtr () const
 {
     if (m_section)
         return m_section->GetModule();
     return NULL;
 }
 
+ModuleSP
+Address::GetModuleSP () const
+{
+    lldb::ModuleSP module_sp;
+    if (m_section)
+    {
+        Module *module = m_section->GetModule();
+        if (module)
+            module_sp = module->shared_from_this();
+    }
+    return module_sp;
+}
+
 addr_t
 Address::GetFileAddress () const
 {
@@ -434,7 +447,7 @@
             }
 
             uint32_t pointer_size = 4;
-            Module *module = GetModule();
+            Module *module = GetModulePtr();
             if (target)
                 pointer_size = target->GetArchitecture().GetAddressByteSize();
             else if (module)
@@ -670,7 +683,7 @@
     case DumpStyleDetailedSymbolContext:
         if (IsSectionOffset())
         {
-            Module *module = GetModule();
+            Module *module = GetModulePtr();
             if (module)
             {
                 SymbolContext sc;
@@ -738,7 +751,7 @@
         Module *address_module = m_section->GetModule();
         if (address_module)
         {
-            sc->module_sp = address_module;
+            sc->module_sp = address_module->shared_from_this();
             if (sc->module_sp)
                 return sc->module_sp->ResolveSymbolContextForAddress (*this, resolve_scope, *sc);
         }
@@ -760,7 +773,7 @@
     if (m_section)
     {
         SymbolContext sc;
-        sc.module_sp = m_section->GetModule();
+        sc.module_sp = m_section->GetModule()->shared_from_this();
         if (sc.module_sp)
         {
             sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextCompUnit, sc);
@@ -776,7 +789,7 @@
     if (m_section)
     {
         SymbolContext sc;
-        sc.module_sp = m_section->GetModule();
+        sc.module_sp = m_section->GetModule()->shared_from_this();
         if (sc.module_sp)
         {
             sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextFunction, sc);
@@ -792,7 +805,7 @@
     if (m_section)
     {
         SymbolContext sc;
-        sc.module_sp = m_section->GetModule();
+        sc.module_sp = m_section->GetModule()->shared_from_this();
         if (sc.module_sp)
         {
             sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextBlock, sc);
@@ -808,7 +821,7 @@
     if (m_section)
     {
         SymbolContext sc;
-        sc.module_sp = m_section->GetModule();
+        sc.module_sp = m_section->GetModule()->shared_from_this();
         if (sc.module_sp)
         {
             sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextSymbol, sc);
@@ -824,7 +837,7 @@
     if (m_section)
     {
         SymbolContext sc;
-        sc.module_sp = m_section->GetModule();
+        sc.module_sp = m_section->GetModule()->shared_from_this();
         if (sc.module_sp)
         {
             sc.module_sp->ResolveSymbolContextForAddress (*this, eSymbolContextLineEntry, sc);
@@ -868,8 +881,8 @@
 int
 Address::CompareModulePointerAndOffset (const Address& a, const Address& b)
 {
-    Module *a_module = a.GetModule ();
-    Module *b_module = b.GetModule ();
+    Module *a_module = a.GetModulePtr ();
+    Module *b_module = b.GetModulePtr ();
     if (a_module < b_module)
         return -1;
     if (a_module > b_module)
@@ -913,8 +926,8 @@
 bool
 lldb_private::operator< (const Address& lhs, const Address& rhs)
 {
-    Module *lhs_module = lhs.GetModule();
-    Module *rhs_module = rhs.GetModule();    
+    Module *lhs_module = lhs.GetModulePtr();
+    Module *rhs_module = rhs.GetModulePtr();    
     if (lhs_module == rhs_module)
     {
         // Addresses are in the same module, just compare the file addresses
@@ -931,8 +944,8 @@
 bool
 lldb_private::operator> (const Address& lhs, const Address& rhs)
 {
-    Module *lhs_module = lhs.GetModule();
-    Module *rhs_module = rhs.GetModule();    
+    Module *lhs_module = lhs.GetModulePtr();
+    Module *rhs_module = rhs.GetModulePtr();    
     if (lhs_module == rhs_module)
     {
         // Addresses are in the same module, just compare the file addresses
@@ -987,7 +1000,7 @@
 AddressClass
 Address::GetAddressClass () const
 {
-    Module *module = GetModule();
+    Module *module = GetModulePtr();
     if (module)
     {
         ObjectFile *obj_file = module->GetObjectFile();

Modified: lldb/trunk/source/Core/AddressRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressRange.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/AddressRange.cpp (original)
+++ lldb/trunk/source/Core/AddressRange.cpp Sun Jan 29 14:56:30 2012
@@ -177,7 +177,7 @@
     {
         if (show_module)
         {
-            Module *module = GetBaseAddress().GetModule();
+            Module *module = GetBaseAddress().GetModulePtr();
             if (module)
                 s->Printf("%s", module->GetFileSpec().GetFilename().AsCString());
         }

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Sun Jan 29 14:56:30 2012
@@ -263,14 +263,6 @@
 }
 
 DebuggerSP
-Debugger::GetSP ()
-{
-    // This object contains an instrusive ref count base class so we can
-    // easily make a shared pointer to this object
-    return DebuggerSP (this);
-}
-
-DebuggerSP
 Debugger::FindDebuggerWithInstanceName (const ConstString &instance_name)
 {
     DebuggerSP debugger_sp;

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Sun Jan 29 14:56:30 2012
@@ -383,7 +383,7 @@
 
             prev_sc = sc;
 
-            Module *module = addr.GetModule();
+            Module *module = addr.GetModulePtr();
             if (module)
             {
                 uint32_t resolved_mask = module->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Sun Jan 29 14:56:30 2012
@@ -224,7 +224,7 @@
         return;
 
     SymbolContext sc;
-    sc.module_sp = this;
+    sc.module_sp = shared_from_this();
     uint32_t cu_idx;
     SymbolVendor *symbols = GetSymbolVendor ();
 
@@ -258,7 +258,7 @@
 void
 Module::CalculateSymbolContext(SymbolContext* sc)
 {
-    sc->module_sp = this;
+    sc->module_sp = shared_from_this();
 }
 
 Module *
@@ -328,7 +328,7 @@
     {
         // If the section offset based address resolved itself, then this
         // is the right module.
-        sc.module_sp = this;
+        sc.module_sp = shared_from_this();
         resolved_flags |= eSymbolContextModule;
 
         // Resolve the compile unit, function, block, line table or line
@@ -430,7 +430,7 @@
     const uint32_t start_size = sc_list.GetSize();
     const uint32_t num_compile_units = GetNumCompileUnits();
     SymbolContext sc;
-    sc.module_sp = this;
+    sc.module_sp = shared_from_this();
     const bool compare_directory = path.GetDirectory();
     for (uint32_t i=0; i<num_compile_units; ++i)
     {

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Sun Jan 29 14:56:30 2012
@@ -585,7 +585,7 @@
 {
     // The address is already section offset so it has a module
     uint32_t resolved_flags = 0;
-    Module *module = so_addr.GetModule();
+    Module *module = so_addr.GetModulePtr();
     if (module)
     {
         resolved_flags = module->ResolveSymbolContextForAddress (so_addr,

Modified: lldb/trunk/source/Core/SearchFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/SearchFilter.cpp (original)
+++ lldb/trunk/source/Core/SearchFilter.cpp Sun Jan 29 14:56:30 2012
@@ -318,7 +318,7 @@
 // SearchFilterByModule constructors
 //----------------------------------------------------------------------
 
-SearchFilterByModule::SearchFilterByModule (lldb::TargetSP &target_sp, const FileSpec &module) :
+SearchFilterByModule::SearchFilterByModule (const lldb::TargetSP &target_sp, const FileSpec &module) :
     SearchFilter (target_sp),
     m_module_spec (module)
 {
@@ -430,7 +430,7 @@
         Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
         if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)
         {
-            SymbolContext matchingContext(m_target_sp, ModuleSP(module));
+            SymbolContext matchingContext(m_target_sp, module->shared_from_this());
             Searcher::CallbackReturn shouldContinue;
 
             shouldContinue = DoModuleIteration(matchingContext, searcher);
@@ -476,7 +476,7 @@
 // SearchFilterByModuleList constructors
 //----------------------------------------------------------------------
 
-SearchFilterByModuleList::SearchFilterByModuleList (lldb::TargetSP &target_sp, const FileSpecList &module_list) :
+SearchFilterByModuleList::SearchFilterByModuleList (const lldb::TargetSP &target_sp, const FileSpecList &module_list) :
     SearchFilter (target_sp),
     m_module_spec_list (module_list)
 {
@@ -594,7 +594,7 @@
         Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
         if (m_module_spec_list.FindFileIndex(0, module->GetFileSpec(), false) != UINT32_MAX)
         {
-            SymbolContext matchingContext(m_target_sp, ModuleSP(module));
+            SymbolContext matchingContext(m_target_sp, module->shared_from_this());
             Searcher::CallbackReturn shouldContinue;
 
             shouldContinue = DoModuleIteration(matchingContext, searcher);
@@ -664,7 +664,7 @@
 // SearchFilterByModuleListAndCU constructors
 //----------------------------------------------------------------------
 
-SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU (lldb::TargetSP &target_sp, 
+SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU (const lldb::TargetSP &target_sp, 
                                                               const FileSpecList &module_list,
                                                               const FileSpecList &cu_list) :
     SearchFilterByModuleList (target_sp, module_list),

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Sun Jan 29 14:56:30 2012
@@ -3490,7 +3490,7 @@
     Target *target = exe_ctx.GetTargetPtr();
     if (target != NULL)
     {
-        m_target_sp = target;
+        m_target_sp = target->shared_from_this();
         m_process_sp = exe_ctx.GetProcessSP();
         if (!m_process_sp)
             m_process_sp = target->GetProcessSP();

Modified: lldb/trunk/source/Core/ValueObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectMemory.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectMemory.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectMemory.cpp Sun Jan 29 14:56:30 2012
@@ -272,7 +272,7 @@
 Module *
 ValueObjectMemory::GetModule()
 {
-    return m_address.GetModule();
+    return m_address.GetModulePtr();
 }
 
 

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Sun Jan 29 14:56:30 2012
@@ -946,7 +946,7 @@
 NamespaceDecl *
 ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::NamespaceMapSP &namespace_decls)
 {
-    if (namespace_decls.empty())
+    if (!namespace_decls)
         return NULL;
     
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Sun Jan 29 14:56:30 2012
@@ -70,7 +70,7 @@
     // Can't make a ClangFunction without a process.
     assert (process != NULL);
         
-    m_jit_process_sp = process->GetSP();
+    m_jit_process_sp = process->shared_from_this();
 }
 
 ClangFunction::ClangFunction
@@ -95,7 +95,7 @@
     // Can't make a ClangFunction without a process.
     assert (process != NULL);
         
-    m_jit_process_sp = process->GetSP();
+    m_jit_process_sp = process->shared_from_this();
 
     m_function_addr = m_function_ptr->GetAddressRange().GetBaseAddress();
     m_function_return_qual_type = m_function_ptr->GetReturnClangType();
@@ -266,7 +266,7 @@
     if (!jit_error.Success())
         return false;
     if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
-        m_jit_process_sp = process->GetSP();
+        m_jit_process_sp = process->shared_from_this();
 
     return true;
 }

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Sun Jan 29 14:56:30 2012
@@ -357,7 +357,7 @@
     if (jit_error.Success())
     {
         if (process && m_jit_alloc != LLDB_INVALID_ADDRESS)
-            m_jit_process_sp = process->GetSP();        
+            m_jit_process_sp = process->shared_from_this();        
         return true;
     }
     else

Modified: lldb/trunk/source/Expression/ClangUtilityFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUtilityFunction.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUtilityFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangUtilityFunction.cpp Sun Jan 29 14:56:30 2012
@@ -148,7 +148,7 @@
     }
     
     if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
-        m_jit_process_sp = process->GetSP();
+        m_jit_process_sp = process->shared_from_this();
     
 #if 0
 	// jingham: look here

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Sun Jan 29 14:56:30 2012
@@ -69,8 +69,8 @@
     return s;
 }
 
-typedef lldb::SharedPtr <lldb_private::DataEncoder>::Type DataEncoderSP;
-typedef lldb::SharedPtr <lldb_private::DataExtractor>::Type DataExtractorSP;
+typedef SHARED_PTR(lldb_private::DataEncoder) DataEncoderSP;
+typedef SHARED_PTR(lldb_private::DataExtractor) DataExtractorSP;
 
 class Memory
 {
@@ -127,7 +127,7 @@
         }
     };
     
-    typedef lldb::SharedPtr <Allocation>::Type  AllocationSP;
+    typedef SHARED_PTR(Allocation)  AllocationSP;
     
     struct Region
     {

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Sun Jan 29 14:56:30 2012
@@ -2559,7 +2559,7 @@
             m_exe_ctx.SetProcessSP (process_sp);
             if (process_sp && process_sp->IsAlive() && !process_sp->IsRunning())
             {
-                ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread().get());
+                ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread());
                 if (thread_sp)
                 {
                     m_exe_ctx.SetThreadSP (thread_sp);

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Sun Jan 29 14:56:30 2012
@@ -1727,7 +1727,7 @@
         return false;
     }
     
-    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().GetSP();
+    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
 
     {
         Locker py_lock(this);
@@ -1837,7 +1837,7 @@
         return false;
     }
     
-    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().GetSP();
+    lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this();
 
     if (!debugger_sp.get())
     {

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Sun Jan 29 14:56:30 2012
@@ -122,7 +122,7 @@
     }
     else
     {
-        Module *module = inst_addr.GetModule();
+        Module *module = inst_addr.GetModulePtr();
         if (module)
         {
             if (module->ResolveFileAddress(operand_value, so_addr))

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Sun Jan 29 14:56:30 2012
@@ -1255,12 +1255,12 @@
         AddressRange *ar = sym_ctx.symbol->GetAddressRangePtr();
         if (ar)
         {
-            module_sp = ar->GetBaseAddress().GetModule();
+            module_sp = ar->GetBaseAddress().GetModuleSP();
         }
     }
     if (module_sp.get() == NULL && sym_ctx.function)
     {
-        module_sp = sym_ctx.function->GetAddressRange().GetBaseAddress().GetModule();
+        module_sp = sym_ctx.function->GetAddressRange().GetBaseAddress().GetModuleSP();
     }
     if (module_sp.get() == NULL)
         return false;
@@ -1522,7 +1522,7 @@
                         
                         Module* module_to_add = sc.symbol->CalculateSymbolContextModule();
                         if (module_to_add)
-                             modules_to_search.AppendIfNeeded(static_cast<ModuleSP>(module_to_add));
+                             modules_to_search.AppendIfNeeded(module_to_add->shared_from_this());
                     }
                     
                     // If the original stub symbol is a resolver, then we don't want to break on the symbol with the

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Sun Jan 29 14:56:30 2012
@@ -220,7 +220,7 @@
 {
     // Maybe check here and if we have a handler already, and the UUID of this module is the same as the one in the
     // current module, then we don't have to reread it?
-    m_objc_trampoline_handler_ap.reset(new AppleObjCTrampolineHandler (m_process->GetSP(), module_sp));
+    m_objc_trampoline_handler_ap.reset(new AppleObjCTrampolineHandler (m_process->shared_from_this(), module_sp));
     if (m_objc_trampoline_handler_ap.get() != NULL)
     {
         m_read_objc_library = true;

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp Sun Jan 29 14:56:30 2012
@@ -19,7 +19,7 @@
 
 AppleObjCSymbolVendor::AppleObjCSymbolVendor(Process *process) :
     SymbolVendor(NULL),
-    m_process(process->GetSP()),
+    m_process(process->shared_from_this()),
     m_ast_ctx(process->GetTarget().GetArchitecture().GetTriple().getTriple().c_str())
 {
 }

Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h Sun Jan 29 14:56:30 2012
@@ -118,7 +118,7 @@
     class Archive
     {
     public:
-        typedef lldb::SharedPtr<Archive>::Type shared_ptr;
+        typedef SHARED_PTR(Archive) shared_ptr;
         typedef std::multimap<lldb_private::FileSpec, shared_ptr> Map;
 
         static Map &

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp Sun Jan 29 14:56:30 2012
@@ -104,7 +104,7 @@
     // Now make a new log with this stream if one was provided
     if (log_stream_sp)
     {
-        log = make_shared<Log>(log_stream_sp);
+        log.reset (new Log(log_stream_sp));
         GetLog () = log;
     }
 

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Sun Jan 29 14:56:30 2012
@@ -126,7 +126,7 @@
         {
             m_current_offset = frame_sp->GetFrameCodeAddress().GetOffset() - m_start_pc.GetOffset();
         }
-        else if (frame_sp->GetFrameCodeAddress().GetModule() == m_start_pc.GetModule())
+        else if (frame_sp->GetFrameCodeAddress().GetModulePtr() == m_start_pc.GetModulePtr())
         {
             // This means that whatever symbol we kicked up isn't really correct
             // as no should cross section boundaries... We really should NULL out
@@ -284,7 +284,7 @@
 
     // If we don't have a Module for some reason, we're not going to find symbol/function information - just
     // stick in some reasonable defaults and hope we can unwind past this frame.
-    if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL)
+    if (!m_current_pc.IsValid() || m_current_pc.GetModulePtr() == NULL)
     {
         if (log)
         {
@@ -397,7 +397,7 @@
     }
 
     // We require that eSymbolContextSymbol be successfully filled in or this context is of no use to us.
-    if ((m_current_pc.GetModule()->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
+    if ((m_current_pc.GetModulePtr()->ResolveSymbolContextForAddress (m_current_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
     {
         m_sym_ctx_valid = true;
     }
@@ -436,7 +436,7 @@
         temporary_pc.SetOffset(m_current_pc.GetOffset() - 1);
         m_sym_ctx.Clear();
         m_sym_ctx_valid = false;
-        if ((m_current_pc.GetModule()->ResolveSymbolContextForAddress (temporary_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
+        if ((m_current_pc.GetModulePtr()->ResolveSymbolContextForAddress (temporary_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol)
         {
             m_sym_ctx_valid = true;
         }
@@ -619,13 +619,13 @@
 RegisterContextLLDB::GetFastUnwindPlanForFrame ()
 {
     UnwindPlanSP unwind_plan_sp;
-    if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL || m_current_pc.GetModule()->GetObjectFile() == NULL)
+    if (!m_current_pc.IsValid() || m_current_pc.GetModulePtr() == NULL || m_current_pc.GetModulePtr()->GetObjectFile() == NULL)
         return unwind_plan_sp;
 
     if (IsFrameZero ())
         return unwind_plan_sp;
 
-    FuncUnwindersSP func_unwinders_sp (m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx));
+    FuncUnwindersSP func_unwinders_sp (m_current_pc.GetModulePtr()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx));
     if (!func_unwinders_sp)
         return unwind_plan_sp;
 
@@ -712,7 +712,7 @@
     }
 
     // No Module for the current pc, try using the architecture default unwind.
-    if (!m_current_pc.IsValid() || m_current_pc.GetModule() == NULL || m_current_pc.GetModule()->GetObjectFile() == NULL)
+    if (!m_current_pc.IsValid() || m_current_pc.GetModulePtr() == NULL || m_current_pc.GetModulePtr()->GetObjectFile() == NULL)
     {
         m_frame_type = eNormalFrame;
         return arch_default_unwind_plan_sp;
@@ -721,7 +721,7 @@
     FuncUnwindersSP func_unwinders_sp;
     if (m_sym_ctx_valid)
     {
-        func_unwinders_sp = m_current_pc.GetModule()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx);
+        func_unwinders_sp = m_current_pc.GetModulePtr()->GetObjectFile()->GetUnwindTable().GetFuncUnwindersContainingAddress (m_current_pc, m_sym_ctx);
     }
 
     // No FuncUnwinders available for this pc, try using architectural default unwind.

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h Sun Jan 29 14:56:30 2012
@@ -25,7 +25,7 @@
 class RegisterContextLLDB : public lldb_private::RegisterContext
 {
 public:
-    typedef lldb::SharedPtr<RegisterContextLLDB>::Type SharedPtr;
+    typedef SHARED_PTR(RegisterContextLLDB) SharedPtr;
 
     RegisterContextLLDB (lldb_private::Thread &thread,
                          const SharedPtr& next_frame,

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Sun Jan 29 14:56:30 2012
@@ -69,10 +69,10 @@
 {
     // First, set up the 0th (initial) frame
     CursorSP first_cursor_sp(new Cursor ());
-    RegisterContextLLDBSharedPtr reg_ctx_sp (new RegisterContextLLDB (m_thread, 
-                                                                        RegisterContextLLDBSharedPtr(), 
-                                                                        first_cursor_sp->sctx, 
-                                                                        0, *this));
+    RegisterContextLLDBSP reg_ctx_sp (new RegisterContextLLDB (m_thread, 
+                                                               RegisterContextLLDBSP(), 
+                                                               first_cursor_sp->sctx, 
+                                                               0, *this));
     if (reg_ctx_sp.get() == NULL)
         return false;
     
@@ -87,7 +87,7 @@
 
     // Everything checks out, so release the auto pointer value and let the
     // cursor own it in its shared pointer
-    first_cursor_sp->reg_ctx = reg_ctx_sp;
+    first_cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
     m_frames.push_back (first_cursor_sp);
     return true;
 }
@@ -104,10 +104,11 @@
         return false;
 
     uint32_t cur_idx = m_frames.size ();
-    RegisterContextLLDBSharedPtr reg_ctx_sp(new RegisterContextLLDB (m_thread, 
-                                                                       m_frames[cur_idx - 1]->reg_ctx, 
-                                                                       cursor_sp->sctx, 
-                                                                       cur_idx, *this));
+    RegisterContextLLDBSP reg_ctx_sp(new RegisterContextLLDB (m_thread, 
+                                                              m_frames[cur_idx - 1]->reg_ctx_lldb_sp, 
+                                                              cursor_sp->sctx, 
+                                                              cur_idx, 
+                                                              *this));
     if (reg_ctx_sp.get() == NULL)
         return false;
 
@@ -171,7 +172,7 @@
             }
         }
     }
-    cursor_sp->reg_ctx = reg_ctx_sp;
+    cursor_sp->reg_ctx_lldb_sp = reg_ctx_sp;
     m_frames.push_back (cursor_sp);
     return true;
 }
@@ -218,21 +219,27 @@
 
     ABI *abi = m_thread.GetProcess().GetABI().get();
 
-    while (idx >= m_frames.size() && AddOneMoreFrame (abi))
-        ;
+    while (idx >= m_frames.size())
+    {
+        if (!AddOneMoreFrame (abi))
+            break;
+    }
 
-    if (idx < m_frames.size ())
-        reg_ctx_sp = m_frames[idx]->reg_ctx;
+    const uint32_t num_frames = m_frames.size();
+    if (idx < num_frames)
+    {
+        Cursor *frame_cursor = m_frames[idx].get();
+        reg_ctx_sp = frame_cursor->reg_ctx_lldb_sp->shared_from_this();
+    }
     return reg_ctx_sp;
 }
 
-UnwindLLDB::RegisterContextLLDBSharedPtr
+UnwindLLDB::RegisterContextLLDBSP
 UnwindLLDB::GetRegisterContextForFrameNum (uint32_t frame_num)
 {
-    RegisterContextLLDBSharedPtr reg_ctx_sp;
-    if (frame_num >= m_frames.size())
-        return reg_ctx_sp;
-    reg_ctx_sp = m_frames[frame_num]->reg_ctx;
+    RegisterContextLLDBSP reg_ctx_sp;
+    if (frame_num < m_frames.size())
+        reg_ctx_sp = m_frames[frame_num]->reg_ctx_lldb_sp;
     return reg_ctx_sp;
 }
 
@@ -244,7 +251,7 @@
         return false;
     while (frame_num >= 0)
     {
-        if (m_frames[frame_num]->reg_ctx->SavedLocationForRegister (lldb_regnum, regloc, false))
+        if (m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister (lldb_regnum, regloc, false))
             return true;
         frame_num--;
     }

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Sun Jan 29 14:56:30 2012
@@ -69,11 +69,11 @@
     lldb::RegisterContextSP
     DoCreateRegisterContextForFrame (lldb_private::StackFrame *frame);
 
-    typedef lldb::SharedPtr<lldb_private::RegisterContextLLDB>::Type RegisterContextLLDBSharedPtr;
+    typedef SHARED_PTR(RegisterContextLLDB) RegisterContextLLDBSP;
 
     // Needed to retrieve the "next" frame (e.g. frame 2 needs to retrieve frame 1's RegisterContextLLDB)
     // The RegisterContext for frame_num must already exist or this returns an empty shared pointer.
-    RegisterContextLLDBSharedPtr
+    RegisterContextLLDBSP
     GetRegisterContextForFrameNum (uint32_t frame_num);
 
     // Iterate over the RegisterContextLLDB's in our m_frames vector, look for the first one that
@@ -89,14 +89,14 @@
         lldb::addr_t start_pc;  // The start address of the function/symbol for this frame - current pc if unknown
         lldb::addr_t cfa;       // The canonical frame address for this stack frame
         lldb_private::SymbolContext sctx;  // A symbol context we'll contribute to & provide to the StackFrame creation
-        RegisterContextLLDBSharedPtr reg_ctx; // These are all RegisterContextLLDB's
+        RegisterContextLLDBSP reg_ctx_lldb_sp; // These are all RegisterContextLLDB's
 
-        Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { }
+        Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx_lldb_sp() { }
     private:
         DISALLOW_COPY_AND_ASSIGN (Cursor);
     };
 
-    typedef lldb::SharedPtr<Cursor>::Type CursorSP;
+    typedef SHARED_PTR(Cursor) CursorSP;
     std::vector<CursorSP> m_frames;
 
     bool AddOneMoreFrame (ABI *abi);

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Sun Jan 29 14:56:30 2012
@@ -104,7 +104,7 @@
     // Now make a new log with this stream if one was provided
     if (log_stream_sp)
     {
-        log = make_shared<Log>(log_stream_sp);
+        log.reset (new Log(log_stream_sp));
         GetLog () = log;
     }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Sun Jan 29 14:56:30 2012
@@ -21,7 +21,7 @@
 typedef CStringToDIEMap::iterator CStringToDIEMapIter;
 typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
 
-typedef lldb::SharedPtr<DWARFCompileUnit>::Type DWARFCompileUnitSP;
+typedef SHARED_PTR(DWARFCompileUnit) DWARFCompileUnitSP;
 
 class DWARFDebugInfo
 {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h Sun Jan 29 14:56:30 2012
@@ -68,7 +68,7 @@
         {
         }
 
-        typedef lldb::SharedPtr<Prologue>::Type shared_ptr;
+        typedef SHARED_PTR(Prologue) shared_ptr;
 
         uint32_t    total_length;   // The size in bytes of the statement information for this compilation unit (not including the total_length field itself).
         uint16_t    version;        // Version identifier for the statement information format.
@@ -135,7 +135,7 @@
     //------------------------------------------------------------------
     struct LineTable
     {
-        typedef lldb::SharedPtr<LineTable>::Type shared_ptr;
+        typedef SHARED_PTR(LineTable) shared_ptr;
 
         LineTable() :
             prologue(),

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sun Jan 29 14:56:30 2012
@@ -2031,7 +2031,7 @@
         
     if (sc.function)
     {        
-        sc.module_sp = sc.function->CalculateSymbolContextModule();
+        sc.module_sp = sc.function->CalculateSymbolContextModule()->shared_from_this();
         return true;
     }
     
@@ -2449,7 +2449,7 @@
     if (num_matches)
     {
         SymbolContext sc;
-        sc.module_sp = m_obj_file->GetModule();
+        sc.module_sp = m_obj_file->GetModule()->shared_from_this();
         assert (sc.module_sp);
         
         DWARFDebugInfo* debug_info = DebugInfo();
@@ -2535,7 +2535,7 @@
     }
 
     SymbolContext sc;
-    sc.module_sp = m_obj_file->GetModule();
+    sc.module_sp = m_obj_file->GetModule()->shared_from_this();
     assert (sc.module_sp);
     
     DWARFCompileUnit* dwarf_cu = NULL;
@@ -3149,7 +3149,7 @@
                 if (matching_type)
                 {
                     // We found a type pointer, now find the shared pointer form our type list
-                    types.InsertUnique (TypeSP (matching_type));
+                    types.InsertUnique (matching_type->shared_from_this());
                     if (types.GetSize() >= max_matches)
                         break;
                 }
@@ -3267,7 +3267,7 @@
         if (matching_type)
         {
             // We found a type pointer, now find the shared pointer form our type list
-            types.InsertUnique (TypeSP (matching_type));
+            types.InsertUnique (matching_type->shared_from_this());
             ++num_matches;
             if (num_matches >= max_matches)
                 break;
@@ -3282,7 +3282,6 @@
 size_t
 SymbolFileDWARF::ParseChildParameters (const SymbolContext& sc,
                                        clang::DeclContext *containing_decl_ctx,
-                                       TypeSP& type_sp,
                                        DWARFCompileUnit* dwarf_cu,
                                        const DWARFDebugInfoEntry *parent_die,
                                        bool skip_artificial,
@@ -3676,7 +3675,7 @@
         else if (type_ptr != DIE_IS_BEING_PARSED)
         {
             // Grab the existing type from the master types lists
-            type_sp = type_ptr;
+            type_sp = type_ptr->shared_from_this();
         }
 
     }
@@ -4026,7 +4025,7 @@
                             
                             if (die)
                                 m_die_to_type[die] = resolved_type;
-                            type_sp = resolved_type;
+                            type_sp = resolved_type->shared_from_this();
                             break;
                         }
                     }
@@ -4148,7 +4147,7 @@
                                       MakeUserID(type_cu->GetOffset()));
                         
                         m_die_to_type[die] = resolved_type;
-                        type_sp = resolved_type;
+                        type_sp = resolved_type->shared_from_this();
                         break;
                     }
                 }
@@ -4934,7 +4933,6 @@
                         bool skip_artificial = true;
                         ParseChildParameters (sc, 
                                               containing_decl_ctx,
-                                              type_sp, 
                                               dwarf_cu, 
                                               die, 
                                               skip_artificial,
@@ -5120,7 +5118,7 @@
                                                 type_ptr = m_die_to_type[die];
                                                 if (type_ptr)
                                                 {
-                                                    type_sp = type_ptr;
+                                                    type_sp = type_ptr->shared_from_this();
                                                     break;
                                                 }
                                             }
@@ -5343,7 +5341,7 @@
         }
         else if (type_ptr != DIE_IS_BEING_PARSED)
         {
-            type_sp = type_ptr;
+            type_sp = type_ptr->shared_from_this();
         }
     }
     return type_sp;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Sun Jan 29 14:56:30 2012
@@ -347,7 +347,6 @@
     size_t                  ParseChildParameters(
                                 const lldb_private::SymbolContext& sc,
                                 clang::DeclContext *containing_decl_ctx,
-                                lldb::TypeSP& type_sp,
                                 DWARFCompileUnit* dwarf_cu,
                                 const DWARFDebugInfoEntry *parent_die,
                                 bool skip_artificial,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Sun Jan 29 14:56:30 2012
@@ -172,10 +172,10 @@
             // use the debug map, to add new sections to each .o file and
             // even though a .o file might not have changed, the sections
             // that get added to the .o file can change.
-            comp_unit_info->oso_module_sp = new Module (oso_file_spec, 
-                                                        m_obj_file->GetModule()->GetArchitecture(),
-                                                        NULL, 
-                                                        0);
+            comp_unit_info->oso_module_sp.reset (new Module (oso_file_spec, 
+                                                             m_obj_file->GetModule()->GetArchitecture(),
+                                                             NULL, 
+                                                             0));
         }
     }
     return comp_unit_info->oso_module_sp.get();

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Sun Jan 29 14:56:30 2012
@@ -141,7 +141,7 @@
         lldb_private::SymbolVendor *oso_symbol_vendor;
         std::vector<uint32_t> function_indexes;
         std::vector<uint32_t> static_indexes;
-        lldb::SharedPtr<lldb_private::SectionList>::Type debug_map_sections_sp;
+        SHARED_PTR(lldb_private::SectionList) debug_map_sections_sp;
 
         CompileUnitInfo() :
             so_file (),

Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Sun Jan 29 14:56:30 2012
@@ -411,7 +411,7 @@
         
         Declaration decl;
         
-        lldb::TypeSP type(new Type (iter->second,
+        lldb::TypeSP type(new Type (match->value,
                                     this,
                                     name,
                                     0,      // byte_size - don't change this from 0, we currently use that to identify these "synthetic" ObjC class types.

Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Sun Jan 29 14:56:30 2012
@@ -162,7 +162,7 @@
             // Just create our symbol vendor using the current objfile as this is either
             // an executable with no dSYM (that we could locate), an executable with
             // a dSYM that has a UUID that doesn't match.
-            symbol_vendor->AddSymbolFileRepresentation(obj_file->GetSP());
+            symbol_vendor->AddSymbolFileRepresentation(obj_file->shared_from_this());
         }
     }
     return symbol_vendor;

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Sun Jan 29 14:56:30 2012
@@ -276,14 +276,6 @@
     return eAddressClassUnknown;
 }
 
-ObjectFileSP
-ObjectFile::GetSP ()
-{
-    // This object contains an instrusive ref count base class so we can
-    // easily make a shared pointer to this object
-    return ObjectFileSP (this);
-}
-
 size_t
 ObjectFile::GetData (off_t offset, size_t length, DataExtractor &data) const
 {

Modified: lldb/trunk/source/Symbol/Symbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symbol.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symbol.cpp (original)
+++ lldb/trunk/source/Symbol/Symbol.cpp Sun Jan 29 14:56:30 2012
@@ -267,7 +267,7 @@
         if (!m_type_data_resolved)
         {
             m_type_data_resolved = true;
-            Module *module = m_addr_range.GetBaseAddress().GetModule();
+            Module *module = m_addr_range.GetBaseAddress().GetModulePtr();
             SymbolContext sc;
             if (module && module->ResolveSymbolContextForAddress (m_addr_range.GetBaseAddress(),
                                                                   eSymbolContextLineEntry,
@@ -350,15 +350,9 @@
     sc->symbol = this;
     const AddressRange *range = GetAddressRangePtr();
     if (range)
-    {   
-        Module *module = range->GetBaseAddress().GetModule ();
-        if (module)
-        {
-            sc->module_sp = module;
-            return;
-        }
-    }
-    sc->module_sp.reset();
+        sc->module_sp = range->GetBaseAddress().GetModuleSP ();
+    else
+        sc->module_sp.reset();
 }
 
 Module *
@@ -366,7 +360,7 @@
 {
     const AddressRange *range = GetAddressRangePtr();
     if (range)
-        return range->GetBaseAddress().GetModule ();
+        return range->GetBaseAddress().GetModulePtr ();
     return NULL;
 }
 
@@ -384,7 +378,7 @@
     const AddressRange *range = GetAddressRangePtr();
     if (range)
     {   
-        Module *module = range->GetBaseAddress().GetModule ();
+        Module *module = range->GetBaseAddress().GetModulePtr ();
         if (module)
         {
             dumped_module = true;

Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Sun Jan 29 14:56:30 2012
@@ -58,7 +58,7 @@
     {
         ObjectFile *objfile = module->GetObjectFile();
         if (objfile)
-            instance_ap->AddSymbolFileRepresentation(objfile->GetSP());
+            instance_ap->AddSymbolFileRepresentation(objfile->shared_from_this());
     }
     return instance_ap.release();
 }

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Sun Jan 29 14:56:30 2012
@@ -34,7 +34,7 @@
 SymbolFileType::GetType ()
 {
     if (!m_type_sp)
-        m_type_sp = m_symbol_file.ResolveTypeUID (GetID());
+        m_type_sp = m_symbol_file.ResolveTypeUID (GetID())->shared_from_this();
     return m_type_sp.get();
 }
 

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Sun Jan 29 14:56:30 2012
@@ -243,7 +243,7 @@
     {
         SymbolContext sc;
         CalculateSymbolContext(&sc);
-        if (sc.module_sp.get() == address.GetModule())
+        if (sc.module_sp.get() == address.GetModulePtr())
         {
             // Is the variable is described by a single location?
             if (!m_location.IsLocationList())
@@ -480,7 +480,7 @@
     {
         SymbolContext sc;
         CalculateSymbolContext(&sc);
-        if (sc.module_sp.get() == address.GetModule())
+        if (sc.module_sp.get() == address.GetModulePtr())
         {
             ABI *abi = NULL;
             if (m_owner_scope)

Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Sun Jan 29 14:56:30 2012
@@ -46,7 +46,7 @@
 }
 
 ExecutionContext::ExecutionContext (Target* t, bool fill_current_process_thread_frame) :
-    m_target_sp (t),
+    m_target_sp (t->shared_from_this()),
     m_process_sp (),
     m_thread_sp (),
     m_frame_sp ()
@@ -58,17 +58,19 @@
         {
             m_thread_sp = m_process_sp->GetThreadList().GetSelectedThread();
             if (m_thread_sp)
-                m_frame_sp = m_thread_sp->GetSelectedFrame().get();
+                m_frame_sp = m_thread_sp->GetSelectedFrame();
         }
     }
 }
 
 ExecutionContext::ExecutionContext(Process* process, Thread *thread, StackFrame *frame) :
-    m_target_sp (process ? &process->GetTarget() : NULL),
-    m_process_sp (process),
-    m_thread_sp (thread),
-    m_frame_sp (frame)
+    m_target_sp (),
+    m_process_sp (process->shared_from_this()),
+    m_thread_sp (thread->shared_from_this()),
+    m_frame_sp (frame->shared_from_this())
 {
+    if (process)
+        m_target_sp = process->GetTarget().shared_from_this();
 }
 
 ExecutionContext::ExecutionContext (ExecutionContextScope *exe_scope_ptr)
@@ -200,24 +202,36 @@
 void
 ExecutionContext::SetTargetPtr (Target* target)
 {
-    m_target_sp = target;
+    if (target)
+        m_target_sp = target->shared_from_this();
+    else
+        m_target_sp.reset();
 }
 
 void
 ExecutionContext::SetProcessPtr (Process *process)
 {
-    m_process_sp = process;
+    if (process)
+        m_process_sp = process->shared_from_this();
+    else
+        m_process_sp.reset();
 }
 
 void
 ExecutionContext::SetThreadPtr (Thread *thread)
 {
-    m_thread_sp = thread;
+    if (thread)
+        m_thread_sp = thread->shared_from_this();
+    else
+        m_thread_sp.reset();
 }
 
 void
 ExecutionContext::SetFramePtr (StackFrame *frame)
 {
-    m_frame_sp = frame;
+    if (frame)
+        m_frame_sp = frame->shared_from_this();
+    else
+        m_frame_sp.reset();
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Sun Jan 29 14:56:30 2012
@@ -848,7 +848,7 @@
     m_abi_sp.reset();
     m_os_ap.reset();
     m_dyld_ap.reset();
-    m_thread_list.Clear();
+    m_thread_list.Destroy();
     std::vector<Notifications> empty_notifications;
     m_notifications.swap(empty_notifications);
     m_image_tokens.clear();
@@ -1543,7 +1543,7 @@
 }
 
 lldb::break_id_t
-Process::CreateBreakpointSite (BreakpointLocationSP &owner, bool use_hardware)
+Process::CreateBreakpointSite (const BreakpointLocationSP &owner, bool use_hardware)
 {
     const addr_t load_addr = owner->GetAddress().GetOpcodeLoadAddress (&m_target);
     if (load_addr != LLDB_INVALID_ADDRESS)
@@ -3410,12 +3410,6 @@
     exe_ctx.SetFramePtr (NULL);
 }
 
-lldb::ProcessSP
-Process::GetSP ()
-{
-    return GetTarget().GetProcessSP();
-}
-
 //uint32_t
 //Process::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
 //{
@@ -3680,13 +3674,10 @@
 Process::UpdateInstanceName ()
 {
     Module *module = GetTarget().GetExecutableModulePointer();
-    if (module)
+    if (module && module->GetFileSpec().GetFilename())
     {
-        StreamString sstr;
-        sstr.Printf ("%s", module->GetFileSpec().GetFilename().AsCString());
-                    
         GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
-                                                         sstr.GetData());
+                                                         module->GetFileSpec().GetFilename().AsCString());
     }
 }
 

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Sun Jan 29 14:56:30 2012
@@ -95,7 +95,7 @@
     
     if (reg_context_sp && !m_sc.target_sp)
     {
-        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().GetSP();
+        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().shared_from_this();
         m_flags.Set (eSymbolContextTarget);
     }
 }
@@ -129,16 +129,16 @@
     
     if (m_sc.target_sp.get() == NULL && reg_context_sp)
     {
-        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().GetSP();
+        m_sc.target_sp = reg_context_sp->GetThread().GetProcess().GetTarget().shared_from_this();
         m_flags.Set (eSymbolContextTarget);
     }
     
-    Module *pc_module = pc_addr.GetModule();
+    Module *pc_module = pc_addr.GetModulePtr();
     if (m_sc.module_sp.get() == NULL || m_sc.module_sp.get() != pc_module)
     {
         if (pc_module)
         {
-            m_sc.module_sp = pc_module;
+            m_sc.module_sp = pc_module->shared_from_this();
             m_flags.Set (eSymbolContextModule);
         }
         else
@@ -218,7 +218,7 @@
                 Module *module = section->GetModule();
                 if (module)
                 {
-                    m_sc.module_sp = module;
+                    m_sc.module_sp = module->shared_from_this();
                     if (m_sc.module_sp)
                         m_flags.Set(eSymbolContextModule);
                 }
@@ -417,7 +417,7 @@
         // If the target was requested add that:
         if (m_sc.target_sp.get() == NULL)
         {
-            m_sc.target_sp = CalculateProcess()->GetTarget().GetSP();
+            m_sc.target_sp = CalculateProcess()->GetTarget().shared_from_this();
             if (m_sc.target_sp)
                 resolved |= eSymbolContextTarget;
         }
@@ -1245,16 +1245,6 @@
     return false;
 }
 
-StackFrameSP
-StackFrame::GetSP ()
-{
-    // This object contains an instrusive ref count base class so we can
-    // easily make a shared pointer to this object
-    return StackFrameSP (this);
-}
-
-
-
 bool
 StackFrame::GetStatus (Stream& strm,
                        bool show_frame_info,

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Sun Jan 29 14:56:30 2012
@@ -149,14 +149,6 @@
     return m_process_sp;
 }
 
-lldb::TargetSP
-Target::GetSP()
-{
-    // This object contains an instrusive ref count base class so we can
-    // easily make a shared pointer to this object
-    return TargetSP(this);
-}
-
 void
 Target::Destroy()
 {
@@ -256,8 +248,7 @@
 BreakpointSP
 Target::CreateBreakpoint (Address &addr, bool internal)
 {
-    TargetSP target_sp = this->GetSP();
-    SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (target_sp));
+    SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
     BreakpointResolverSP resolver_sp (new BreakpointResolverAddress (NULL, addr));
     return CreateBreakpoint (filter_sp, resolver_sp, internal);
 }
@@ -290,17 +281,16 @@
 Target::GetSearchFilterForModule (const FileSpec *containingModule)
 {
     SearchFilterSP filter_sp;
-    lldb::TargetSP target_sp = this->GetSP();
     if (containingModule != NULL)
     {
         // TODO: We should look into sharing module based search filters
         // across many breakpoints like we do for the simple target based one
-        filter_sp.reset (new SearchFilterByModule (target_sp, *containingModule));
+        filter_sp.reset (new SearchFilterByModule (shared_from_this(), *containingModule));
     }
     else
     {
         if (m_search_filter_sp.get() == NULL)
-            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (target_sp));
+            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
         filter_sp = m_search_filter_sp;
     }
     return filter_sp;
@@ -310,17 +300,16 @@
 Target::GetSearchFilterForModuleList (const FileSpecList *containingModules)
 {
     SearchFilterSP filter_sp;
-    lldb::TargetSP target_sp = this->GetSP();
     if (containingModules && containingModules->GetSize() != 0)
     {
         // TODO: We should look into sharing module based search filters
         // across many breakpoints like we do for the simple target based one
-        filter_sp.reset (new SearchFilterByModuleList (target_sp, *containingModules));
+        filter_sp.reset (new SearchFilterByModuleList (shared_from_this(), *containingModules));
     }
     else
     {
         if (m_search_filter_sp.get() == NULL)
-            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (target_sp));
+            m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
         filter_sp = m_search_filter_sp;
     }
     return filter_sp;
@@ -333,17 +322,16 @@
         return GetSearchFilterForModuleList(containingModules);
         
     SearchFilterSP filter_sp;
-    lldb::TargetSP target_sp = this->GetSP();
     if (containingModules == NULL)
     {
         // We could make a special "CU List only SearchFilter".  Better yet was if these could be composable, 
         // but that will take a little reworking.
         
-        filter_sp.reset (new SearchFilterByModuleListAndCU (target_sp, FileSpecList(), *containingSourceFiles));
+        filter_sp.reset (new SearchFilterByModuleListAndCU (shared_from_this(), FileSpecList(), *containingSourceFiles));
     }
     else
     {
-        filter_sp.reset (new SearchFilterByModuleListAndCU (target_sp, *containingModules, *containingSourceFiles));
+        filter_sp.reset (new SearchFilterByModuleListAndCU (shared_from_this(), *containingModules, *containingSourceFiles));
     }
     return filter_sp;
 }
@@ -1073,11 +1061,12 @@
 
         if (load_addr == LLDB_INVALID_ADDRESS)
         {
-            if (resolved_addr.GetModule() && resolved_addr.GetModule()->GetFileSpec())
+            Module *addr_module = resolved_addr.GetModulePtr();
+            if (addr_module && addr_module->GetFileSpec())
                 error.SetErrorStringWithFormat("%s[0x%llx] can't be resolved, %s in not currently loaded", 
-                                               resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString(), 
+                                               addr_module->GetFileSpec().GetFilename().AsCString(), 
                                                resolved_addr.GetFileAddress(),
-                                               resolved_addr.GetModule()->GetFileSpec().GetFilename().AsCString());
+                                               addr_module->GetFileSpec().GetFilename().AsCString());
             else
                 error.SetErrorStringWithFormat("0x%llx can't be resolved", resolved_addr.GetFileAddress());
         }
@@ -1339,7 +1328,7 @@
     if (m_scratch_ast_context_ap.get() == NULL && m_arch.IsValid() && create_on_demand)
     {
         m_scratch_ast_context_ap.reset (new ClangASTContext(m_arch.GetTriple().str().c_str()));
-        m_scratch_ast_source_ap.reset (new ClangASTSource(GetSP()));
+        m_scratch_ast_source_ap.reset (new ClangASTSource(shared_from_this()));
         m_scratch_ast_source_ap->InstallASTContext(m_scratch_ast_context_ap->getASTContext());
         llvm::OwningPtr<clang::ExternalASTSource> proxy_ast_source(m_scratch_ast_source_ap->CreateProxy());
         m_scratch_ast_context_ap->SetExternalSource(proxy_ast_source);
@@ -1678,7 +1667,7 @@
 Target::AddStopHook (Target::StopHookSP &new_hook_sp)
 {
     lldb::user_id_t new_uid = ++m_stop_hook_next_id;
-    new_hook_sp.reset (new StopHook(GetSP(), new_uid));
+    new_hook_sp.reset (new StopHook(shared_from_this(), new_uid));
     m_stop_hooks[new_uid] = new_hook_sp;
     return new_uid;
 }

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Sun Jan 29 14:56:30 2012
@@ -1030,15 +1030,6 @@
                             &end);
 }
 
-lldb::ThreadSP
-Thread::GetSP ()
-{
-    // This object contains an instrusive ref count base class so we can
-    // easily make a shared pointer to this object
-    return ThreadSP(this);
-}
-
-
 void
 Thread::SettingsInitialize ()
 {

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Sun Jan 29 14:56:30 2012
@@ -355,6 +355,17 @@
 }
 
 void
+ThreadList::Destroy()
+{
+    Mutex::Locker locker(m_threads_mutex);
+    const uint32_t num_threads = m_threads.size();
+    for (uint32_t idx = 0; idx < num_threads; ++idx)
+    {
+        m_threads[idx]->DestroyThread();
+    }
+}
+
+void
 ThreadList::RefreshStateAfterStop ()
 {
     Mutex::Locker locker(m_threads_mutex);
@@ -603,6 +614,32 @@
         m_stop_id = rhs.m_stop_id;
         m_threads.swap(rhs.m_threads);
         m_selected_tid = rhs.m_selected_tid;
+        
+        
+        // Now we look for threads that we are done with and
+        // make sure to clear them up as much as possible so 
+        // anyone with a shared pointer will still have a reference,
+        // but the thread won't be of much use. Using std::weak_ptr
+        // for all backward references (such as a thread to a process)
+        // will eventually solve this issue for us, but for now, we
+        // need to work around the issue
+        collection::iterator rhs_pos, rhs_end = rhs.m_threads.end();
+        for (rhs_pos = rhs.m_threads.begin(); rhs_pos != rhs_end; ++rhs_pos)
+        {
+            const lldb::tid_t tid = (*rhs_pos)->GetID();
+            bool thread_is_alive = false;
+            const uint32_t num_threads = m_threads.size();
+            for (uint32_t idx = 0; idx < num_threads; ++idx)
+            {
+                if (m_threads[idx]->GetID() == tid)
+                {
+                    thread_is_alive = true;
+                    break;
+                }
+            }
+            if (!thread_is_alive)
+                (*rhs_pos)->DestroyThread();
+        }        
     }
 }
 

Modified: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp Sun Jan 29 14:56:30 2012
@@ -119,7 +119,7 @@
     else
     {
         // Now we have to change the event to a breakpoint event and mark it up appropriately:
-        Process::ProcessEventData *new_data = new Process::ProcessEventData (m_thread.GetProcess().GetSP(), eStateStopped);
+        Process::ProcessEventData *new_data = new Process::ProcessEventData (m_thread.GetProcess().shared_from_this(), eStateStopped);
         event_ptr->SetData(new_data);
         event_ptr->SetType(Process::eBroadcastBitStateChanged);
         SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID (m_thread, 

Modified: lldb/trunk/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/source/lldb-log.cpp (original)
+++ lldb/trunk/source/lldb-log.cpp Sun Jan 29 14:56:30 2012
@@ -169,7 +169,7 @@
     // Now make a new log with this stream if one was provided
     if (log_stream_sp)
     {
-        log = make_shared<Log>(log_stream_sp);
+        log.reset (new Log(log_stream_sp));
         GetLog () = log;
     }
 





More information about the lldb-commits mailing list