The other day I had to dive into the ksmserver code, the core of session management
in KDE Plasma, but found it all a bit difficult to read.
If only I could get a callgraph I thought…
Turns out it actually is possible!
In fact it is almost too easy with clang/llvm. There are already
solutions that attach LLVM bitcode to existing binaries. e.g. gllvm. gllvm basically is a shim sitting between ninja
and the actual compiler and injects some behavior for us.
This enables the use without having to refit anything in our existing code.
You might note that clazy, our most excellent code analyzer, works in a similar fashion.
Read More