繁体   English   中英

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

[英]how to give more than one c file as input to GNU 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()
 {

 }

test.c的

int tests()
{ return 0;}
  • cflow test.c hello.c

实际上上面的语句是正确的,并且tests()没有出现在callgraph中,因为它从未被调用过。

@AndreasGrapentin给出了答案

另一个方便的命令是:

cflow *.c

注意:
此命令将忽略所有子目录中的C源文件。

参考:
GNU cflow手册:第6章 - 控制符号类型

要使cflow能够处理此类声明,请将__P声明为包装器,例如:

cflow --symbol __P:wrapper * .c

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM