Check this out!

Sunday 18 July 2010

Using "cscope" and "ctags" - A simple manual

#############################################
## Using ctags and cscope - a simple guide ##
######## By Vikram TV and Shashidhar G ######
#############################################


# !!! This is not a shell script to be run


# first find the path of the filenames to be tagged, by using extensions


find . -name "*.[ch]" > filenames
find . -name "*.cxx" >> filenames
find . -name "*.cpp" >> filenames


# now build the "tags" file for the files listed in `filenames'


ctags -L filenames


# tags are now created in tags


# use vim to traverse the tag file
# invoke vim as


vim -t tagName  # tagName is the pattern that you want to search


# or invoke vim directly with `tags' as


vim tags


# and do pattern search or use the command `tag' at ':' in vim
#  like


/main


or


:tag main


# now use Ctrl-] to move to the particular function and Ctrl-t to get back to previous window





Using Cscope:


# invoke cscope with option 'i' either with `tags' file or `filenames' as


cscope -i tags


or


cscope -i filenames


# now query different definitions, function calls, etc, etc from cscope.  Use `tab' to switch between windows
#  and enter to move to particular line.

# Happy tagging and scoping ;)
# Cheers:)TEAM
# gshashidhar125@gmail.com
# tvvikram.sjce@gmail.com

No comments:

Post a Comment