-2

I have a massive C++ code to probe into from github and it would be helpful if I can generate a dependency diagram for the code base. Ideally I would like to know what function triggers other ones in the code and where are they located. Is there any program/software that does this? Thanks

0 _
  • 10,524
  • 11
  • 77
  • 109

1 Answers1

0

This is called a call graph. One option is cflow together with pycflow2dot and dot. More options can be found at: https://stackoverflow.com/a/17844310/1959808

Example C file:

/*
 * simple demo for pycflow2dot, use with:
 *    cflow2dot -i example.c -f png
 * for help:
 *    cflow2dot -h
 */

#include <stdio.h>

void say_hello(char *s)
{
    printf(s);
}

void hello_1()
{
    say_hello("Hello 1 !\n");
}

void hello_2()
{
    say_hello("Hello 2 !\n");
}

int main(void)
{
    hello_1();
    hello_2();
}

From this file, with the command:

cflow2dot -i example.c -f png

the following image is produced:

1

0 _
  • 10,524
  • 11
  • 77
  • 109