Cleaned up a unused member variable in Debugger.

Added the start of Host specific launch services, though it currently isn't
hookup up to anything. We want to be able to launch a process and use the
native launch services to launch an app like it would be launched by the
user double clicking on the app. We also eventually want to be able to run
a command line app in a newly spawned terminal to avoid terminal sharing.

Fixed an issue with the new DWARF forward type declaration stuff. A crasher
was found that was happening when trying to properly expand the forward
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115213 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index f0c33f6..d84fedd 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -366,6 +366,7 @@
     return error;
 }
 
+//#define LAUNCH_WITH_LAUNCH_SERVICES 1
 //----------------------------------------------------------------------
 // Process Control
 //----------------------------------------------------------------------
@@ -381,10 +382,18 @@
     const char *stderr_path
 )
 {
+    Error error;
+#if defined (LAUNCH_WITH_LAUNCH_SERVICES)
+    FileSpec app_file_spec (argv[0]);
+    pid_t pid = Host::LaunchApplication (app_file_spec);
+    if (pid != LLDB_INVALID_PROCESS_ID)
+        error = DoAttachToProcessWithID (pid);
+    else
+        error.SetErrorString("failed");
+#else
     //  ::LogSetBitMask (GDBR_LOG_DEFAULT);
     //  ::LogSetOptions (LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD);
     //  ::LogSetLogFile ("/dev/stdout");
-    Error error;
 
     ObjectFile * object_file = module->GetObjectFile();
     if (object_file)
@@ -497,9 +506,9 @@
         SetID(LLDB_INVALID_PROCESS_ID);
         error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n", module->GetFileSpec().GetFilename().AsCString(), module->GetArchitecture().AsCString());
     }
-
-    // Return the process ID we have
+#endif
     return error;
+
 }
 
 
@@ -621,9 +630,13 @@
 void
 ProcessGDBRemote::DidLaunch ()
 {
+#if defined (LAUNCH_WITH_LAUNCH_SERVICES)
+    DidAttach ();
+#else
     DidLaunchOrAttach ();
     if (m_dynamic_loader_ap.get())
         m_dynamic_loader_ap->DidLaunch();
+#endif
 }
 
 Error
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 6b735d2..0452ea3 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2444,7 +2444,7 @@
             DWARFDebugInfoEntry::Attributes attributes;
             const char *type_name_cstr = NULL;
             ConstString type_name_dbstr;
-            Type::EncodingUIDType encoding_uid_type = Type::eIsTypeWithUID;
+            Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
             clang_type_t clang_type = NULL;
 
             TypeList* type_list = m_obj_file->GetModule()->GetTypeList();
@@ -2508,37 +2508,37 @@
                     case DW_TAG_pointer_type:
                         // The encoding_uid will be embedded into the
                         // Type object and will be looked up when the Type::GetClangType()
-                        encoding_uid_type = Type::ePointerToTypeWithUID;
+                        encoding_data_type = Type::eEncodingIsPointerUID;
                         break;
 
                     case DW_TAG_reference_type:
                         // The encoding_uid will be embedded into the
                         // Type object and will be looked up when the Type::GetClangType()
-                        encoding_uid_type = Type::eLValueReferenceToTypeWithUID;
+                        encoding_data_type = Type::eEncodingIsLValueReferenceUID;
                         break;
 
                     case DW_TAG_typedef:
                         // The encoding_uid will be embedded into the
                         // Type object and will be looked up when the Type::GetClangType()
-                        encoding_uid_type = Type::eTypedefToTypeWithUID;
+                        encoding_data_type = Type::eEncodingIsTypedefUID;
                         break;
 
                     case DW_TAG_const_type:
                         // The encoding_uid will be embedded into the
                         // Type object and will be looked up when the Type::GetClangType()
-                        encoding_uid_type = Type::eIsConstTypeWithUID; //ClangASTContext::AddConstModifier (clang_type);
+                        encoding_data_type = Type::eEncodingIsConstUID; //ClangASTContext::AddConstModifier (clang_type);
                         break;
 
                     case DW_TAG_restrict_type:
                         // The encoding_uid will be embedded into the
                         // Type object and will be looked up when the Type::GetClangType()
