[Lldb-commits] [lldb] r153787 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: LogChannelDWARF.cpp LogChannelDWARF.h SymbolFileDWARF.cpp

Greg Clayton gclayton at apple.com
Fri Mar 30 16:50:54 PDT 2012


Author: gclayton
Date: Fri Mar 30 18:50:54 2012
New Revision: 153787

URL: http://llvm.org/viewvc/llvm-project?rev=153787&view=rev
Log:
Added the ability to log when things get completed in DWARF. This can be enabled using:

(lldb) log enable --verbose lldb completion

This will print out backtraces for all type completion calls which will help us verify that we don't ever complete a type when we don't need to.


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=153787&r1=153786&r2=153787&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Fri Mar 30 18:50:54 2012
@@ -102,14 +102,15 @@
     {
          const char *arg = categories[i];
 
-        if      (::strcasecmp (arg, "all")        == 0   ) flag_bits &= ~DWARF_LOG_ALL;
-        else if (::strcasecmp (arg, "info")       == 0   ) flag_bits &= ~DWARF_LOG_DEBUG_INFO;
-        else if (::strcasecmp (arg, "line")       == 0   ) flag_bits &= ~DWARF_LOG_DEBUG_LINE;
-        else if (::strcasecmp (arg, "pubnames")   == 0   ) flag_bits &= ~DWARF_LOG_DEBUG_PUBNAMES;
-        else if (::strcasecmp (arg, "pubtypes")   == 0   ) flag_bits &= ~DWARF_LOG_DEBUG_PUBTYPES;
-        else if (::strcasecmp (arg, "aranges")    == 0   ) flag_bits &= ~DWARF_LOG_DEBUG_ARANGES;
-        else if (::strcasecmp (arg, "lookups")    == 0   ) flag_bits &= ~DWARF_LOG_LOOKUPS;
-        else if (::strcasecmp (arg, "default")    == 0   ) flag_bits &= ~DWARF_LOG_DEFAULT;
+        if      (::strcasecmp (arg, "all")        == 0) flag_bits &= ~DWARF_LOG_ALL;
+        else if (::strcasecmp (arg, "info")       == 0) flag_bits &= ~DWARF_LOG_DEBUG_INFO;
+        else if (::strcasecmp (arg, "line")       == 0) flag_bits &= ~DWARF_LOG_DEBUG_LINE;
+        else if (::strcasecmp (arg, "pubnames")   == 0) flag_bits &= ~DWARF_LOG_DEBUG_PUBNAMES;
+        else if (::strcasecmp (arg, "pubtypes")   == 0) flag_bits &= ~DWARF_LOG_DEBUG_PUBTYPES;
+        else if (::strcasecmp (arg, "aranges")    == 0) flag_bits &= ~DWARF_LOG_DEBUG_ARANGES;
+        else if (::strcasecmp (arg, "lookups")    == 0) flag_bits &= ~DWARF_LOG_LOOKUPS;
+        else if (::strcasecmp (arg, "default")    == 0) flag_bits &= ~DWARF_LOG_DEFAULT;
+        else if (::strncasecmp(arg, "comp", 4)    == 0) flag_bits &= ~DWARF_LOG_TYPE_COMPLETION;
         else
         {
             feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
@@ -144,14 +145,15 @@
     {
         const char *arg = categories[i];
 
-        if      (::strcasecmp (arg, "all")        == 0   ) flag_bits |= DWARF_LOG_ALL;
-        else if (::strcasecmp (arg, "info")       == 0   ) flag_bits |= DWARF_LOG_DEBUG_INFO;
-        else if (::strcasecmp (arg, "line")       == 0   ) flag_bits |= DWARF_LOG_DEBUG_LINE;
-        else if (::strcasecmp (arg, "pubnames")   == 0   ) flag_bits |= DWARF_LOG_DEBUG_PUBNAMES;
-        else if (::strcasecmp (arg, "pubtypes")   == 0   ) flag_bits |= DWARF_LOG_DEBUG_PUBTYPES;
-        else if (::strcasecmp (arg, "aranges")    == 0   ) flag_bits |= DWARF_LOG_DEBUG_ARANGES;
-        else if (::strcasecmp (arg, "lookups")    == 0   ) flag_bits |= DWARF_LOG_LOOKUPS;
-        else if (::strcasecmp (arg, "default")    == 0   ) flag_bits |= DWARF_LOG_DEFAULT;
+        if      (::strcasecmp (arg, "all")        == 0) flag_bits |= DWARF_LOG_ALL;
+        else if (::strcasecmp (arg, "info")       == 0) flag_bits |= DWARF_LOG_DEBUG_INFO;
+        else if (::strcasecmp (arg, "line")       == 0) flag_bits |= DWARF_LOG_DEBUG_LINE;
+        else if (::strcasecmp (arg, "pubnames")   == 0) flag_bits |= DWARF_LOG_DEBUG_PUBNAMES;
+        else if (::strcasecmp (arg, "pubtypes")   == 0) flag_bits |= DWARF_LOG_DEBUG_PUBTYPES;
+        else if (::strcasecmp (arg, "aranges")    == 0) flag_bits |= DWARF_LOG_DEBUG_ARANGES;
+        else if (::strcasecmp (arg, "lookups")    == 0) flag_bits |= DWARF_LOG_LOOKUPS;
+        else if (::strcasecmp (arg, "default")    == 0) flag_bits |= DWARF_LOG_DEFAULT;
+        else if (::strncasecmp(arg, "comp", 4)    == 0) flag_bits |= DWARF_LOG_TYPE_COMPLETION;
         else
         {
             feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
@@ -178,7 +180,8 @@
                   "  line - log the parsing if .debug_line\n"
                   "  pubnames - log the parsing if .debug_pubnames\n"
                   "  pubtypes - log the parsing if .debug_pubtypes\n"
-                  "  lookups - log any lookups that happen by name, regex, or address\n\n",
+                  "  lookups - log any lookups that happen by name, regex, or address\n\n"
+                  "  completion - log struct/unions/class type completions\n\n",
                   SymbolFileDWARF::GetPluginNameStatic());
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h?rev=153787&r1=153786&r2=153787&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Fri Mar 30 18:50:54 2012
@@ -24,6 +24,7 @@
 #define DWARF_LOG_DEBUG_PUBTYPES    (1u << 4)
 #define DWARF_LOG_DEBUG_ARANGES     (1u << 5)
 #define DWARF_LOG_LOOKUPS           (1u << 6)
+#define DWARF_LOG_TYPE_COMPLETION   (1u << 7)
 #define DWARF_LOG_ALL               (UINT32_MAX)
 #define DWARF_LOG_DEFAULT           (DWARF_LOG_DEBUG_INFO)
 

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=153787&r1=153786&r2=153787&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Mar 30 18:50:54 2012
@@ -1943,13 +1943,23 @@
 
     const dw_tag_t tag = die->Tag();
 
-    LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+    LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
     if (log)
+    {
         GetObjectFile()->GetModule()->LogMessage (log.get(),
-                                                  "0x%8.8llx: %s '%s' resolving forward declaration...\n", 
+                                                  "0x%8.8llx: %s '%s' resolving forward declaration...", 
                                                   MakeUserID(die->GetOffset()), 
                                                   DW_TAG_value_to_name(tag), 
                                                   type->GetName().AsCString());
+    
+        if (log->GetVerbose())
+        {
+            StreamString strm;
+            Host::Backtrace (strm, 1024);
+            if (strm.GetData())
+                log->PutCString(strm.GetData());
+        }
+    }
     assert (clang_type);
     DWARFDebugInfoEntry::Attributes attributes;
 





More information about the lldb-commits mailing list