I am trying to find a way to dump ALL the functions name and it's path from cscope database. Is there a way to do that from cscope CLI?
Note: the cscope source code is available for download.
I am trying to find a way to dump ALL the functions name and it's path from cscope database. Is there a way to do that from cscope CLI?
Note: the cscope source code is available for download.
Try the following:
cscope -R -L -2 ".*" | awk -F ' ' '{print $2 "#" $1}' | sort | uniq
cscope -R -L -2 ".*"
will output functions called by
any function (see explanation of the options below). For each reference found, cscope
outputs a line consisting of the file name, function name, line number, and line text, separated by spaces.awk
to extract the function name $2
and file name $1
separated by #
. Change $2
, $1
and the separator #
if you need other output fields or separator.sort
.uniq
.cscope
options (see http://cscope.sourceforge.net/cscope_man_page.html):
-R
Recurse subdirectories for source files.
-L
Do a single search with line-oriented output when used with the
-num pattern option.
-2 ".*"
Go to input field num (here 0-based field 2) and find
pattern (here .*
for all). You can see the input fields in cscope's screen mode. This may vary depending on the version you are using. The fields for version 15.8a under debian are: