Search code examples
javac++methodshierarchycall-graph

call graph for a single method (c++ and java)


For a given method (eg. Settings.cpp getSettingByName()), I would like to build a static call graph. Is there an opensource tool that can do this for both java and c++?

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();

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

Many thanks, Fidel


Solution

  • Doxygen is an excellent tool that can do this for both Java and C++. It even generates graphical and clickable call graphs.