views:

375

answers:

4

I want to parse current c++ files in a project and list out all the methods/functions in it and then generate the function call and caller trees. F.g. you can refer how doxygen generates the call tree.

I have checked gccxml but it doesn't list the functions called from another function.

Please suggest me some lightweight tools (open source) which I can use it.

thanks!

+3  A: 

gccxml, currently, essentially ignores function bodies (including calls to other functions). A good overview of C++ parsing options currently available is here -- not necessarily a bearer of good news, but recommended reading.

Alex Martelli
He is so right in his analysis that it nearly makes me cry.
Matthieu M.
+2  A: 

You mention Doxygen. Why not use that?

John Zwinck
+4  A: 

The static call tree isn't necessarily the runtime call tree. Callbacks and virtual functions muddy the water. So static analysis can only give you part of the answer.

The only way I've ever been able to get a reliable call tree was to run gprof on the on the compiled executable. The output can be massaged into a very accurate call tree.

caspin
A: 

I probably misunderstood , but visual studio have something similar. Right Click a function and select Call Browser.

Alex