Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321122

Summary: Call graph visualization using egypt
Product: [Tools] Linux Tools Reporter: Roland Grunberg <rgrunber>
Component: ProjectAssignee: Linux Distros Inbox <linux.distros-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, linux.distros-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Roland Grunberg CLA 2010-07-28 09:12:55 EDT
Suppose we wanted a better understanding of how a C/C++ program "operates".
What methods are called, in what order, by which functions, etc. A visual
representation of a program's call hierarchy could probably achieve this
reasonably well, and it would be nice to have an Eclipse plugin that could
do this. Similar to an ER model being generated given a database schema.

One such way of doing this is by compiling each of the program's source files
using gcc's -fdump-rtl-<pass> flag. (For more information on flags, see the
gcc manual). This dumps debugging information during the specified pass of
compilation. RTL (Register Transfer Language) is just a format (similar to
LISP lists) that describes the various instructions performed by the CPU.

As an example, we can take the source code for Systemtap, and add the
following line to configure.ac :

CFLAGS="-fdump-rtl-expand $CFLAGS"

This will compile all C source files with the -fdump-rtl-expand flag,
which dumps the debugging information after RTL generation.

After compiling the project (./configure && make) we can grab all the
debugging data files that have been generated and pass them to 'egypt'.

Egypt (http://www.gson.org/egypt/) is a program that takes RTL data and
converts it to DOT language (http://en.wikipedia.org/wiki/DOT_language).
From this point we can pass the DOT language data to a graph generator
provided by the Graphviz Package (http://www.graphviz.org/).

cat *.expand | egypt | dot -Tjpg -o stap_egypt.jpg

This would produce something as follows :

http://rgrunber.fedorapeople.org/stap_egypt.jpg
http://rgrunber.fedorapeople.org/stap_egypt.svg

However, since our goal would be to have this be an Eclipse plugin, a
graphics library such as GEF / ZEST (http://www.eclipse.org/gef/)
would have to be used to achieve the rendering.

Drawbacks :

Large programs with many functions (nodes) can be difficult to render by
egypt. Coming up with some algorithm to do this with the GEF/ZEST libraries
would be challenging. As an example, the compilation of Systemtap was done
only with -fdump-rtl-expand for the C source files because doing it for C++
as well produced a graph that was not possible to render in most formats and
very confusing to visualize.

Other possibilities for visualizing call hierarchy are discussed below :

http://nion.modprobe.de/blog/archives/556-creating-dynamic-function-call-graphs.html
http://www.ibm.com/developerworks/library/l-graphvis/
Comment 1 Alexander Kurtakov CLA 2010-10-26 09:16:05 EDT
Roland,
Zest has direct support for dot language. See http://wiki.eclipse.org/Graphviz_DOT_as_a_DSL_for_Zest for details. This should help with the last step.
Comment 2 Eclipse Genie CLA 2014-05-31 04:18:36 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Eclipse Genie CLA 2016-05-21 06:57:44 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Eclipse Genie CLA 2018-05-13 14:04:44 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Alexander Kurtakov CLA 2018-05-13 14:07:13 EDT
Obviously nothing will happen here.