달력

52024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

cscope

Tool/editor & source viewer 2011. 5. 23. 23:22
cscope - interactively examine a C program

i.e) cscope -R
i.e) cscope -b -q -k -R
i.e) cscope -d

-sdir  Look in dir for additional source files. This option is ignored if source files are given on the command line.

-R     Recurse subdirectories during search for source files.

-b     Build the cross-reference only.

-q     Enable fast symbol lookup via an inverted index. This option causes cscope to  create  2  more  files (default  names  ``cscope.in.out''  and  ``cscope.po.out'')  in addition to the normal database. This allows a faster symbol search algorithm that provides noticeably faster lookup performance for  large projects.

-k     ``Kernel Mode'', turns off the use of the default include dir (usually /usr/include)  when  building the database, since kernel source trees generally do not use it.

-d     Do not update the cross-reference.

<vim plugin>
$ cd ~/.vim/plugin
$ wget http://cscope.sourceforge.net/cscope_maps.vim

    " The following maps all invoke one of the following cscope search types:
"
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
아래와 같이 Ctrl + \ 에 위 단축 알파벳을 입력하면 된다.
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>

그밖에 Ctrl + space 로 찾은 결과를 새 Window에서 볼 수 있으며,
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>

Ctrl + space + space 로 Vertical Split도 가능하다.
nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
Posted by neodelicious
|