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.

llvm-svn: 125541
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5897dbb..c470596 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -197,6 +197,14 @@
     return g_dwarf_section_name;
 }
 
+UniqueDWARFASTTypeMap &
+SymbolFileDWARF::GetUniqueDWARFASTTypeMap ()
+{
+    if (m_debug_map_symfile)
+        return m_debug_map_symfile->GetUniqueDWARFASTTypeMap ();
+    return m_unique_ast_type_map;
+}
+
 ClangASTContext &       
 SymbolFileDWARF::GetClangASTContext ()
 {
@@ -3172,10 +3180,10 @@
                     UniqueDWARFASTType unique_ast_entry;
                     if (decl.IsValid())
                     {
-                        if (m_unique_ast_type_map.Find (type_name_const_str,
-                                                        die,
-                                                        decl,
-                                                        unique_ast_entry))
+                        if (GetUniqueDWARFASTTypeMap().Find (type_name_const_str,
+                                                             die,
+                                                             decl,
+                                                             unique_ast_entry))
                         {
                             // We have already parsed this type or from another 
                             // compile unit. GCC loves to use the "one definition
@@ -3273,8 +3281,8 @@
                     unique_ast_entry.m_type_sp = type_sp;
                     unique_ast_entry.m_die = die;
                     unique_ast_entry.m_declaration = decl;
-                    m_unique_ast_type_map.Insert (type_name_const_str, 
-                                                  unique_ast_entry);
+                    GetUniqueDWARFASTTypeMap().Insert (type_name_const_str, 
+                                                       unique_ast_entry);
                     
                     if (die->HasChildren() == false && is_forward_declaration == false)
                     {
@@ -3824,14 +3832,6 @@
                     type_sp->SetSymbolContextScope(symbol_context_scope);
                 }
 
-//              if (udt_sp.get())
-//              {
-//                  if (is_forward_declaration)
-//                      udt_sp->GetFlags().Set(UserDefType::flagIsForwardDefinition);
-//                  type_sp->SetUserDefinedType(udt_sp);
-//              }
-
-                //printf ("Adding type to map: 0x%8.8x for %s\n", die->GetOffset(), type_sp->GetName().GetCString());
                 // We are ready to put this type into the uniqued list up at the module level
                 type_list->Insert (type_sp);
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index c97bd1f..f2acbf7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -321,6 +321,9 @@
     clang::NamespaceDecl *
     ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die);
     
+    UniqueDWARFASTTypeMap &
+    GetUniqueDWARFASTTypeMap ();
+
     SymbolFileDWARFDebugMap *       m_debug_map_symfile;
     clang::TranslationUnitDecl *    m_clang_tu_decl;
     lldb_private::Flags             m_flags;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 903fc57..742fb06 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -15,6 +15,8 @@
 #include <bitset>
 #include "lldb/Symbol/SymbolFile.h"
 
+#include "UniqueDWARFASTType.h"
+
 class SymbolFileDWARF;
 class DWARFCompileUnit;
 class DWARFDebugInfoEntry;
@@ -211,6 +213,11 @@
                               const DWARFDebugInfoEntry *die, 
                               const lldb_private::ConstString &type_name);    
 
+    UniqueDWARFASTTypeMap &
+    GetUniqueDWARFASTTypeMap ()
+    {
+        return m_unique_ast_type_map;
+    }
     //------------------------------------------------------------------
     // Member Variables
     //------------------------------------------------------------------
@@ -218,6 +225,7 @@
     std::vector<CompileUnitInfo> m_compile_unit_infos;
     std::vector<uint32_t> m_func_indexes;   // Sorted by address
     std::vector<uint32_t> m_glob_indexes;
+    UniqueDWARFASTTypeMap m_unique_ast_type_map;
 };
 
 #endif // #ifndef liblldb_SymbolFileDWARFDebugMap_h_