yogi_en
yogi_en

Reputation: 131

GNU Global - Not able to find definition of struct elements?

I have the following questions. GNU/global doesn't seems to be able to find the defintion of a field in a structure in C. Example follows.

In File a.c

typedef struct {
    myType1  type1 ;
    myType2  type2
    int      var;
}pType, *pType;

In File b.c

int main()
{

  pType  newType;
  newType.myType1.somevar = somevalue;
  return 0;

}

global is not able to find the defintion of myType1 or somevar in the above example. If I execute gtags-find-tag for the symbol myType1, it gives error tag not found.Is there any way to achieve this using global?

Any help is appreciated.

Upvotes: 0

Views: 858

Answers (1)

ArtemB
ArtemB

Reputation: 3632

For starters your code is not a valid c code. gtags might've silently choked on it.

Now, back to global. It does keep track of types and should be able to find pType (try it after you fix syntax in your example).

Global does not help much with fields. You can find them as symbols with "global -s" but it will not tell you where it's been defined. All you get is where that symbol is mentioned. Sort of what "grep -r" would do.

Upvotes: 1

Related Questions