Added and improved logging.  This is helping us as we
diagnose a problem where we're not correctly emitting
PIC code.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@109568 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/IRToDWARF.cpp b/source/Expression/IRToDWARF.cpp
index af6d1b1..b6e0b43 100644
--- a/source/Expression/IRToDWARF.cpp
+++ b/source/Expression/IRToDWARF.cpp
@@ -119,9 +119,7 @@
 
 bool
 IRToDWARF::runOnBasicBlock(BasicBlock &BB, Relocator &R)
-{
-    lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
-    
+{    
     ///////////////////////////////////////
     // Mark the current block as visited
     //
@@ -139,29 +137,6 @@
     // Translate the current basic block to DWARF
     //
     
-    if (log)
-    {
-        log->Printf("Translating basic block %s:",
-                    BB.hasName() ? BB.getNameStr().c_str() : "[anonymous]");
-    
-        llvm::BasicBlock::iterator ii;
-        
-        for (ii = BB.begin();
-             ii != BB.end();
-             ++ii)
-        {
-            llvm::Instruction &inst = *ii;
-            
-            std::string s;
-            raw_string_ostream os(s);
-            
-            inst.print(os);
-            
-            if (log)
-                log->Printf("  %s", s.c_str());
-        }
-    }
-    
     /////////////////////////////////////////////////
     // Visit all successors we haven't visited yet
     //
@@ -210,6 +185,18 @@
     if (!runOnBasicBlock(function->getEntryBlock(), relocator))
         return false;
     
+    if (log)
+    {
+        std::string s;
+        raw_string_ostream oss(s);
+        
+        M.print(oss, NULL);
+        
+        oss.flush();
+        
+        log->Printf("Module being translated to DWARF: \n%s", s.c_str());
+    }
+    
     // TEMPORARY: Fail in order to force execution in the target.
     return false;