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

Daniel Jacobowitz drow@false.org
Mon Apr 2 11:03:00 GMT 2007


On Mon, Apr 02, 2007 at 03:47:57PM +0800, Bin Chen wrote:
> 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?

No.  You can go up and print a, but that's it.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb mailing list