-                        encoding_uid_type = Type::eIsRestrictTypeWithUID; //ClangASTContext::AddRestrictModifier (clang_type);
+                        encoding_data_type = Type::eEncodingIsRestrictUID; //ClangASTContext::AddRestrictModifier (clang_type);
                         break;
 
                     case DW_TAG_volatile_type:
                         // The encoding_uid will be embedded into the
                         // Type object and will be looked up when the Type::GetClangType()
-                        encoding_uid_type = Type::eIsVolatileTypeWithUID; //ClangASTContext::AddVolatileModifier (clang_type);
+                        encoding_data_type = Type::eEncodingIsVolatileUID; //ClangASTContext::AddVolatileModifier (clang_type);
                         break;
                     }
 
@@ -2563,7 +2563,7 @@
                         }
                     }
                         
-                    type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, encoding_uid_type, &decl, clang_type));
+                    type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, encoding_data_type, &decl, clang_type, clang_type == NULL));
 
                     m_die_to_type[die] = type_sp.get();
 
@@ -2679,21 +2679,27 @@
                     // parameters in any class methods need it for the clang 
                     // types for function prototypes. 
                     m_die_to_decl_ctx[die] = ClangASTContext::GetDeclContextForType (clang_type);
-                    type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type));
+                    type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type, true));
 
                     m_die_to_type[die] = type_sp.get();
 
-                    // Leave this as a forward declaration until we need
-                    // to know the details of the type. lldb_private::Type
-                    // will automatically call the SymbolFile virtual function
-                    // "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
-                    // When the definition needs to be defined.
-                    if (clang_type_was_created)
+                    if (die->HasChildren() == false)
                     {
+                        // No children for this struct/union/class, lets finish it
+                        type_list->GetClangASTContext().StartTagDeclarationDefinition (clang_type);
+                        type_list->GetClangASTContext().CompleteTagDeclarationDefinition (clang_type);
+                    }
+                    else if (clang_type_was_created)
+                    {
+                        // Leave this as a forward declaration until we need
+                        // to know the details of the type. lldb_private::Type
+                        // will automatically call the SymbolFile virtual function
+                        // "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
+                        // When the definition needs to be defined.
                         m_forward_decl_die_to_clang_type[die] = clang_type;
                         m_forward_decl_clang_type_to_die[clang_type] = die;
                     }
-
+                    
                 }
                 break;
 
@@ -2760,7 +2766,7 @@
                         }
 
                         m_die_to_decl_ctx[die] = ClangASTContext::GetDeclContextForType (clang_type);
-                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, Type::eIsTypeWithUID, &decl, clang_type));
+                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, Type::eEncodingIsUID, &decl, clang_type, true));
 
                         m_die_to_type[die] = type_sp.get();
 
@@ -2972,7 +2978,7 @@
                                     type_list->GetClangASTContext().SetFunctionParameters (function_decl, &function_param_decls.front(), function_param_decls.size());
                             }
                         }
-                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, 0, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type));
+                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, 0, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type, false));
 
                         m_die_to_type[die] = type_sp.get();
                         assert(type_sp.get());
@@ -3057,7 +3063,7 @@
                                 array_element_bit_stride = array_element_bit_stride * num_elements;
                             }
                             ConstString empty_name;
-                            type_sp.reset( new Type(die->GetOffset(), this, empty_name, array_element_bit_stride / 8, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type));
+                            type_sp.reset( new Type(die->GetOffset(), this, empty_name, array_element_bit_stride / 8, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type, false));
                             m_die_to_type[die] = type_sp.get();
                         }
                     }
@@ -3099,7 +3105,7 @@
 
                         size_t byte_size = ClangASTType::GetClangTypeBitWidth (type_list->GetClangASTContext().getASTContext(), clang_type) / 8;
 
-                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, NULL, clang_type));
+                        type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, NULL, clang_type, false));
                         m_die_to_type[die] = type_sp.get();
                     }