I'm having trouble visualizing the control flow graph in KCachegrind when analyzing my callgrind output. Although I have both dot (GraphViz) and objdump installed and working, KCachegrind fails to display the control flow graph and shows an error related to the dot process (I think). Below are all relevant details about my setup, troubleshooting steps, and outputs.
- OS: WSL2
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal - KCachegrind version
$ kcachegrind --version kcachegrind 25.04.1 - Dot version
$ dot -V dot - graphviz version 2.43.0 (0) - I tried testing dot directly:
echo "digraph G { A -> B }" | dot -Tpng -o test.png # test.png was created successfully - Checked /tmp persmissions:
$ ls -ld /tmp drwxrwxrwt 9 root root 12288 Jun 9 14:39 /tmp
When running kcachegrind the control flow graph is not displayed, it only shows the text
No graph available because the layouting process failed. Trying to run the following command did not work
dot -Tplain-ext
Please check thatdotis installed.
I tried running this command by myself and it seems to also work:
$ dot -Tplain-ext test.dot
graph 1 1.125 2.5
node A 0.75 2.25 0.75 0.5 A solid ellipse black lightgrey
node B 0.375 1.25 0.75 0.5 B solid ellipse black lightgrey
node C 0.75 0.25 0.75 0.5 C solid ellipse black lightgrey
edge A B 4 0.66113 2.0057 0.61787 1.8935 0.56481 1.756 0.51619 1.6299 solid black
edge B C 4 0.46387 1.0057 0.50713 0.89354 0.56019 0.75599 0.60881 0.62993 solid black
edge C A 10 0.80075 0.50128 0.82883 0.64488 0.86084 0.83208 0.875 1 0.89367 1.2214 0.89367 1.2786 0.875 1.5 0.86505 1.6181 0.84626 1.7457 0.82623 1.8609 solid black
stop
The output when running kcachegrind is the following:
$ kcachegrind callgrind_original.out.55340
Selected "main"
ControlFlowGraphView::refresh: Starting process QProcess(0x566cd5d2b660) , ' QProcess(0x566cd5d2b660) '
Running 'objdump -C -d --start-address=0x11E0 --stop-address=0x201A /home/user/prog/test/real'...
ControlFlowGraphView::dotError: Got QProcess::WriteError from QProcess QProcess(0x566cd5d2b660)
QProcess: Destroyed while process ("dot") is still running.
ControlFlowGraphView::dotExited: QProcess QProcess(0x566cd5d2b660)
I tried running kcachegrind as root, but then I get into a different issue:
$ sudo kcachegrind callgrind_original.out.55340
kf.dbusaddons: DBus session bus not found. To circumvent this problem try the following command (with bash):
export $(dbus-launch)
I get this error always when running it as root also when I tried the export.