cscope
cscope is an interactive, screen-oriented tool that allows the user to browse through C source files for specified elements of code. By default, cscope examines the C (.c and .h), lex (.l), and yacc (.y) source files in the current directory. for more info visit man cscope.
Create cscope cross-reference(or database)
cscope -bcqR
Open cscope to browse code
cscope -d
It will will display this menu:
So the whole screen is devided into two part
-
Input Area
-
Result Area
By looking the curser, you can get which area you are in. Bydefault, cursor will be in input area.
Press the
After searching it will display this menu:
Press
Script to create cscore with selectable directory
#!/bin/bash
if [ 0 -eq $# ]; then
echo "Uses: $0 dir1 dir2 ..."
exit
fi
echo $#
find_cmd="find"
for path in "$@"
do
find_cmd+=" "
find_cmd+="$path"
done
for ext in cc hh h c cpp p1 xml py
do
find_cmd+=" "
if [ "cc" == $ext ]; then
find_cmd+="-name \"*.$ext\""
else
find_cmd+="-o -name \"*.$ext\""
fi
done
find_cmd+=" > cscope.files"
echo $find_cmd
eval $find_cmd
cscope -q -b -i cscope.files
ctags -L cscope.files
©2023-2024 rculock.com