This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Is it possible to convert the pointer of struct member to the struct pointer.
- From: "Bin Chen" <binary dot chen at gmail dot com>
- To: gdb at sourceware dot org
- Date: Mon, 2 Apr 2007 15:47:57 +0800
- Subject: 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