内核源代码查看工具cscope

jc posted @ 2011年2月20日 15:08 in Linux小贴士 , 2560 阅读

#**********cscope配置使用***********#

1. 用find.sh生成文件cscope.files
2. 创建数据库指令:
    cscope -b -q -k
3. 进入数据库指令:
    cscope -d
4. 按ctrl+n向下移动,ctrl+p向上移动,选择查找类型
   按tab在菜单和查找结果列表中切换
5. 在查找结果列表中,移动方式和菜单中一样.
   或者按结果列表前的数字或字母进入.
   或者按+/-上下翻页.
6. 进入查找结果条目会自动打开vi,查看完成退出vi便返回cscope
7. ctrl+d退出cscope.

8. 在vi中工作:
   cscope可以在vi中查询而无须退出,方法就是:

   :cs f c name

# c是指查询的类型,详细解释如下. 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

# 在vi模式下如何在查找结果中移动
  屏幕/页/行    上翻:    空格/d/j    下翻:    b/u/k
  按q然后输入查找结果条目前的数字即可进入.
# 以上介绍的前提是在打开vi时已经加载数据库,否则无效.
  加载办法为,在.vimrc中加入:
  :cs add ${数据库的路径}/cscope.out ${数据库的路径}/cscope  
  set cscopequickfix=s-,c-,d-,i-,t-,e-

# 键盘映射方式

 

      nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
      nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
      nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
      nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
      nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
      nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
      nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
      nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
  
    键盘的敲击方法就是ctrl+ \ + g
 
# cstag + taglist + cscope 
 
    先在目录下:
 
$ cstag -R
 
    然后在.vimrc增加:
 
:set tags=$YOUPATH/tags
 let Tlist_Exit_OnlyWindow=1
 let Tlist_Use_Right_Window=1
 let Tlist_WinWidth=30
 set cscopetag
 set csto=0
 
   在tlist中,  o ---- 新建一个窗口并进入tag
                space ---- 显示tag原型
                 - ---- 折叠
                 + ---- 展开
   Ctrl + ] 查找
   Ctrl + t 返回

 

Avatar_small
CoreneOrtiz 说:
2021年1月10日 22:18

This is the platform where you can upload all the programs. According to economics hw help, You can upload any program of your choice which you considered to be the best. The program you share here is visible in the whole world.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter