Added logging so we can see when we are trying to complete a forward type and pull in the world. This is due to a compiler bug we are tracking (<rdar://problem/11291658>) where forward decls to classes and types are not properly scoped in namespaces, which results in the current LLDB looking for a type it will find many times in the accelerator tables, but never match. For example, when debugging with clang we get a forward decl like:

class AnalysisResolver;

And we will look for it everywhere and find many many matches, but the decl context of those matching DIEs is "clang::AnalysisResolver", so we never match anything, yet we pull in waaayyy too much DWARF in the process.

To enable this logging enable the "lookups" category in the "dwarf" log channel:

(lldb) log enable dwarf lookups

llvm-svn: 155233
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index eee1118..8372bec 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4561,6 +4561,18 @@
     if (cu == NULL || die == NULL || !type_name)
         return type_sp;
 
+    LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION|DWARF_LOG_LOOKUPS));
+    if (log)
+    {
+        std::string qualified_name;
+        die->GetQualifiedName(this, cu, qualified_name);
+        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                  "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x (%s), name='%s')",
+                                                  die->GetOffset(),
+                                                  qualified_name.c_str(),
+                                                  type_name.GetCString());
+    }
+
     DIEArray die_offsets;
 
     if (m_using_apple_tables)
@@ -4639,6 +4651,18 @@
                         
                 if (try_resolving_type)
                 {
+                    if (log)
+                    {
+                        std::string qualified_name;
+                        type_die->GetQualifiedName(this, cu, qualified_name);
+                        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                                  "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') trying die=0x%8.8x (%s)",
+                                                                  die->GetOffset(),
+                                                                  type_name.GetCString(),
+                                                                  type_die->GetOffset(),
+                                                                  qualified_name.c_str());
+                    }
+                    
                     // Make sure the decl contexts match all the way up
                     if (DIEDeclContextsMatch(cu, die, type_cu, type_die))
                     {
@@ -4658,6 +4682,20 @@
                         }
                     }
                 }
+                else
+                {
+                    if (log)
+                    {
+                        std::string qualified_name;
+                        type_die->GetQualifiedName(this, cu, qualified_name);
+                        GetObjectFile()->GetModule()->LogMessage (log.get(),
+                                                                  "SymbolFileDWARF::FindDefinitionTypeForDIE(die=0x%8.8x, name='%s') ignoring die=0x%8.8x (%s)",
+                                                                  die->GetOffset(),
+                                                                  type_name.GetCString(),
+                                                                  type_die->GetOffset(),
+                                                                  qualified_name.c_str());
+                    }
+                }
             }
             else
             {