code call-graphs for warzone
Posted: 03 Feb 2007, 17:49
to help me figure out the warzone code, as well as other large codebases, in less time, i've looked into call-graph related utilities. thus far, the best one i was able to find that actually worked is egypt (there was one called codeviz which i couldn't get any other alternatives to build on modern linux system, and most other alternatives have no remaining mirrors). anyways, egypt was exceptionally good for making callgraphs, and could handle an arbitrary number of input files, but was primarily intended for just one or a few input files at a time, and sorting out a codebase as large as warzone's produced unreadable graphs.
good news: i've been modifying warzone to be able to split up and organize call graphs in a number of different ways, with the intent that egypt be able to usably handle arbitrarily large code bases (which means that it'll, in theory, help me, and anyone who's interested, in learning the warzone source more quickly). here's some of what my modified version was able to do a couple of subversions ago:
http://www.last-ditch.net/egypt-warzone ... tfiles.png
this one used egypt with an output mode that is a variation off of the original and only output mode: in this one, 3 input files were passed to egypt, and it seperately displays all defined functions within those files, as well as, in this case, any calls that go to any other function defined within the input files. this is obviously a bit unwieldly, as the calls are already getting ambiguous (many lines clumped together) with only 3 input files, and warzone has 185 *.c (as of the last time i checked out svn).
so, a variation on this output mode that i'm in the process of coding will allow for the creation of one graph per input file, but with some of the benefits of the multiple-input-file graphs (such as showing which file each called function resides within).
http://www.last-ditch.net/egypt-warzone-perfunction.png
this output shows one graph per each function defined within the specified codebase. any dotted lines you see represent "indirect" calls as defined by gcc: they're functions that aren't called by a symbol reference (such as calling the function explicitly), but are executed by address, such as in the case of a callback. any functions that have a dashed ellipse around their name is supposed to be a function that is not defined within the specified codebase (malloc, as you might know, isn't defined in any part of the warzone source code). there appears to be a bug, since many functions are "dashed" that appear as though they're warzone-related (such as "mapHeight" and "mapWidth"), but i think that bug is fixed by now.
i'm planning on making a way to output hot-linking svg, or, more probably, html files with corresponding png's and image maps, which would allow you to click on a function and see that function's own graph (which would allow you to navigate the whole codebase with much greater ease). there's also the possibility of integration with doxygen comments and integration with gprof, but i'm not going to think about those right now.
if anyone really cares, i'll, of course, be making my modified version of egypt freely available under the same license as egypt (which is itself under the same license as perl), but at the moment, it's too unstable and otherwise unusable -- if you really want it in its present state, you may have it, but don't expect me to respond very quickly to the couple hundred questions you email me.
good news: i've been modifying warzone to be able to split up and organize call graphs in a number of different ways, with the intent that egypt be able to usably handle arbitrarily large code bases (which means that it'll, in theory, help me, and anyone who's interested, in learning the warzone source more quickly). here's some of what my modified version was able to do a couple of subversions ago:
http://www.last-ditch.net/egypt-warzone ... tfiles.png
this one used egypt with an output mode that is a variation off of the original and only output mode: in this one, 3 input files were passed to egypt, and it seperately displays all defined functions within those files, as well as, in this case, any calls that go to any other function defined within the input files. this is obviously a bit unwieldly, as the calls are already getting ambiguous (many lines clumped together) with only 3 input files, and warzone has 185 *.c (as of the last time i checked out svn).
so, a variation on this output mode that i'm in the process of coding will allow for the creation of one graph per input file, but with some of the benefits of the multiple-input-file graphs (such as showing which file each called function resides within).
http://www.last-ditch.net/egypt-warzone-perfunction.png
this output shows one graph per each function defined within the specified codebase. any dotted lines you see represent "indirect" calls as defined by gcc: they're functions that aren't called by a symbol reference (such as calling the function explicitly), but are executed by address, such as in the case of a callback. any functions that have a dashed ellipse around their name is supposed to be a function that is not defined within the specified codebase (malloc, as you might know, isn't defined in any part of the warzone source code). there appears to be a bug, since many functions are "dashed" that appear as though they're warzone-related (such as "mapHeight" and "mapWidth"), but i think that bug is fixed by now.
i'm planning on making a way to output hot-linking svg, or, more probably, html files with corresponding png's and image maps, which would allow you to click on a function and see that function's own graph (which would allow you to navigate the whole codebase with much greater ease). there's also the possibility of integration with doxygen comments and integration with gprof, but i'm not going to think about those right now.
if anyone really cares, i'll, of course, be making my modified version of egypt freely available under the same license as egypt (which is itself under the same license as perl), but at the moment, it's too unstable and otherwise unusable -- if you really want it in its present state, you may have it, but don't expect me to respond very quickly to the couple hundred questions you email me.