All UnwindPlan objects are now passed around as shared pointers.

ArchDefaultUnwindPlan plug-in interfaces are now cached per architecture 
instead of being leaked for every frame.

Split the ArchDefaultUnwindPlan_x86 into ArchDefaultUnwindPlan_x86_64 and
ArchDefaultUnwindPlan_i386 interfaces.

There were sporadic crashes that were due to something leaking or being 
destroyed when doing stack crawls. This patch should clear up these issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@125541 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/Utility/UnwindLLDB.cpp b/source/Plugins/Process/Utility/UnwindLLDB.cpp
index 533c21c..e972c84 100644
--- a/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ b/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -15,10 +15,12 @@
 #include "lldb/Symbol/FuncUnwinders.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Utility/ArchDefaultUnwindPlan.h"
-#include "UnwindLLDB.h"
 #include "lldb/Symbol/UnwindPlan.h"
 #include "lldb/Core/Log.h"
 
+#include "UnwindLLDB.h"
+#include "RegisterContextLLDB.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -65,8 +67,10 @@
 {
     // First, set up the 0th (initial) frame
     CursorSP first_cursor_sp(new Cursor ());
-    RegisterContextSP no_frame; 
-    std::auto_ptr<RegisterContextLLDB> first_register_ctx_ap (new RegisterContextLLDB(m_thread, no_frame, first_cursor_sp->sctx, 0));
+    std::auto_ptr<RegisterContextLLDB> first_register_ctx_ap (new RegisterContextLLDB (m_thread, 
+                                                                                       RegisterContextLLDB::SharedPtr(), 
+                                                                                       first_cursor_sp->sctx, 
+                                                                                       0));
     if (first_register_ctx_ap.get() == NULL)
         return false;
     
@@ -150,8 +154,8 @@
             return false;
         }
     }
-    RegisterContextSP register_ctx_sp(register_ctx_ap.release());
-    cursor_sp->reg_ctx = register_ctx_sp;
+    RegisterContextLLDB::SharedPtr reg_ctx_sp(register_ctx_ap.release());
+    cursor_sp->reg_ctx = reg_ctx_sp;
     m_frames.push_back (cursor_sp);
     return true;
 }