cscope的一个严重的缺陷是,它会把结构体声明等也当成定义,当你要查看一个结构体的定义时,很多没有用的输出。
int (*setup)(struct platform_device *, struct legacy_probe *probe, struct platform_device;
发现gtags还是比较好用的,但是其本生不支持vim的tag stack,需要寄生在cscope中。办法是替换cscope的程序为gtags提供的gtags-cscope,这样上层的使用方法和cscope一样,但是底层的符号引擎使用gtags的。
从http://cscope.sourceforge.net/cscope_vim_tutorial.html,下载cscope_maps.vim。创建 ~/.vim/plugin目录,将cscope_maps.vim拷贝到上述目录,然后修改一下。添加:
1 2 3 | if filereadable("GTAGS") set csprg=gtags-cscope cs add GTAGS |
如果检测到有GTAGS,则设置csprg为gtags-scope,然后添加GTAGS。
修改后的cscope_maps.vim插件:
https://insidelinuxdev.net/~yuanjianpeng/cheatsheet/cscope_maps.vim