I was able to generate the callgraph of one file using gnu - cflow, but I was not able to find out how to generate the call graph for multiple files using cflow.
I tried following
cflow test.c,hello.c
It generates the callgraph for test.c and not creating it for hello.c
cflow test.c hello.c
It generates the callgraph for hello.c and not creating it for test.c
I don't know how to pass multiple files to cflow.
Any idea about this?
hello.c
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;}
Actually above statement is correct and tests() does not show up in callgraph, because it is never called.
answer given by @AndreasGrapentin
Another convenient command is:
cflow *.c
Note:
This command will ignore C source files in all sub-directories.
Reference:
GNU cflow manual: Chapter 6-Controlling Symbol Types
For cflow to be able to process such declarations, declare __P as a wrapper, for example:
cflow --symbol __P:wrapper *.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With