How to View .dot Files in Ubuntu


I was working with LLVM recently to create a callgraph using opt -view-cfg. But unfortunately it doesn’t work. Here is what I got instead:

ibndias@SHAHEEN-XPS15:~/Documents/Projects$ opt -view-cfg file.bc
WARNING: You're attempting to print out a bitcode file.
This is inadvisable as it may cause display problems. If
you REALLY want to taste LLVM bitcode first-hand, you
can force output with the `-f' option.
Writing '/tmp/cfg.identity-199090.dot'… done.
Trying 'xdg-open' program… Remember to erase graph file: /tmp/cfg.identity-199090.dot
ibndias@SHAHEEN-XPS15:~/Documents/Projects$ gio: file:///tmp/cfg.identity-199090.dot: No application is registered as handling this file

This means there is no application registered for handling .dot files. Even if I already installed graphviz.

Solution is, install xdot.

sudo apt install xdot

Now you can opt -view-cfg to see the .bc as callgraph.


Leave a Reply

Your email address will not be published.