Listing C/C++ functions (Code analysis in Unix)

后端 未结 5 1492
栀梦
栀梦 2021-01-04 09:42

Whether we\'re maintaining unfamiliar code or checking out the implementation details of an Apache module it can help if we can quickly traverse the code and build up an ove

5条回答
  •  渐次进展
    2021-01-04 10:24

    cscope is very good for this sort of thing. Unlike ctags, cscope provides an interface suitible for searching (ctags requires an editor).

    Just run cscope in the root directory of the code you want to inspect. It will: create a database if one isn't there, update the database if one is there, and open a curses gui where you can query all sorts of useful info

    • all references to a symbol
    • global definitions
    • functions called by a function
    • functions calling a function
    • text string
    • regular expression pattern
    • a file
    • files including a file

    ctags only does the first one, 'all references to a symbol'.

提交回复
热议问题