Added the ability to log a message with a backtrace when verbose logging is enabled to the Module class. Used this new function in the DWARF parser.

llvm-svn: 155404
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index d260657..18643c4 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -879,6 +879,24 @@
     }
 }
 
+void
+Module::LogMessageVerboseBacktrace (Log *log, const char *format, ...)
+{
+    if (log)
+    {
+        StreamString log_message;
+        GetDescription(&log_message, lldb::eDescriptionLevelFull);
+        log_message.PutCString (": ");
+        va_list args;
+        va_start (args, format);
+        log_message.PrintfVarArg (format, args);
+        va_end (args);
+        if (log->GetVerbose())
+            Host::Backtrace (log_message, 1024);
+        log->PutCString(log_message.GetString().c_str());
+    }
+}
+
 bool
 Module::GetModified (bool use_cached_only)
 {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 2f598b8..af870d5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -172,9 +172,9 @@
         LogSP log (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO | DWARF_LOG_LOOKUPS));
         if (log)
         {
-            m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log.get(), 
-                                                                    "DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at .debug_info[0x%8.8x]", 
-                                                                    GetOffset());
+            m_dwarf2Data->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log.get(),
+                                                                                    "DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at .debug_info[0x%8.8x]",
+                                                                                    GetOffset());
         }
     }
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 8372bec..7660569 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1995,19 +1995,12 @@
     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...", 
-                                                  MakeUserID(die->GetOffset()), 
-                                                  DW_TAG_value_to_name(tag), 
-                                                  type->GetName().AsCString());
+        GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log.get(),
+                                                                  "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;