1. 软件包:
vim-common.x86_64 2:7.4.827-1.fc22 @System
vim-enhanced.x86_64 2:7.4.827-1.fc22 @updates
vim-filesystem.x86_64 2:7.4.827-1.fc22 @System
vim-minimal.x86_64 2:7.4.827-1.fc22 @System
ctags.x86_64 5.8-16.fc22 @fedora
cscope.x86_64 15.8-11.fc22 @fedora
2. 使用
2.1 生成必要文件
$ find . -name "*.h" -o -name "*.c" -o -name "*.cc" -o "*.cpp" > cscope.files
$ cscope -bkq -i cscope.files
$ ctags -R
-rw-rw-r--. 1 May May 112104 Jan 11 12:22 cscope.po.out
-rw-rw-r--. 1 May May 61082 Jan 11 12:22 cscope.out
-rw-rw-r--. 1 May May 57344 Jan 11 12:22 cscope.in.out
-rw-rw-r--. 1 May May 28764 Jan 11 12:22 tags
2.2 搜索使用
在vi命令模式输入:cscope help查看cscope简要
add : Add a new database (Usage: add file|dir [pre-path] [flags])
find : Query for a pattern (Usage: find c|d|e|f|g|i|s|t name)
c: Find functions calling this function
d: Find functions called by this function
e: Find this egrep pattern
f: Find this file
g: Find this definition
i: Find files #including this file
s: Find this C symbol
t: Find this text string
help : Show this message (Usage: help)
kill : Kill a connection (Usage: kill #)
reset: Reinit all connections (Usage: reset)
show : Show connections (Usage: show)
在vi命令模式输入cscope find gf main 在当前打开的文件查找main有关定义(命令可能的简写:cs f gf main)
cscope show 查看使用的数据库文件,如果没有对应的文件,使用cscope add namefile 加载进来
参考http://www.cnblogs.com/itech/archive/2012/03/23/2414145.html等