reference:
http://blog.chhsu.org/2009/03/multi-projects-of-vim-using-cscope.html
http://rickey-nctu.blogspot.com/2009/02/vim-srcexpl.html
Installing:
sudo apt-get install cscope ctags
Build my environment:
step1: Put debug.sh into ~/bin/
#!/bin/bash
CSCOPE_FILE=cscope.out
if [ -n "$1" ]; then
echo "Source code directory: " $1
echo "Create file map : " $CSCOPE_FILE
find $1 -name "*.h" -o -name "*.c" -o -name "*.cpp" > $CSCOPE_FILE
cscope -bkq -i $CSCOPE_FILE
# cscope -Rbkq
ctags -R
else
echo "Please key-in path of project"
fi
step2: modify cscope_map.bin on /usr/share/vim/vim72/plugin/cscope-map.bin
let i = 1
while i < 20
if filereadable("cscope.out")
let db = getcwd() . "/cscope.out"
"echo db
let $CSCOPE_DB = db
cs add $CSCOPE_DB
let i = 20
else
cd ..
let i += 1
endif
endwhile
Debug:
step1:
go to project and type: #debug.sh
step2:
Open you want to trace code via vi
ex: vi /arch/arm/mach-xxx/board_xxxx.c
Trace code :
(Ctrl+\+c) : who call this function --> (Ctrl+\+t): return back
(Ctrl+\+g) : find this function defination --> (Ctrl+\+t) : return back
(Ctrl+\+s) : which function uses this function --> (Ctrl+\+t) : retunn back
沒有留言:
張貼留言