linux tool to list all functions in a source file?

醉酒当歌 提交于 2020-08-04 06:32:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!