c++methodshierarchydoxygencall-graph

c++ call graph, but as text


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.


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.