[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/TraceValues.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jan 12 18:53:00 PST 2003


Changes in directory llvm/lib/Transforms/Instrumentation:

TraceValues.cpp updated: 1.51 -> 1.52

---
Log message:

Make sure to handle %'s in strings correctly so that the names of BB's and functions are actually printed!


---
Diffs of the changes:

Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.51 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.52
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.51	Mon Oct 21 15:00:23 2002
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp	Sun Jan 12 18:52:14 2003
@@ -26,8 +26,8 @@
                   cl::desc("Disable pointer hashing"));
 
 static cl::list<string>
-TraceFuncName("tracefunc", cl::desc("trace only specific functions"),
-              cl::value_desc("function"), cl::Hidden);
+TraceFuncNames("tracefunc", cl::desc("trace only specific functions"),
+	       cl::value_desc("function"), cl::Hidden);
 
 static void TraceValuesAtBBExit(BasicBlock *BB,
                                 Function *Printf, Function* HashPtrToSeqNum,
@@ -37,13 +37,12 @@
 // or if the function is in the specified list.
 // 
 inline static bool
-TraceThisFunction(Function &func)
+TraceThisFunction(Function &F)
 {
-  if (TraceFuncName.size() == 0)
-    return true;
+  if (TraceFuncNames.empty()) return true;
 
-  return std::find(TraceFuncName.begin(), TraceFuncName.end(), func.getName())
-                  != TraceFuncName.end();
+  return std::find(TraceFuncNames.begin(), TraceFuncNames.end(), F.getName())
+                  != TraceFuncNames.end();
 }
 
 
@@ -222,7 +221,7 @@
     Tmp.erase(Tmp.begin(), I);
     I = std::find(Tmp.begin(), Tmp.end(), '%');
   }
-
+  Message += Tmp;
   Module *Mod = BB->getParent()->getParent();
 
   // Turn the marker string into a global variable...
@@ -232,7 +231,7 @@
   Instruction *GEP = 
     new GetElementPtrInst(fmtVal,
                           vector<Value*>(2,ConstantSInt::get(Type::LongTy, 0)),
-                          "trstr", InsertBefore);
+                          "trstrp", InsertBefore);
   
   // Insert a call to the hash function if this is a pointer value
   if (V && isa<PointerType>(V->getType()) && !DisablePtrHashing) {
@@ -350,7 +349,7 @@
   Instruction *InsertPos = BB.begin();
 
   std::ostringstream OutStr;
-  WriteAsOperand(OutStr, &F, true);
+  WriteAsOperand(OutStr, &F);
   InsertPrintInst(0, &BB, InsertPos, "ENTERING FUNCTION: " + OutStr.str(),
                   Printf, HashPtrToSeqNum);
 





More information about the llvm-commits mailing list