如何提供多个c文件作为GNU Cflow的输入?

gra*_*cha 6 c linux gnu call-graph cflow

我能够使用gnu-cflow生成一个文件的调用图,但我无法找到如何使用cflow为多个文件生成调用图.

我试过跟随

  • cflow test.c,hello.c

    它为test.c生成调用图,而不是为hello.c创建调用图

  • cflow test.c hello.c

    它为hello.c生成调用图,而不是为test.c创建调用图

我不知道如何将多个文件传递给cflow.

对此有何想法?

你好ç

int
 who_am_i (void)
 {
     struct passwd *pw;
     char *user = NULL;

     pw = getpwuid (geteuid ());
     if (pw)
     user = pw->pw_name;
     else if ((user = getenv ("USER")) == NULL)
     {
         fprintf (stderr, "I don't know!\n");
         return 1;
     }
     printf ("%s\n", user);
     unused_function();
     return 0;
 }

 int
 main (int argc, char **argv)
 {
     if (argc > 1)
     {
         fprintf (stderr, "usage: whoami\n");
         return 1;
     }
     return who_am_i ();
 }
 void unused_function()
 {
     printf();
     error1();
     printf();
 }
 void error1()
 {
     error2();
 }
 void error2()
 {

 }
Run Code Online (Sandbox Code Playgroud)

test.c的

int tests()
{ return 0;}
Run Code Online (Sandbox Code Playgroud)

gra*_*cha 3

  • cflow test.c 你好.c

实际上,上面的陈述是正确的,tests() 不会出现在调用图中,因为它从未被调用。

@AndreasGrapentin 给出的答案