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 ("%sn", user); unused_function(); return 0; } int main (int argc, char **argv) { if (argc > 1) { fprintf (stderr, "usage: whoamin"); return 1; } return who_am_i (); } void unused_function() { printf(); error1(); printf(); } void error1() { error2(); } void error2() { }
test.c
int tests() { return 0;}
Advertisement
Answer
- cflow test.c hello.c
Actually above statement is correct and tests() does not show up in callgraph, because it is never called.
answer given by @AndreasGrapentin