diff options
| author | Mitch Phillips <mitchphillips@outlook.com> | 2017-11-14 22:43:13 +0000 |
|---|---|---|
| committer | Mitch Phillips <mitchphillips@outlook.com> | 2017-11-14 22:43:13 +0000 |
| commit | 02993892d81f256d1a4a61bb4886db3376a75644 (patch) | |
| tree | 34ba89032d0ee2746aeba55cac62a0e50ba5c905 /llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp | |
| parent | e6201c8724dbce94969bc0b7f81e950cdbb6f742 (diff) | |
| download | bcm5719-llvm-02993892d81f256d1a4a61bb4886db3376a75644.tar.gz bcm5719-llvm-02993892d81f256d1a4a61bb4886db3376a75644.zip | |
[cfi-verify] Add DOT graph printing for GraphResult objects.
Allows users to view GraphResult objects in a DOT directed-graph format. This feature can be turned on through the --print-graphs flag.
Also enabled pretty-printing of instructions in output. Together these features make analysis of unprotected CF instructions much easier by providing a visual control flow graph.
Reviewers: pcc
Subscribers: llvm-commits, kcc, vlad.tsyrklevich
Differential Revision: https://reviews.llvm.org/D39819
llvm-svn: 318211
Diffstat (limited to 'llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp')
| -rw-r--r-- | llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp index 8ae905e2636..245ce05a254 100644 --- a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp +++ b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp @@ -37,6 +37,10 @@ cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"), cl::opt<std::string> BlacklistFilename(cl::Positional, cl::desc("[blacklist file]"), cl::init("-")); +cl::opt<bool> PrintGraphs( + "print-graphs", + cl::desc("Print graphs around indirect CF instructions in DOT format."), + cl::init(false)); ExitOnError ExitOnErr; @@ -62,10 +66,12 @@ void printIndirectCFInstructions(FileAnalysis &Analysis, else outs() << "U "; - outs() << format_hex(Address, 2) << " | " - << Analysis.getMCInstrInfo()->getName( - InstrMeta.Instruction.getOpcode()) - << " \n"; + outs() << format_hex(Address, 2) << " | "; + Analysis.printInstruction(InstrMeta, outs()); + outs() << " \n"; + + if (PrintGraphs) + Graph.printToDOT(Analysis, outs()); if (IgnoreDWARFFlag) { if (CFIProtected) |

