[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Feb 10 12:18:03 PST 2003
Changes in directory llvm/lib/Analysis/DataStructure:
Printer.cpp updated: 1.47 -> 1.48
---
Log message:
Implement a new "viewGraph" method which can be used to instantly view a graph from gdb
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.47 llvm/lib/Analysis/DataStructure/Printer.cpp:1.48
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.47 Wed Feb 5 15:59:56 2003
+++ llvm/lib/Analysis/DataStructure/Printer.cpp Mon Feb 10 12:17:07 2003
@@ -179,6 +179,23 @@
}
}
+/// viewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
+/// then cleanup. For use from the debugger.
+///
+void DSGraph::viewGraph() const {
+ std::ofstream F("/tmp/tempgraph.dot");
+ if (!F.good()) {
+ std::cerr << "Error opening '/tmp/tempgraph.dot' for temporary graph!\n";
+ return;
+ }
+ print(F);
+ if (system("dot -Tps /tmp/tempgraph.dot > /tmp/tempgraph.ps"))
+ std::cerr << "Error running dot: 'dot' not in path?\n";
+ system("gv /tmp/tempgraph.ps");
+ system("rm /tmp/tempgraph.dot /tmp/tempgraph.ps");
+}
+
+
template <typename Collection>
static void printCollection(const Collection &C, std::ostream &O,
const Module *M, const std::string &Prefix) {
More information about the llvm-commits
mailing list