When I generate Linux kernel cscope database by issuing make cscope
I get database file along with a list of files with relative path. This is a problem for me because later on when I attach that external kernel's database in vim editor from whatever directory but kernel's I can easily search for specific symbol BUT I can't open file that symbol is contained in.
I've written the next bash script
#!/bin/bash
SNAME="$0"
SNAME=${SNAME##*/}
function usage()
{
echo Generate Linux kernel cscope database
echo "Usage: $SNAME [PATH]"
echo -n "You must provide this script with an ABSOLUTE path of your "
echo "kernel's root directory"
}
if [[ -z "$1" ]]; then
usage
exit -1
fi
KDIR="$1"
echo -n "Collecting a list of files... "
if find "$KDIR" -path "${KDIR}/arch/*" ! -path "${KDIR}/arch/x86*" -prune -o \
-path "${KDIR}/include/asm-*" \
! -path "${KDIR}/include/asm-generic*" \
! -path "${KDIR}/include/asm-x86*" -prune -o \
-path "${KDIR}/tmp*" -prune -o \
-path "${KDIR}/Documentation*" -prune -o \
-path "${KDIR}/scripts*" -prune -o \
-name "*.[chxsS]" -print > cscope.files; then
echo done
else
echo failed
fi
echo -n "Building cscope database... "
cscope -k -qb && echo done || echo failed
that collects all files I need (x86/x86_64 architecture) using absolute path and then I successfully build cscope database manually. But I think it must be some easier way to accomplish this. Maybe some Makefile's target like make cscope_abs
or make cscope_ext
that I have not found yet.
Any suggestions?