How can I make gdb print a structure's fields recursively,
i.e. follow pointers.
Right now, I have to go inside each field and either specify a '*' to print
the sub structure, or have to type cast to see what's inside the substructure.
e.g.
typedef struct {
int a;
}A;
typedef struct {
A *pA;
int b;
}B;
typedef struct {
B *pB;
int c;
}C;
C var_c;
C *pC = var_c;
... ...
Now, I would like to do "p *pc" on gdb prompt,
to see everything rather than just the address of pB.
The best way to achieve what you want is to write a python pretty-printer for your structs. Documentation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With