Are there any tools that can extract all variables (both public and static) from a set of C files?

I am wondering if there are any tools that can extract all variables (both public and static) from a set of C files, and then export all the referenced variables to a text file.

Thanks in advance.

+4
source share
4 answers

Doxygen does this pretty well (here are some examples ). ctags does this too, but I haven’t played much with it other than using it in vim. I am sure that the tag file can be processed.

+2
source

You can try cscope

More here

+1
source

Not sure if this will help you, but it would be easy to do with Cil from http://www.eecs.berkeley.edu/~necula/cil/index.html the problem is that you will need to learn OCaml to use his. (Some people may consider this feature.)

+1
source

Unix nm (1) in binary format may be useful. And I used cxref about 15 years ago.

0
source

Source: https://habr.com/ru/post/1309720/


All Articles