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/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index f790780..80ed0e2 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/source/Expression/IRForTarget.cpp
@@ -511,20 +511,22 @@
             return false;
     }
     
+    // TEMPORARY FOR DEBUGGING
+    M.dump();
+    
     if (!replaceVariables(M, function))
         return false;
     
     if (log)
     {
-        for (bbi = function->begin();
-             bbi != function->end();
-             ++bbi)
-        {
-            log->Printf("Rewrote basic block %s for running: \n%s", 
-                        bbi->hasName() ? bbi->getNameStr().c_str() : "[anonymous]",
-                        PrintValue(bbi).c_str());
-        }
+        std::string s;
+        raw_string_ostream oss(s);
         
+        M.print(oss, NULL);
+        
+        oss.flush();
+        
+        log->Printf("Module after preparing for execution: \n%s", s.c_str());
     }
     
     return true;