簡體   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