实用技巧:使用Emacs+Cscope来阅读代码

;1. 安装 cscope, http://cscope.sourceforge.net/ 到这里下载cscope, 最新版本为 15.6 。如果你使用 debian 或者 ubuntu,直接 sudo apt-get install cscope就可以了 2. 安装 xcscope.el 把 cscope 附带的 xcscope.el 文件放到你的 emacs的 load-path 下,在 ~/.emacs 中增加: (require "xcscope) 3. 生成 project 文件列表,可以用如下命令完成 。例如kernel代码,找出所以 .h, .c, .S文件 find -type f | grep -E ".[chS]$" > cscope.files 4. 生成 cscope 索引文件, -k 专门用于生成 linux kernel 源码的索引 cscope -b -k 5. 运行 emacs,以下是一些常用的按键 C-c s C-h 查看所有的 cscope 相关的按键 C-c s a 设定索引文件所在目录 C-c s c 查找调用该函数的地方 C-c s g 查找该符号的全局定义 C-c s f 查找该符号对应的文件 ... 如果习惯了Emacs的这种按键,感觉使用起来还是挺方便的,感兴趣的可以自己体会 。

    推荐阅读