cscope: How to use cscope to search for a symbol using command line?

后端 未结 2 1130
野性不改
野性不改 2021-02-09 04:58

All the cscope tutorials I found online talk about how to use the interactive mode of cscope to search for symbols in editors such as vim and emacs. But I think it should be pos

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-09 05:17

    You are probably looking for this:

    cscope -L1
    

    You could use -d as well, although if you're modifying the files, it's good for cscope to update it's database.

    -L means "execute a single line-oriented command", and the following digit (1 in this case), which could also have been written as a separate option, is the specific command, which the manpage confusingly calls a "field". The "fields" are given by the interactive cscope prompt; I added the digit for convenience. "this" refers to the text which follows the digit; remember that it's a pattern so you don't necessarily have to type the full symbol.

     0 Find this C symbol:
     1 Find this function definition:
     2 Find functions called by this function:
     3 Find functions calling this function:
     4 Find this text string:
     5 Change this text string:
     6 Find this egrep pattern:
     7 Find this file:
     8 Find files #including this file:
    

提交回复
热议问题