Question

For a given method (eg. Settings.cpp getSettingByName()), I would like to get a text representation of the call graph. I've heard doxygen can generate an image of the call graph, I'm more interested in a text output.

For example, if I gave it "Settings.cpp getMethodByName" it would return:

Settings.cpp getSettingByName();
    SettingsWrapper.cpp getMaximumSpeed();
        ECU.cpp monitorSpeed();
            Operate.cpp runECU();
                Main.cpp run();
        CruiseControl.cpp accelerate();
            Operate.cpp runCruiseControl();
                Main.cpp run();
        Radio.cpp playApplauseThroughSpeakers();
            Operate.cpp runStereo();
                Main.cpp run(); 

Is this possible?

Many thanks, Fidel

ps. don't freak about the code, it's just an example.

Was it helpful?

Solution

I'm not aware of any prebuilt solutions for that.

However, Doxygen will in fact generate the (image) call graph by building a GraphViz dot file for the call graph. The Dot format is raw text and very simple, so you might find it easiest to let Doxygen run, and parse the generated .dot files yourself.

OTHER TIPS

It is super late, but I am going to mention it anyways.

For C source files, you can definitely use cflow. It will shows you the textual output for C files as you mentioned it.

However, unfortunately, when I tried it out for C++, the output was almost garbage. Keep in mind that I didn't investigate its C++ feature thoroughly and I only was looking to parse C files. It has an option flag called --cpp though that gets a C Preprocessor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top