ikirankumar
ikirankumar

Reputation: 115

How can cscope be used through script to find definitions?

Is there any way cscope can be used in script to find global definitions? I am looking for options where I can validate the sizes of structures used while memory allocation. Instead of writing a program to find the definition on my own, I intend to use cscope to find the definition of the structure. Later I can parse through the definition and calculate the size of the structure. Thanks in advance.

Upvotes: 2

Views: 964

Answers (2)

ikirankumar
ikirankumar

Reputation: 115

Got this solution:

cscope -d -L1<symbol>

-L option does a single search with line-oriented output when used with the -num pattern option. num is the menu option starting from 0. So '1' stands for global definition menu option -d options means not to build index again.

Upvotes: 2

Related Questions