Lists the functions called by the source file.

Is there a flag that I can set so that the compiler (linker?) Gives a list of all the functions called (not just defined) in each individual source file during the compilation (linking) process?

Thanks,

+4
source share
5 answers

I don't know if VS can do this, but you can use doxygen to create a call schedule for each function.

+3
source

You can try CppDepends to create a dependency map of your project along with other useful information.

+2
source

Compile it into an object file and get a list of undefined external characters in it. You can get the list automatically using the appropriate tools for your platform: on Linux, it is readelf .

+1
source

For a single function, right-click and select "Call-Browser-> Show Call Graph".

If you do this from main (), you will get a call tree for the main () thread. You will need to do this at the entry point for each thread to get a complete picture of the multi-threaded application. It may not handle functions called with pointers, of course.

+1
source

or you can use another editor. For example, SourceInsight does a great job of creating real-time calls / called graphs in the editor.

For weekend programs: I found close testing of C code in the county . Visual Studio requires some manual work because Visual Studio has low compatibility with C99.

External tools (e.g. doxygen and CppDepends) are very useful if you can live with 2 constrainst:

  • Not only call dependencies, but also dependencies on whether global variables are tracked
  • dependencies are static

For static dependencies, consider the following example:

 void foo(boolean b) { if (false == b) { bar1(); } else { bar2(); } } 

Static tools then output both bar1 and bar2. The run-time call graph displays either bar1 or bar2 depending on the value of the parameter.

0
source

All Articles