问题
I am looking for a command line utility on *nix, that can dump the names of all the functions, classes etc. defined in a file(C/C++/Java)
回答1:
ctags can give you that (and much more). It is included with most Linux distributions...
http://ctags.sourceforge.net/whatis.html
回答2:
It is not clear which language you refer to: if:
- complied elf file then you have readelf utility providing that you compiled file with debug information "-g"
回答3:
Not sure if it would be useful for your exact purpose, but take a look at GCC-XML
回答4:
You might also want to take a look at cscope which is similar to ctags suggested in the accepted answer. It creates its own symbol database. It provides a nice interface for you, enabling search of a given symbol/inclusion/file/declaration within your project.
回答5:
You can try Doxygen to list all your functions (see also XML output possibility) http://www.doxygen.nl/
来源:https://stackoverflow.com/questions/3801518/linux-tool-to-list-all-functions-in-a-source-file