This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is it possible to convert the pointer of struct member to the struct pointer.


If there is a struct:
struct A {
   int b;
   int c;
};


void func(int *c) { [...trap point..] }

main()
{
struct A a;
func(&a.c);
}

Now we are breaking in the body of func, and I want to take the value
of b. Can any command  do this?

I know I can substract 4 from c's address to obtain the address of b,
but it is not what I want. Can I use the explicitly type converting to
do this?

Thanks.
abai


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]