Chinaunix首页 | 论坛 | 博客
  • 博客访问: 424923
  • 博文数量: 103
  • 博客积分: 1455
  • 博客等级: 上尉
  • 技术积分: 1380
  • 用 户 组: 普通用户
  • 注册时间: 2012-09-15 22:17
文章分类

全部博文(103)

文章存档

2013年(4)

2012年(99)

我的朋友

分类: LINUX

2012-12-31 10:57:13

这是一个类似与ctags的在函数间跳入跳出跳来跳去的插件
1.cscope介绍
它可以帮你从蜘蛛网一样的海量工程文件中找到你想要的思路
定位你要debug的代码段
修改全局变量
它可以解决的问题
       Where is this symbol used?
       Where is it defined?
       Where did this variable get its value?
       What is this global symbol's definition?
       Where is this function in the source files?
       What functions call this function?
       What functions are called by this function?
       Where does the message "out of space" come from?
       Where is this source file in the directory structure?
       What files include this header file?
函数,变量和头文件的跳转,它的功能当让还是没有source insight全面,但是结合另一些插件也能提供很出色的功能
注意,当你的程序存在竞争的问题时,不能使用跳转的功能

2.cscope命令
add命令,例子:
 EXAMPLES >
            :cscope add /usr/local/cdb/cscope.out
            :cscope add /projects/vim/cscope.out /usr/local/vim
            :cscope add cscope.out /usr/local/vim -C
这个命令是用来添加一个新文件或者数据库的。他的第一个操作数是一个cscope数据库文件
如何生成.out数据库文件 之后会做说明

find命令
                0 or s: Find this C symbol 找到这个c标志
                1 or g: Find this definition 找到定义处
                2 or d: Find functions called by this function 找当前函数调用的函数
                3 or c: Find functions calling this function 找到调用当前函数的函数
                4 or t: Find this text string 找到这个字符串
                6 or e: Find this egrep pattern 
                7 or f: Find this file 找到这个文件
                8 or i: Find files #including this file 找到这些文件

例子:
 EXAMPLES >
            :cscope find c vim_free
            :cscope find 3  vim_free
<
            These two examples perform the same query: functions calling
            "vim_free". > 这个命令会忽略空格?

            :cscope find t initOnce
            :cscope find t  initOnce
<
            The first one searches for the text "initOnce", the second one for
            " initOnce". >

            :cscope find 0 DEFAULT_TERM
<
            Executing this example on the source code for Vim 5.1 produces the
            following output:
            Cscope tag: DEFAULT_TERM
               #   line  filename / context / line
               1   1009  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"amiga"
               2   1013  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"win32"
               3   1017  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"pcterm"
               4   1021  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"ansi"
               5   1025  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"vt52"
               6   1029  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"os2ansi"
               7   1033  vim-5.1-gtk/src/term.c <>
                         #define DEFAULT_TERM (char_u *)"ansi"
找到所有定义为DEFAULT_TERM的变量 

help命令
    cs help

kill命令:
    断开一个cscope的关联,当时用-1参数时,断开所有的关联
reset命令
    cs reset重置所有的cscope关联
show命令:显示所有现有的关联库文件
    cs show






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