Chinaunix首页 | 论坛 | 博客
  • 博客访问: 250523
  • 博文数量: 65
  • 博客积分: 2599
  • 博客等级: 少校
  • 技术积分: 710
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-04 10:49
文章分类

全部博文(65)

文章存档

2015年(4)

2013年(2)

2012年(4)

2011年(51)

2010年(4)

分类: LINUX

2011-03-14 15:10:35

1. 安装cscope,在GVIM 7版本中,已经预先安装好了(同时也安装了Ctags)。
2. 建立cscope 数据库
    2.1 进入源代码的跟文件夹:cscope -Rbqk
          -R: 在生成索引文件时,搜索子目录树中的代码
          -b: 只生成索引文件,不进入cscope的界面
          -q: 生成cscope.in.out和cscope.po.out文件,加快cscope的索引速度
          -k: 在生成索引文件时,不搜索/usr/include目录
3. 在Gvim中使用cscope
          cs add /home/.../src/cscope.out   /home/.../src/
4.  cscope 使用
:cs help
cscope commands:
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 assignments to
help : Show this message (Usage: help)
kill : Kill a connection (Usage: kill #)
reset: Reinit all connections (Usage: reset)
show : Show connections (Usage: show)
s: 查找C语言符号,即查找函数名、宏、枚举值等出现的地方
g: 查找函数、宏、枚举等定义的位置,类似ctags所提供的功能
d: 查找本函数调用的函数
c: 查找调用本函数的函数
t: 查找指定的字符串
e: 查找egrep模式,相当于egrep功能,但查找速度快多了
f: 查找并打开文件,类似vim的find功能
i: 查找包含本文件的文


   

阅读(2226) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~