summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation/TraceValues.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-01-13 00:52:14 +0000
committerChris Lattner <sabre@nondot.org>2003-01-13 00:52:14 +0000
commit80e5ed9f77d1f9c2fe1b35602ce96dc4612d4710 (patch)
treead316cae818d0aa1e8ff4d4d82dca420f98aa8d3 /lib/Transforms/Instrumentation/TraceValues.cpp
parentd91d86f3a6d0c809d6ef1a4a75a3ed82a402af9c (diff)
downloadllvm-80e5ed9f77d1f9c2fe1b35602ce96dc4612d4710.tar.gz
llvm-80e5ed9f77d1f9c2fe1b35602ce96dc4612d4710.tar.bz2
llvm-80e5ed9f77d1f9c2fe1b35602ce96dc4612d4710.tar.xz
Make sure to handle %'s in strings correctly so that the names of BB's and functions are actually printed!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5234 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/TraceValues.cpp')
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index 431b9bb83d..9329b8239a 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -26,8 +26,8 @@ DisablePtrHashing("tracedisablehashdisable", cl::Hidden,
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 @@ static void TraceValuesAtBBExit(BasicBlock *BB,
// 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 @@ static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction *InsertBefore,
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 @@ static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction *InsertBefore,
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 @@ static inline void InsertCodeToShowFunctionEntry(Function &F, Function *Printf,
Instruction *InsertPos = BB.begin();
std::ostringstream OutStr;
- WriteAsOperand(OutStr, &F, true);
+ WriteAsOperand(OutStr, &F);
InsertPrintInst(0, &BB, InsertPos, "ENTERING FUNCTION: " + OutStr.str(),
Printf, HashPtrToSeqNum);