Chromium Code Reviews| Index: tools/pnacl-bcanalyzer/pnacl-bcanalyzer.cpp |
| diff --git a/tools/pnacl-bcanalyzer/pnacl-bcanalyzer.cpp b/tools/pnacl-bcanalyzer/pnacl-bcanalyzer.cpp |
| index 7c542d79aea1f3b722db112b91008aecb3b76a69..76fe404bfd63c1c22c2c0799659d8edfe41a5593 100644 |
| --- a/tools/pnacl-bcanalyzer/pnacl-bcanalyzer.cpp |
| +++ b/tools/pnacl-bcanalyzer/pnacl-bcanalyzer.cpp |
| @@ -45,6 +45,11 @@ |
| #include <map> |
| using namespace llvm; |
| +/* To turn on debugging for this file, change value of NACL_DEBUGGING to 1. |
| + */ |
| +#define NACL_DEBUGGING 0 |
| +#include "llvm/Bitcode/NaCl/NaClDebugging.h" |
| + |
| static cl::opt<std::string> |
| InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-")); |
| @@ -325,6 +330,7 @@ static bool Error(const std::string &Err) { |
| static bool ParseBlock(NaClBitstreamCursor &Stream, unsigned BlockID, |
| unsigned IndentLevel) { |
| std::string Indent(IndentLevel*2, ' '); |
| + NACL_DEBUG(outs() << Indent << "-> ParseBlock(" << BlockID << ")\n"); |
|
jvoung (off chromium)
2013/05/14 23:47:14
Not sure you want to use "outs()" since that will
Karl
2013/05/17 20:52:18
Fixing to use llvm debug.h
|
| uint64_t BlockBitStart = Stream.GetCurrentBitNo(); |
| // Get the statistics for this BlockID. |
| @@ -339,6 +345,7 @@ static bool ParseBlock(NaClBitstreamCursor &Stream, unsigned BlockID, |
| return Error("Malformed BlockInfoBlock"); |
| uint64_t BlockBitEnd = Stream.GetCurrentBitNo(); |
| BlockStats.NumBits += BlockBitEnd-BlockBitStart; |
| + NACL_DEBUG(outs() << Indent << "<- ParseBlock\n"); |
| return false; |
| } |
| @@ -386,6 +393,7 @@ static bool ParseBlock(NaClBitstreamCursor &Stream, unsigned BlockID, |
| else |
| outs() << "UnknownBlock" << BlockID << ">\n"; |
| } |
| + NACL_DEBUG(outs() << Indent << "<- ParseBlock\n"); |
| return false; |
| } |
| @@ -478,6 +486,7 @@ static void PrintSize(uint64_t Bits) { |
| /// AnalyzeBitcode - Analyze the bitcode file specified by InputFilename. |
| static int AnalyzeBitcode() { |
| + NACL_DEBUG(outs() << "-> AnalyzeBitcode\n"); |
| // Read the input file. |
| OwningPtr<MemoryBuffer> MemBuf; |
| @@ -620,6 +629,7 @@ static int AnalyzeBitcode() { |
| } |
| } |
| + NACL_DEBUG(outs() << "<- AnalyzeBitcode\n"); |
| return 0; |
| } |