FS#37877 - [llvm] view-cfg flag and others are broken
Attached to Project:
Arch Linux
Opened by Dan Liew (delcypher) - Friday, 22 November 2013, 12:28 GMT
Last edited by Evangelos Foutras (foutrelis) - Tuesday, 09 September 2014, 12:04 GMT
Opened by Dan Liew (delcypher) - Friday, 22 November 2013, 12:28 GMT
Last edited by Evangelos Foutras (foutrelis) - Tuesday, 09 September 2014, 12:04 GMT
|
Details
Description:
LLVM opt provides handy flags for viewing CFGs (-view-cfg) and Call graphs (-view-callgraph) of LLVM bitcode files. The packaged version of LLVM opt does not work (dot file is generated but viewer is not launched) because an appropriate viewer is not detected at configure time. Additional info: * llvm 3.3-1 Steps to reproduce: 1. Compile attached program to LLVM bitcode $ clang -emit-llvm -c hello.c -o hello.bc 2. Use opt to try and view CFG $ opt -view-cfg -analyze hello.bc Writing '/tmp/llvm_tolaIK/callgraph.dot'... done. Printing analysis 'View call graph': Pass::print not implemented for pass: 'View call graph'! No viewing program will be launched. I built my own copy of LLVM3.3 with (gv in my PATH) and that works fine. It seems the following programs are tried as viewers with the following order of precedence - GraphViz (GraphViz) - I don't know what viewer this is, it's not in Arch repos - xdot.py (xdot.py) - GhostView (gv) - In Arch repos - Dotty (dotty) - This tool seems broken. It won't render text correctly ( https://bugs.launchpad.net/ubuntu/+source/graphviz/+bug/1016777 ) See void llvm::DisplayGraph(const sys::Path &Filename, bool wait, GraphProgram::Name program) in lib/Support/GraphWriter.cpp for details on this. Supporting one of these viewers would add extra dependencies that most people probably don't want. We could make "gv" an optional dependency though and make sure when LLVM3.3 is built gv and dot are in your PATH so that the package is configured to use ghostview and dot when trying to view graphs. If the user doesn't have gv installed then they'll see Writing '/tmp/llvm_r482Tr/callgraph.dot'... done. Running '/usr/bin/dot' program... done. Error: No such file or directory Printing analysis 'View call graph': Pass::print not implemented for pass: 'View call graph'! This isn't particularly helpful, but it's better than no viewing support at all. Perhaps we could write a patch to improve the output if one the programs is missing and send that upstream? |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Tuesday, 09 September 2014, 12:04 GMT
Reason for closing: Fixed
Additional comments about closing: llvm 3.5.0-1
Tuesday, 09 September 2014, 12:04 GMT
Reason for closing: Fixed
Additional comments about closing: llvm 3.5.0-1
I don't plan to add any optional dependencies though.