I am trying to get the address of a struct member from debug info using gdb.
My problem is that I have a structure like:
typedef struct{
int a;
int b;
int c;
}tstructDesc;
tstructDesc myStruct =
{
1,
2,
3,
};
int main()
{
/* Do something */
}
With gdb I can get the address of the myStruct structure with the command "info address myStruct", but I'd like to get the addresses of the member variables (myStruct.a, myStruct.b, myStruct.c). I discovered the "ptype myStruct" command which returns the definition of the struct, from which I can calculate the relative and absolute addresses, but I think it's not an effective way to get the task done.
Do you know any other way to get the addresses of the struct members?
Thanks in advance, Tamas