Beautify debug info probe output.
authorDevang Patel <dpatel@apple.com>
Thu, 28 Apr 2011 20:46:18 +0000 (20:46 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 28 Apr 2011 20:46:18 +0000 (20:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130435 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/DebugInfoProbe.cpp

index 408153f34eb5ad6de471577fbb1c36a37d72835d..43eda47dbe1a672d6e9389844c8a6c55393a7936 100644 (file)
@@ -136,7 +136,9 @@ void DebugInfoProbeImpl::finalize(Function &F) {
     unsigned LineNo = *I;
     if (LineNos2.count(LineNo) == 0) {
       DEBUG(dbgs() 
-            << "DebugInfoProbe: Losing dbg info for source line " 
+            << "DebugInfoProbe("
+            << PassName
+            << "): Losing dbg info for source line " 
             << LineNo << "\n");
       ++NumDbgLineLost;
     }
@@ -162,9 +164,16 @@ void DebugInfoProbeImpl::finalize(Function &F) {
 
   for (std::set<MDNode *>::iterator I = DbgVariables.begin(), 
          E = DbgVariables.end(); I != E; ++I) {
-    if (DbgVariables2.count(*I) == 0) {
-      DEBUG(dbgs() << "DebugInfoProbe: Losing dbg info for variable: ");
-      DEBUG((*I)->print(dbgs()));
+    if (DbgVariables2.count(*I) == 0 && (*I)->getNumOperands() >= 2) {
+      DEBUG(dbgs() 
+            << "DebugInfoProbe("
+            << PassName
+            << "): Losing dbg info for variable: ");
+      if (MDString *MDS = dyn_cast_or_null<MDString>((*I)->getOperand(2)))
+        DEBUG(dbgs() << MDS->getString());
+      else
+        DEBUG(dbgs() << "...");
+      DEBUG(dbgs() << "\n");
       ++NumDbgValueLost;
     }
   }